Then someone asked for one, so here it is. The request was for a 1040ST, and I found a suitable candidate, this one looked quite nice, but actually appeared to be a 520STFM with a 1040STE badge? It also had a memory fault, and will serve as a supply of spares for another 1040STE I'm currently repairing.
The Atari ST keyboard has an integrated keyboard controller and two 9 way D joystick ports. This connects to the main board via a serial connection.
These are accessed from under the keyboard. A common source of faults on ST's is bad contacts on these, and this is caused by cracked solder joints due to mechanical damage. If you've ever had to wiggle a plug to get something like this to work, it's probably because of cracked joints like this. Wiggling the plugs just makes it worse as it stresses the other pins and can cause problems with them as well eventually.
So first task was to strip down the keyboard, clean all the contacts and fix the cracked joints on those connectors. I find the best way to deal with those is to effectively desolder them, removing all the existing solder, then resolder them with fresh solder.
The cable from the keyboard has an 8 way 0.1" on the end. To make wiring to the controller easier, I made a mating cable with the pin version of the Harwin M20 connectors.
- Ground
- Not connected (polarising pin)
- Floppy LED (active low)
- +5V power to keyboard
- Serial data from the keyboard (7812.5 baud, 8N1)
- Serial data to the keyboard
- Reset (active low)
- Ground
The USB keyboard controller was fixed in the case so the connector could be accessed through an existing hole.
With that in place, it was just a case of writing the software. There are various documents online referring to the keyboard protocol. It turned out to be reasonably simple, Start by pulsing the reset line low, then there was an initial bit of communication to tell it to switch into a mode where it would report all keypresses and joystick movements. It is possible to configure it to work with one joystick and one mouse, rather than two joysticks, but I thought this would be more useful. Leave the ST mice for use with STs.
It was then just a case of reverse engineering what came back from the keyboard, each keypress and key release are sent as single bytes, and joystick movement is two bytes. These were translated into USB keyboard keypresses. I had to create a matrix of currently pressed keys and update that whenever anything came from the keyboard. There are two LEDs, one power which I left as that, and the other showed disk access, this now shows caps lock status.
When plugged into a PC or Mac or tablet, this appears as a USB keyboard and two USB joysticks, so can be used anywhere those could be used, including of course Atari ST emulators.
There is quite a lot of space left inside, enough for a Raspberry Pi or something like the Intel NUC I used in the Atari 800XL PC,
Update:
See also a whole Intel i7 based PC installed in an Atari ST, using this adapter.
Update 2:
The current builds of these are a little tidied up over the original, the wires are now on the back of the board.
The yellow wire is no longer connected as it is unused, so there are two spare pins at the end.
Update 3:
2023 Update
USB Keyboard Controller Kits are available from my Sell My Retro store: