Perform a Variety of Functions with This Adaptive Macro Keypad

See how a cheaper and more customizable macro keypad was designed, constructed, and programmed.

Evan Rust
4 years ago3D Printing / Displays / Gaming / Productivity

The Premise

For streamers, gamers, and editors, having a good set of macro keys is vital for maintaining peak efficiency. Products such as Elgato's Stream Deck have become massively popular over the past few years, and they allow creators to set up custom functions on keys that display their own functions. For example, a streamer might have a key that switches their scene from gameplay only to a scene that shows their face superimposed over a web browser. However, there is a major downside to using these products, and that is because they are pretty expensive and users are locked into whatever the manufacturer has available. It was for this reason that Max Kern built a custom adaptive macro keypad dubbed "Keybon" that has most of the functionality of a more expensive product and more customization.

Hardware

Keybon is based on an STMicroelectronics STM32F1, which was selected primarily for its low price point, direct USB interface, abundance of RAM (20 KB), and official Arduino IDE support. Kern had originally tried to use an ATmega32U4, but it only has 2KB of SRAM, which is not enough to store the images. He opted to go with nine 64x48 pixel OLED screens to show which function each button performs. They communicate with the microcontroller over the SPI bus due to their limited I2C addresses, with each one getting its own chip-select pin instead.

Everything is powered over a the USB connection, with a 3.3v regulator providing power to the STM32 and a boost converter providing power to the nine OLED displays.

The Keys

Users of the macro keypad are able to press down on the screen directly to activate their corresponding function, but this brings a few additional challenges compared to a simple button. There are off-the-shelf solutions, such as this one, but they come in at over $50 each, which is far too expensive. Instead, Kern came up with a small tray that lets the OLED sit on top of it and spring back up once the user lets go.

Because the button is small and the display is much larger, pressing on the edge of the screen will not let the button click. To solve this issue, Kern took inspiration from laptop keyboards and added a cantilever mechanism.

Design and Fabrication

After the keyswitches themselves had been designed, Kern then moved onto the enclosure itself. Due to the nature of the switching mechanism, each switch is able to be stacked and cascaded, which maximizes space. The PCB holds the switches in place, along with all of the other components. It was tricky to assemble the PCB and 3D-printed switches as the OLED had to be soldered before the mounts could be installed. A simple, 3D-printed case covers up everything to add a bit more elegance and protect the electronics underneath.

The Companion App

The software can be considered the most important component of this project. It is a Windows Forms application that was programmed in C#, and it handles opening applications, receiving commands, and setting images for each key. Layouts consist of a command from the key, a linked process or processes, and an image. These are all stored inside of an XML file, and there can be up to eight of them. Once a layout is activated, a command is sent that disables the STM32's HID functionality, and then the software sends images as a stream of bytes via USB to be displayed. If a macro key is pressed and the corresponding software isn't running in the foreground, then the process is either run or brought forward.

To build a Keybon yourself or see the code/design files, check out Kern's GitHub repository here.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles