Four Kitchens
Insights

Hacking an Apple Extended Keyboard II

2 Min. ReadDevelopment

You might have heard me preach the benefits of using a mechanical keyboard. They offer sharp and precise keystrokes, high degree of customization, reliability, and a lengthy lifespan. Most mechanical keyboards are offered with a Windows-only layout, missing the CMD key and potentially flipped control and option keys. I didn’t want to deal with those issues again, and after having waffled for a few months on getting a new keyboard, I found an Apple Extended Keyboard II, AEK2, on eBay and bought it. Shipping included it was cheaper than most decent mechanical keyboards, and actually looked like it belonged, no key remapping required.

The only issue with using a keyboard manufactured in the early 90’s: no USB. At the time Apple was shipping keyboards with Apple Desktop Bus (ADB). There are a few off-the-shelf solutions to convert ADB to USB, but most have been discontinued or are ridiculously expensive. There is also the DIY solution, which I’ll cover in this post.

You’ll need the following components to make this possible,

  • Teensy 2.0
  • 1k Ohm resistor
  • Some wire
  • A system capable of programming a USB based microcontroller, your computer should work just fine

Depending on how you decided to wire the Teensy up, you can keep everything internal to the keyboard, or slice up the ADB cable[1]. Connect ADB pin 1 (Data) to Teensy pin D0, pin 3 to Teensy VCC (5v), and pin 4 to Teensy GND (Ground).

ADB female socket from the front:
  ,--_--.                 
 / o4 3o       1: Data
| o2   1o |     2: Soft power (Power up)
 -  ===  -      3: VCC
  `-___-'       4: GND

Additionally, that resistor, wire it up like so:

Keyboard       Converter
               ,------.
5V------+------|VCC   |
        |      |      |
       [R]     |      |
        |      |      |
Signal--+------|D0    |
               |      |
GND------------|GND   |
               `------'
R: 1K Ohm resistor

Once you’ve completed the wiring, clone tmk_keyboard and maneuver to converter/adb_usb. If you’re using the Teensy you can just execute, make -f Makefile.teensy[2]. Once the .hex file has been created, download the Teensy Loader application, hook up your Teensy, and flash the newly created firmware. After the Teensy reboots, you should have a new keyboard!

[1] Really just mini-DIN cable, S-Video.

[2] Xcode command line tools and/or brew should sort that.