This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: My New Old Keyboard
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Coming up on two years ago, Nick (our Managing Director at work) ordered this:
and got this:
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.
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:
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:
Thequicbrownfoxjumpsoverthelazydog.
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.
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.
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. ↩
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. ↩