Skip to content

A custom-built and programmed Macropad with RGB everywhere

License

Notifications You must be signed in to change notification settings

tfkq/Pico-Macropad

Repository files navigation

Pico-Macropad

pico-macropad

A custom macropad built out of a Trellis Keypad, a display, rotary encoders and an Raspberry Pi Pico

Function

This macropad features 16 RGB-lit keys to program to your own pleasure! The display shows the name of each key, so you'll remember what each of these does. Also, thanks to the rotary encoders you are not limited to 16 keys, you can create your own menu for every app you like. To switch between these menus, simply rotate the left encoder. The one on the right is used for media control, so you can adjust the volume and Play/Pause your music.

How to create a configuration: Config-Creation

Construction

Materials and parts

Part Cost Links
Raspberry Pi Pico 4.10 € Berrybase
Sparkfun RGB Rotary Encoder (2x) 9.30 € Berrybase
Rotary knob, transparent (2x) 1.80 € Berrybase
Adafruit NeoTrellis Driver PCB 12.90 € Berrybase
Adafruit Silikon Elastomer 4x4 Button Keypad 5.10 € Berrybase
Monochromes 1.3" 128x64 OLED Display - STEMMA QT / Qwiic 20.55 € Berrybase
Screws, 3mm in diameter, 16mm in length (4x) ? had them laying around

3D-prints

I designed my own case and printed it with PLA (Blue Pearl). I've put the Skynet logo on the front, because I felt the need to put something there and I have just watched Terminator 2. You can find the CAD and STL files in doc/cad-files/.

Assembly

  1. Wiring: There are some images of the wiring in the doc folder. However, there are some errors in the schematics that I haven't fixed yet.
  2. Putting the parts together: I used four screws with a diameter of 3mm and a length of 16mm I taped some foam on top of the legs for the trellis board, so it can't wiggle too much

Programming

Platform

I chose the Raspberry Pi Pico because of its speed and ability to emulate a keyboard. But for the programming part I sticked with the Arduino platform, because I already know how it works and is compatible with all devices. This was a problem with micropython, as it doesn't have widespread support for every module imaginable. I also decided myself against Cuircuit-Python, once because using a display with it is kinda a struggle, second because I programmed enough Python in the past, and I wanted to practice a little bit of C++.

Secondly, as I had some trouble sending special keycodes (Volume UP and DOWN, Play/Pause, etc) with the Keyboard-library, I decided to send a special shortcut instead, wich would be caught by an AutoHotKey script (It's Windows only, sadly, other platforms would need to search for an alternative).

Source-Code for RPi Pico

The source-code is divided into different files, here is a short summary of them:

file description
Pico-Macropad.ino main file, brings everything together by telling the other modules what to do
config.h saves the configuration of shrotcuts
display.h controls the OLED-display
display_animation.h saves data for the startup-animation on the display
led_controller.h responsible for setting the brightness of all the leds
neotrellis.h controls and reads the Adafruit Neotrellis board
rotary_encoder.h controls and reads the two rotary encoders
shortcut.h uses the the Keyboard.h-library to send the sortcuts to your PC
macropad.ahk the AHK-script. Not necessarily the one I'm using, but it is A script

AutoHotKey-Script

At first I wanted to create every shortcut inside the C++-program. However, I wanted to build a Config-Creator to create the shortcuts with a GUI. This means, that the Pico will send a generic shortcut (F24 + something), which will be catched by an AHK-script. Finally, the script will perform all the tasks.

Config Creation

To create a Configuration, you need to head over to my Config-Creator.

Credits and License

This project is under the MIT license. If you reuse any parts of this and publish it, please be so kind to mention me / this repo.