Keyboard hacking seems like fun

TL;DR: I think I've caught the DIY keyboard hacking bug, and I'll probably end up building something weird.

I love tinkering and I love keyboards. But, I'd never really tinkered with my keyboards - at least, not beyond disassembling & cleaning them. I'd seen a smattering of crowdfunded projects over the years like the ErgoDox and Keyboardio. But, those seemed like complex design & manufacturing efforts - not like, you know, something I'd do for fun.

But then, last summer, I ran across Massdrop and saw the Infinity 60% Keyboard Kit. From there, I ran across "Introduction to Keyboard Programming" and some rusty gears turned over in my brain. I discovered geekhack and Deskthority and fell down a dangerous rabbit hole of switches and caps, layouts and plates, microcontrollers and firmware.

Turns out there are a bunch of folks doing this stuff as a hobby, along with a niche industry to support it.

After a few months of absorbing information and spectating on projects in forums, it occurred to me that this did in fact seem like something I'd have fun doing. But, rather than just dive in, I decided to start small:

Last weekend, I ran to my local Micro Center and picked up a Teensy 2.0. That seems to be the microcontroller board a lot of keyboard projects have been using, so I figured getting acquainted with it would be handy. After the traditional "hello world" project of getting an LED to blink, I wired up a pile of buttons on a breadboard and built the firmware to my first DIY USB keyboard.

Okay, so it was just a tutorial and no special effort on my part. But, the process was super easy, so the hacking possibilities started piling up in my head.

Then, I discovered the TMK keyboard firmware on the geekhack forums. Basically, all the software work had been done for me. The TMK firmware is a ready-made pile of code for translating from basically any matrix of switches or wire protocol to USB HID keyboard codes - complete with support for flexible key maps, mouse control, function-key layers, macros, and a bunch of other things.

My little 10-key breadboard toy wasn't all that practical. But, I discovered that the TMK firmware also supported building keyboard converters. Of particular interest was the PS/2 to USB keyboard converter, since I just happen to have a pile of older PS/2 keyboards lying around doing nothing.

The converter only took 4 wires, so I sacrificed a PS/2 cable from the back of a drawer and came up with this:

Coincidentally, the day after I built this, I got some IBM Model M keyboards from a friend of mine. I've been wanting to fill my office with the sound of buckling springs for awhile, now.

This is all hooked up to a modern MacBook Pro, but the IBM Model M is decidedly lacking in Command (⌘) keys. So, the DIY converter proved its worth immediately.

I put together my own simple keymap and spent a day with it, tweaking as I went. I set up a file watcher to rebuild the firmware whenever I changed the source. Along with that, the Teensy Loader has an "auto" mode which reprograms the Teensy whenever I hit the reset button.

At this point, I've replaced the Caps Lock key with Control and changed Alt keys to Command keys. Then, I turned the Print Screen / Caps Lock / Pause trio into volume control keys. After that, F10, F11, and F12 were pressed into service as previous, next, & pause buttons for music. It was all a bit fiddly, but it's the kind of thing I enjoy.

Overall, this all feels like a nice intro into a new hobby. Next, I'm considering replacing the IBM Model M keyboard controller altogether, which will embed the Teensy right in the case.

After that, I'm tempted to turn my screwdriver on that other keyboard on my desk - the Happy Hacking Keyboard Professional. There's a Teensy-based alternative controller option for it, also using the TMK firmware.

Once I feel comfortable with all that, it might be time to build something of my own! I've got a 75-key layout I'm mulling over. If I end up liking that, I can get a case & mounting plate designed & fabricated. Then, I can buy all the switches and diodes. And last, but not least, I'll have to design a circuit board & get that fabricated.

Or, if I really want to go for that handcrafted artisan experience - which I just might, because I'm a glutton for punishment - I've got something like this in my future:

blog comments powered by Disqus
Building a USB controller for an IBM Model M  Previous Review: Steam Controller Next