There is a small but interesting cottage industry in the Raspberry Pi-driven macro keyboard, you can use it to add some custom functions to your PC. A few years ago, Pimoroni launched Keybow, which relies on Raspberry Pi Zero, but it needs to wait for it to start every time it is plugged in, and it must be programmed in Lua.Then, this year, Pimoroni launched Pimoroni Keybow RP2040 And Pico RGB keyboard dock, it uses Raspberry RP2040 CPU and uses multiple programming languages, including CircuitPython. And, given that Raspberry Pico and other RP2040 boards can double as USB HID devices, there are several tutorials explaining how to use them to build custom keyboards.
However, Adafruit’s MacroPad RP2040 stands out and is very useful, even non-manufacturers may want one, just to make their lives easier. MacoPad RP2040 has a complete kit, the price is 49 US dollars, or as a barebones (no switch or keycap), the price is 34 US dollars, it has a built-in RP2040 chip and a series of useful functions, including an OLED screen, a Rotary encoder dial, 8MB of flash memory, Neopixel RGB lights under each button and Stemma QT connector for connecting other electronic devices such as sensors and additional OLED/LCD screens. Whether you are a maker who likes DIY projects or just want a very flexible second keyboard, Adafruit MacroPad RP2040 is your best choice.
Specifications of Adafruit MacroPad RP2040
|processor||Raspberry Pi RP2040 (130 Hz, 264K memory)|
|Store||8MB flash memory|
|port||USB-C / Stemma QT|
|key||3 x 4 hot plug socket|
|RGB||One Neopixel RGB LED per switch|
|Screen||128 x 64 SH1106 monochrome OLED|
|Additional input||Rotary encoder (can be pressed), reset button|
|size||4.1 x 2.3 x 1.1 inches (104 x 59.5 x 29 mm)|
|weight||1.2 oz (34 g)|
Adafruit MacroPad RP2040 configuration options
You can buy the Adafruit MacroPad as a complete starter kit for $49, or you can buy the circuit board for only $34, after which you will need some other components. The $49 kit comes with a motherboard, 12 Kailh linear red key switches, 12 transparent keycaps, and a MacroPad shell kit, all of which are sold separately on Adafruit.com. If you get a bare board, you must purchase a housing kit for $5, because it includes a bottom plate and feet below the board, a top plate that holds the key switch in place, a rubber rotary encoder on the top of the panel, and a fixed bottom plate The required screws.
Because I don’t like the feel of linear switches, I bought a bare board and shell kit, and brought my own key switch, a very loud Kailh Box Jades. I attached some transparent keycaps that I was sitting around, but eventually bought some translucent blue keycaps sold separately by Adafruit. In short, if you like linear switches or don’t care about either method, then it is easiest to purchase a complete kit. If you prefer other switches, please do what I do. Whatever you do, make sure you get the housing kit; you need it.
Design of Adafruit MacroPad RP2040
The Adafruit MacroPad RP2040 measures 4.1 x 2.3 inches and is very compact, using the least space to display its four rows of three buttons each, with a small 128 x 64 monochrome OLED display and a rotary encoder located on the display The top row of keys at the top. On its back, the MacroPad RP2040 has a USB-C port, which is used to obtain power and exchange data with the computer. There is a physical reset button and Stemma QT port on the left. To enter boot selection mode-in order to install new firmware-you must press the rotary encoder while turning on the power to the device.
MacroPad has a little NASA theme, because there is a small icon of a space shuttle near the encoder, and the word “speaker” on the board is written in a font very similar to NASA. If you get a case kit or a starter kit with a case in it, there is a keyboard picture on the bottom with the words MacroPad in the same font. Depending on how you program, there are still many opportunities to add colors, because there is an individually addressable RGB Neopixel light under the switch of each key.
More importantly, the bottom plate lifts the keyboard 1.1 inches away from the desktop, but it is still much lower than my normal keyboard.There is no built-in method to adjust the height of MacroPad RP2040, but Adafruit does have several 3D printable shell / Standing You can use it, provided that you can use a 3D printer.
Assembly and setup of Adafruit MacroPad RP2040
Setting up the Adafruit MacroPad RP2040 is a fairly fast process, although getting all 12 switches into the hot-swappable sockets on the board took a few attempts, because when I tried to push the board away from the board, the switches popped out of the enclosure several times The kit is placed on them. I found it might be easier to put all the switches on the plate and then push them down. However, after I installed all the switches, they were sturdy and would not pop out of regular use.
It only takes a moment to screw on the bottom plate, you may want to tighten it before inserting the switch to avoid accidentally removing them during the process. And, whether you get a housing kit or not, you should connect some kind of lid knob to the rotary encoder dial, a process that takes a few seconds.
To perform any operation with MacroPad RP2040, you need to install the CircuitPython firmware, especially the current version 7. As with any other RP2040 board, this is easy to do.Just download the appropriate UF2 file from the following location MacroPad page on CircuitPython.org, Boot the device to boot selection mode (by pressing and holding the rotary encoder button when powering on/connecting to the PC) and drag the UF2 file to the board, it will appear as a storage drive with the label RPI-RP2 (as above every other RP2040 board).
You also need to install some CircuitPython libraries. Depending on what you want to program, you may need displayio, adafruit_hid, or adafruit_displaytext libraries, etc. Adafruit also has a dedicated adafruit_macropad library, which is only available for this device.
Programming Adafruit MacroPad RP2040
Although the RP2040 SoC supports many other programming languages, including C, MicroPython, and Arduino languages, you do want to code them in CircuitPython. Adafruit’s MicroPython branch has built-in support to convert any RP2040 device (including this device) into a USB HID device, which you can use like regular peripheral devices in Windows, Linux or macOS. It also has libraries dedicated to macro panels and Neopixel RGB lights and screens.
Adafruit is known for its detailed and useful tutorials. There are no less than 6 tutorials on how to program the MacroPad RP2040. Each tutorial has a code that you can download and use.One of the most useful is MacroPad hotkey tutorial, It provides a template for creating different sets of macro keys for different applications. By default, the code in the tutorial includes nine macro sets, including Microsoft Edge in Windows, Adobe Photoshop in Windows or Mac, and Firefox in Linux. You only need to turn the rotary encoder to choose between macro sets, and the screen will show the function of each key. For many users, this tutorial and sample code alone may be sufficient.
However, since we like to build our own programs, my son and I created some simple programs for MacroPad RP2040. First, we wrote a program to turn the device into an electronic keyboard, where the first seven keys represent the A to G keys on the piano, press and hold the other key to make them sharp, rotate the rotary encoder to change the octave, and display it on the keyboard Go to the screen. Because we use built-in speakers, the sound is not particularly loud, nor is it particularly beautiful, but the effect is very good. We also coded the MacroPad to play the entire song when the button is pressed.
The most useful program I wrote for MacroPad RP2040 is a program that simply maps each key to the function keys F13 to F24. With just a few lines of code, you can map 12 keys to any existing keyboard key or keyboard combination. For example, if you want to make a “copy” button, you can map CTRL+C to one of the MacroPad keys. Or, if there is no numeric keypad on your main keyboard, you can turn the MacroPad into one.
I chose to set my keys to F13-F24 because these extended function keys are not available in 99% of PC keyboards and have not been assigned to anything else. So I can use a dedicated macro program on my PC, AutoHotKey in my example, to assign complex macros or program startups to them without worrying about interfering with anything else.
Use cases of Adafruit MacroPad RP2040
The most obvious use case for any macro keyboard is as a second keyboard, providing you with extra keys. With just a few lines of code, you can make each key send a keyboard combination or dedicated function key message to any computer you plug in. However, there are other possibilities.
Like me, you can program the MacroPad RP2040 to play music. Or you can use it to create simple games such as Simon Says or the TK tutorial from Adafruit.
Another practical use of MacroPad RP2040 is as a time-based one-time password (TOTP) generator, which you can use as the second factor in 2FA for various services just like using Google Authenticator on your mobile phone. Adafruit has one Great tutorial Regarding how to use the TOTP keyboard, each key can be used for different services.
You can also connect Stemma QT devices (such as accelerometers, air quality monitors, or touch sensors) to the MacroPad RP2040. The possibilities are almost limitless.
Adafruit MacroPad RP2040 has a lot to love, not too much to discuss. This pad offers more flexibility and functionality than competitors such as Pimoroni Keybow RP2040.However, if you don’t like the idea of combining your own keyboards and encoding them, there are many ready-made keyboards, such as the Elgato Streamdeck series or Cooler Master Control Panel.
No equipment is perfect. I want the MacroPad to be adjustable in height so that I can adjust it to the same height and angle as my normal keyboard, even though the 3D printed stand will allow me to get there. Having a color screen instead of a monochrome screen will be another advantage, but it will undoubtedly increase the price.
However, all things considered, the MacroPad RP2040 is an excellent device that any electronics enthusiast or productivity geek will like. Just consider whether you like linear switches. If you don’t, skip the starter kit and buy a bare metal kit and enclosure kit, as well as the switch and lid of your choice.