A 3D printable macropad for automating frequently repeated actions.
To build this project you need access to a 3d printer. The model folder contains 4 parts, with 3 of them being the main components of body: top, bottom, lid and an additional keycap component. The keycap model contain only one instance of the keycap, make sure to print 12 of them and feel free to experiment with colours.
- Raspberry Pi Pico
- Keyboard switch (x12)
- M3x12 screw (x4)
- Connection wire
The models can be downloaded from printables here.
- Populate the key switches slots of the "top" printed part with the MX switches.
- Solder the switches one to another to create a matrix as shown in the schematic.
- Solder Pico to the matrix, make sure that wires are soldered to the bottom side of your Pico.
- Insert the microcontroller into its slot in the "bottom" printed part.
- Secure Pico with the "lid" printed model with the knob facing downwards.
- Screw together the "bottom" and "top" parts with the m3 screws.
- Put on the 3d printed "keycap"s on the key switches' tips.
- Optionally, you can stick some rubber feet on the bottom side of the device.
The software is written in CircuitPython 6.3.0 and uses the HID module of CircuitPython Library Bundle.
- Download the CircuitPython UF2 from the official website here.
- Push and hold the BOOTSEL button and plug your Pico into the USB port of your computer. Release the BOOTSEL button after your Pico is connected.
- It will mount as a Mass Storage Device called RPI-RP2.
- Drag and drop the CircuitPython UF2 file onto the RPI-RP2 volume.
- Download the library bundle for the CircuitPython version you installed 6.3.0 by default from here
- Unzip the bundle; Copy
adafruit_hid
from thelib
folder to<CIRCUITPY DRIVE>/lib/
- Download the software
cd ~
git clone https://github.com/dr-mod/pico-mpad.git
cp pico-mpad/src/*.py <CIRCUITPY DRIVE>
To configure action modify key_mapping.py
At the moment there are 3 types of commands supported:
- STRING - a sequence of characters printed when a button is pressed e.g. "Hello, world!"
- KEY - a single key or combination of keys e.g. A or Ctrl + C. List of supported keycodes.
- CONTROL_CODE - a control commands e.g. increase brightness, List of supported control codes.
# ROW 1, COLUMN 1
(CONTROL_CODE, cc.PLAY_PAUSE),
# ROW 1, COLUMN 2
(CONTROL_CODE, SCAN_NEXT_TRACK),
# ROW 1, COLUMN 3
(CONTROL_CODE, SCAN_PREVIOUS_TRACK),
# ROW 1, COLUMN 4
(STRING, "sudo shutdown now \n"),
# ROW 2, COLUMN 1
(KEY, [kc.F4]),
# ROW 2, COLUMN 2
(KEY, [kc.GUI, kc.C]),
# ROW 2, COLUMN 3
(KEY, [kc.GUI, kc.V]),
# ROW 2, COLUMN 4
(CONTROL_CODE, cc.VOLUME_INCREMENT),
# ROW 3, COLUMN 1
(KEY, [kc.F20]),
# ROW 3, COLUMN 2
(KEY, [kc.ALT, kc.A]),
# ROW 3, COLUMN 3
(STRING, "Hi, this is a scripted message!"),
# ROW 3, COLUMN 4
(CONTROL_CODE, cc.VOLUME_DECREMENT)
If you would like to support what I do and keep me caffeinated, you can do it here: