12/26/2020 at 10:50 •
Thanks [Jenny List] for the writeup.
Reading through the comments I'd love to acknowledge any other people who had made insane contraptions like this. If you end up writing them up, please let me know I'd love to read them and I'll link to them from here.
To respond to the people writing things like "I'd use product X instead of going to all this effort", the answer at the time I constructed this was simple: cost.
I had pulled this awesome keyboard out of a dumpster and said to myself "man, I'd love to actually be able to use it". I had no Apple hardware, no sensible way to acquire an ADB-to-USB converter (I believe they did exist at the time and were quite expensive) and knew nothing about custom keyboard controllers, had no usable microcontroller (I hadn't encountered Arduinos yet, so electronics programming was either a Lego RCX or stuff hooked up to a computer's parallel port, neither of which would work here.) and no idea how ADB, PS/2 or USB worked, so weighing up all the available options, the simplest solution to my problem seemed to be to graft in a donor keyboard controller.
The total cost for this project was:
- $7 for the donor USB keyboard
- $20 for the USB hub (I can't remember how much it cost, but I purchased, literally, the cheapest I could lay hands on. $20 seems about right.)
- a couple of dollars for the matrix wire, solder, solder wick, etc. (all of which I had on hand already)
- a couple of dollars for the USB-B port (I believe I had to purchase one new)
- Every other piece of hardware (The Apple Extended Keyboard, USB-A ports, PCB scraps, the yellow and black wires, the thick black cables, etc.) was recycled.
My time, given that I was a university student, was free.
So overall the total cost was about $30 + a few weekends of my time.
I also wanted to remap some of the keys (specifically the ctrl, option and apple keys) so they matched the order they'd be in on a PC keyboard, so any converter would had the modifiers ordered ctrl, alt, win, not ctrl, win, alt, so I would have needed software hacks to make the keys match where my fingers think they are. I was running Windows at the time and I'm not sure it's possible to switch the modifier keys without third-party software.
If I'd done this today, I'd have found or built a USB-C hub that could use any port as the upstream port so I could have had USB-C ports on both sides and used a Teensy or equivalent to run the original matrix in place of the original controller chips. This would have made this project a mostly-software project, not a crazy hardware project. I'd also have ended up chasing the ideal of having this daisy chained with a Thunderbolt monitor or USB-C power supply.
Someone commented on the longevity of the joints and hot snot. I can only talk to this particular keyboard, but I've had zero problems over the past decade, so as far as I can tell, there's no issues with longevity. Note that this has been bounced around a bit, travelled and gone through several house moves. I'm not gentle with my electronics, even stuff I've made myself, so if it was going to fail, it would have by now.
The construction is a little eccentric, mainly because of the specific parts and stuff I had available. The yellow and black wires are multi-strand wires recycled from somewhere and are relatively flexible. All the other wire is solid-core wire and relatively inflexible. All wires are point-to-point wires between legs of the various keyswitches. Some of the soldering is a bit dodgy, but it's all solid. There are resistors at the board end of all the black wires and those are all anchored with way too much hot snot, most of that hot snot is globbed over other wires, so even if it pops off the board itself, the wires should keep it from moving around too much.
Version 2 of this, i.e. proper matrix with diodes and a Teensy, will require adding diodes to every single keyswitch, so there will be a lot more potential for movement there, but I'll be adding a lot of diodes and the matrix should allow me to tie the diodes together, so they should be no more delicate than any other hand-wired keyboard.
And the last comment was about harvesting it for parts and building something new. The goal here was, from the very beginning, to have an Apple Extended Keyboard I could use on my PC. I agree that this keyboard could easily be stripped for parts and make an awesome custom keyboard, that's not the objective here.
Thanks for the write-up, thanks for the comments and thanks for the reminder that all the bits I need for version 2 are currently in my possession - all I need to do now is build it.
11/22/2020 at 13:19 •
When I initially built this, I mapped out the matrix of the USB keyboard controller by attaching wires to the pads for the 8 rows and 18 columns to a bunch of switches and used those to map out the entire matrix.
I did this by building a piece of protoboard with 26 switches all wired to a common wire, then wiring the rows to 8 and the columns to the remaining 18. I could then simulate a key at a particula row and column by pressing the switches for the row and column simultaneously.
I wrote this up in an Excel spreadsheet which I've lost somewhere on one of the dead hard disks from my first computer.
I then cut traces and soldered wires to convert the matrix of the AEK into that particular matrix.
Now, 15 years later, I'm having to reverse-engineer the bits I need from that map by beeping out the keyboard.
I ended up with this:
(Colours indicate rows of physical keys, blank cells are rows and columns that don't have a corresponding key.)
I'm going to need to make some modifications to improve this to make the microcontroller selection a touch easier:
Then I also need to split the keypad equals key from the keypad enter key. I'll probably put it at row 4, column 14 so I don't have to re-solder both wires.
- Combine columns 9 and 15: this moves the shift keys into the gap in column 9.
- Combine columns 14 and 16: this moves the left alt key into a gap in column 14.
- Combine columns 0 and 17: this moves the right alt key into a gap in column 0.
This leaves me with 8 rows and 15 columns requiring a total of 23 GPIOs to produce a total of 105 keys. Adding in the three LEDs, I need 26 GPIOs.
Frustratingly my LeoStick has only the Arduino standard 14 + 6 = 20 GPIOs and even if I use the 3 in the programming port, I'm still 3 GPIOs short, so I'm going to have to buy a microcontroller for this.
11/21/2020 at 06:38 •
Hacking two keyboards together requires making compromises between what is available on the controller and which keys are present on the keyboard.
I got somewhat lucky by buying a keyboard with a Windows compatible power key, so I was able to wire that to the power key on the keyboard.
However there were a couple of other compromises that I made to make it all work properly:
Apple keyboards have their modifier keys arranged as Ctrl, Option / Alt, Command / Apple and PC keyboards have them arranged as Ctrl, Windows, Alt.
As a PC user, I made the decision when hacking the matrices together to ignore the labels on the keys and wire the modifiers in the PC fashion. Thankfully, this isn't a big deal as QMK lets me map the keys however I like.
Keypad Equals Key
Numpads on Apple Keyboards have a "=" key next to the numlock / clear key and all of the operator keys (+, -, * and /) get moved around to fit it in.
This isn't something that's done on PC keyboards so the controller I used didn't have any sensible place on it's matrix to wire this to.
Consequently I made the decision to make it work with most calculator applications so I wired it in parallel with the numpad enter key.
This is something that I'll have to rectify when re-wiring the matrix.
11/21/2020 at 05:17 •
My knowledge of custom keyboards and the community around them has grown immensely in the past 15 years. Concepts like easy-to-program microcontrollers with USB ports and big community led projects to make easily customisable keyboard software were unheard of when I started.
Back then Arduinos were barely a thing, let alone stuff like the Arduino Leonardo or Teensy.
So ultimately the sensible path forwards was to acquire a board that did what I wanted and hack stuff to make it work.
However today, I have desires to build designs of keyboard I can't get elsewhere (I want a full-size Thinkpad-style keyboard with Cherry MX Blues or an Ergodox style split one with a built-in Trackpoint) and maybe a simple step towards that would be to take my slightly annoying old AEK and modernise it's internals.
What's even better is that I already have a QMK compatible microcontroller on hand: a LeoStick, essentially a thumb-drive sized Arduino Leonardo with an ATMEGA32U4 (Freetronics is an Australian manufacturer of Arduino compatible boards)
So now all I need to do is modify the matrix to be compatible (which I believe will be adding diodes to prevent ghosting) and replace the existing controller board with the LeoStick.
Except it won't be, I'll have to map out the entire matrix, figure out where I can hack in the diodes, then modify it.
Mapping out that matrix will be the next step.
11/21/2020 at 04:55 •
Ultimately the fate of the AEK was that I barely used it. My computer at the time required a PS/2 keyboard, so I used a Microsoft Multimedia Keyboard on that (also excellent to type on) and shortly after I upgraded it to a motherboard that fully understood USB keyboards my partner bought me an (excellent) DAS keyboard which immediately became my daily driver.
The AEK then ended up in my pile of computer stuff in my wardrobe and was mostly forgotten about until, almost 10 years after I built it, I ended up working for a company that provided me with a MacBook Pro for my development computer, and as the supplied external keyboard (an Apple Magic Keyboard - I still don't know what made it magic) was a poor typing experience, the only obvious solution was to dig out my old Apple Extended Keyboard and plug it back into a Mac.
My colleagues loved it, I loved it, but as I got used to it's shape and layout I started typing faster and faster and discovered that while it was lovely to type on, it had a pretty glaring flaw: certain combinations of keys, ones which I hit fairly regularly, wouldn't work every time. I think that the issue is that there's a maximum number of keys the controller can detect at once and when I typed fast enough, I was hitting that limit.
I replaced it with a Logitech one which didn't have that issue.
So back into the cupboard it went until 2020 when I started working from home full-time and needed a good keyboard. My partner has an old Acer keyboard from forever ago which got her through an essay heavy university course without a single hiccough, but somewhere in the past 15 years the spacebar's springs had failed so it wouldn't pop back up reliably. I tried to fix it, but nothing I did worked reliably.
Faced with the possibility of having to steal a fairly cheap Logitech keyboard from another computer, I remembered my AEK and pressed it back into service almost 15 years after I built it.
And it's excellent, the keys are wonderful to type on, not quite as nice as the Cherry MX Blues in my DAS, but still pretty damn good, and once again, I've started running into the limitations of it's hardware: every now and again it misses a keypress. I'm clearly typing slower now than I was before, because it doesn't happen as often as it used to, but it's still bothering me.
So it's time to do something about it.
11/21/2020 at 04:40 •
Back when I was a poor university student, I came across a bunch of Apple peripherals in a dumpster, this included this Apple Extended Keyboard, a couple of mice and one of their smaller keyboards.
I'd never really spent any time with Apple hardware (my family is firmly IBM PC compatible) so I'd never typed on one, but it felt nice and after opening it up, I concluded that it would be possible to make it a USB keyboard by the simple process of completely re-wiring the matrix to suit a USB keyboard controller and wiring all of that together.
I was technically right, it was possible to do all of that, but it was a heck of a lot more effort than I'd expected and produced a far inferior result than I'd hoped for.
The parts required were pretty trivial:
- A USB keyboard (I got what was, at the time, an unbelievably cheap one for $7)
- A USB hub (this was so I could replace the ADB port on the far side with two USB ports)
- Some USB connectors (I bought the USB-B one and the dual-USB-A one came from a PC case)
- Wire (some is breadboard wire I purchased for the project, the rest is misc wire from ... well anywhere I could pull it from)
- USB cabling (all recycled from the $7 keyboard's cord)
And the process was simple, but time consuming:
- Map out the entire matrix of the USB keyboard (it had a bunch of bonus keys that the hardware recognised but didn't have a physical key, presumably for international layouts)
- "Apply" that onto the AEK's PCB
- Wire between the new controller, USB connectors and hub
- Cut out some of the standoffs and supports in the base so the wires would actually fit
- Expand the far-side ADB hole so two USB plugs would fit
- Glue everything down (hot snot FTW)
- Plug it in and enjoy it
The "application" of the new matrix onto the PCB was, by far, the most complicated and time consuming part.
I did this by doing three major operations: de-populating the board of anything that got in the way (essentially all the controller chips) cutting traces on the board where they didn't fit and wiring between pads to build out new bits of matrix where needed.
It was rather time consuming.
I can't remember exactly how I did it, but I do remember that I couldn't remove the metal plate that holds the keyswitches in position, so I couldn't remove the wire links that allowed some of the traces to jump over other traces, so I had to cut those traces by cutting the copper on the board. I estimate that I made well over 100 cuts to split the nets up into the few bits that corresponded with the matrix of the USB controller.
While I was doing that, I was also wiring between keyswitches to link the various chunks of net together to form the matrix the USB controller was expecting. I think I marked each keyswitch off as I wired it in by putting a black sharpie mark covering the copper next to the pad.
Each net got either a yellow or black wire attached to it which then connected it to the relevant pad on the USB Keyboard controller board. The USB keyboard I bought was a cheap membrane keyboard so it had some black substance on the pads which I had to scrape so I could solder to them.
The black (row?) nets also got a resistor in series with them (harvested from somewhere) to simulate the resistance of the membrane traces. (This was probably unnecessary, but I didn't want to risk it)
Finally I wired the original LEDs up to the LED pads on the controller board, wired in the USB hub, glued everything down closed it up, plugged it in and marvelled at how awesome it was to type on what was one of my first a mechanical keyboards.