Not Safe From Wolves

My New Old Keyboard

Coming up on two years ago, Nick (our Managing Director at work) ordered this:

New Apple Keyboard

and got this:

20 Year Old Apple Keyboard

It’s definitely one of the funniest cases of Amazon product substitution that I’ve seen, and due to massive amount of badly-written robots crawling Amazon listings and fuzzily matching ASINs up to their own catalogues, it may not be unique.

No one wanted to deal with packaging up and raising customer service tickets with Amazon for the sake of a keyboard, so Nick ordered an official keyboard and let me keep the design classic1 that is my Apple Extended II keyboard.

I grabbed the Apple IIgs hardware reference from some web page somewhere, and digested the Microchip ADB interfacing tech-note. I found and pored over someone else’s ADB Arduino code, and I wrote quite a bit of timing specific Arduino code but never got very far. I managed to send instructions over ADB – turning on and off the caps-lock light – but never once managed to read a keystroke.

I had followed the tmk_keyboard discussion on GeekHack and starred the project on GitHub. It relied on a Teensy 2.0, which aren’t available cheaply (or, at least, as cheaply as I would like) in the UK. Early versions needed the Teensy because they used the PJRC USB stack, which I believe is only (legally) available on a Teensy board.

Lots of time has passed, and I checked back in on GitHub to see that an alternative USB stack is now supported: LUFA. This means that you can run tmk_keyboard on any compatible ATMega device. Looking at the available clones I picked out a not-quite-Arduino Pro Micro and waited patiently for it to arrive.

It arrived.

Sadly, in the mean time I had started another electronics project at work, and have left the only other Arduino I have there, along with my Bus Pirate. I had planned on using either the ArduinoISP sketch or the Bus Pirate to program the firmware straight over the top of whatever is included on the Pro Micro out of the box, but wasn’t about to make the trip to work to do it.

I also wasn’t really keen on waiting either.

The Pro Micro ships with a bootloader that appears as a AVR109 compatible programmer. This might be a one-time shot I had at this, but I was happy to take that chance as I could always unbrick the device when I got my hands on a proper programmer.

Building the firmware, I should point out, was really simple. I got the cross development tools that the README recommended, commented out some features from the Makefile that I felt I didn’t want to spend any RAM on, and I ran make. It spat out a .hex file ready to write.

I got the command line ready in my terminal

sudo avrdude -P /dev/tty.usbmodem* -p atmega32u4 -cavr109 \
    -v -v -v -e -U flash:w:adb_usb_lufa.hex

and brought RST down to ground twice. This last step is covered in the unbricking guide for this Arduino, but I had to do it in order for avrdude to even see the device.

Unplugging the cable and plugging it into my Linux box heeded this fist-pump success moment:

[ 9088.741998] hid-generic 0003:FEED:ADB.0005: input,hidraw0: USB HID v1.11 Keyboard [t.m.k. ADB keyboard converter] on usb-0000:00:1d.1-1/input0

The board was alive; I hadn’t bricked it and it came up with the right USB identifiers! I then proceeded to have some pain with pull-up resistors (I didn’t have the right ones to hand, I made do, they were wrong) and had to make some use of the hid_listen command to get debugging output from the board.

[ Also, isn’t it cool that you can basically get a console from your keyboard firmware? Powerful devices are so cheap. ]

I wrote out the standard, correct test:

The quic brown fox jumps over the lazy dog.

Hm.

So, it looks like at some point in the last 20 years, someone has damaged the k key. This keyboard is really serviceable, so I was able to undo one screw and two clips and have the thing flipped over, solder side up.

Picture of PCB

Checking the points for the k with my meter shows it was never registering a click. I desoldered it following a guide to repair ALPS white switches – but it was too damaged. I’ve swapped it with F15, leaving me with a temporary unsightly gap.

I now have a fully functioning twenty year old loud mechanical keyboard. All that remains is to make a decent case for the adaptor.

Current Status:

Current Status

Patching into an RC car’s resistors2:

OMG OH NOES


  1. I got free tickets to the Design Museum in London last year, and they literally had one of these keyboard on display, next to the also iconic but much less pleasant to use ADB mouse. 
  2. Yes, really. My desperation at not being able to find a 1K resistor for a 5V pull-up lead to me patching into the resistors soldered on to other items. Not proud. Well. A little proud. 

Last updated:

This is archived content. New updates will appear on insom.github.io.