The first task was to figure out how to build a button with an integrated display. There actually are off-the-shelf solutions: NKK switches manufacture tactile switches with color displays. But at a crazy 50€ or more per key these are out of the question. Early on I decided to use small OLED displays as they are widely available and inexpensive at under 3€.
I found that 0.66in OLEDs are just the right size to allow for a compact keyboard. And their 64x48 pixels provide enough resolution to display useful icons. The displays consist of a glass panel with a flex connector that can be soldered directly to the PCB. When bending the connector under the display glass, a gap of a few mm is formed, just enough to fit a thin tactile switch in it. What’s left is a mechanism that supports the display so that when the OLED is pushed, the tactile switch is pressed.
Figuring out the key mechanism turned out to be challenging. The display has a big surface area compared to the tiny tactile switch. When pressing the button, the force needs to be evenly distributed. If not, pressing on the edge of the OLED will just rotate it around the button. I learned this when I 3D-printed my first OLED mount. It simply holds the display in place but does not limit its rotation:
Laptop keyboards solve this by using a scissor mechanism that restricts the key to a linear motion. However, I could not think of an easy way to 3D-print this mechanism without making it unnecessarily big. The solution for me was to add a cantilever to the display mount. This lets the display rotate around the point where the levers are connected to the PCB and the motion is sufficiently linear for the tactile switch to be pressed.
I continued to create a single button keyboard as a proof of concept. After a few iterations the mechanism was working. Whatever point on the screen was pushed, the button was actuated with a satisfying tactile click. The cantilever mechanism is very compact as it does not add to the height of the OLED itself. It also can be stacked to allow for a tight placement of multiple buttons in a keyboard. For this, the lever of one key overlaps with the screen of the next.
With the basics of the macro keyboard working, I went on to select the remaining electronic components.