Pi (Zero) GPIO matrix keyboard using linux HID gadget


Limp Gawd
Jun 12, 2003
Basically a feasibility / sanity check. What I would like to build is a keyboard matrix (5x16 if possible) which connects to and is read by the Pi Zero's GPIO pins, then acts like a standard HID keyboard via Linux gadget. Ideally built in such a way that one could also still be able to switch off the gadget functionality, connect an HDMI monitor, USB hub/mouse/etc, and use the keyboard matrix to control the Pi directly -- something vaguely C64-ish, for those old enough to remember such devices.

It feels like all the pieces are there -- I've seen Linux gadget be used to act like an HID device and send information across USB, and I've seen someone connect a hand-wired switch matrix to act as a local keyboard, but I've never seen those two put together for a Pi Zero.

Has anyone already dived down this rabbit hole that any of y'all know of? I know most people who have done such projects have used a ATMEGA32U4 board of one type or another (such as a Teensy), but I think this might have the potential of being an interesting new beast.

Thoughts? Am I just off the deep end? Thanks!