Make a retro USB keyboard out of a 1980's Acorn Electron computer!
The Electron was an 8-bit computer first produced in 1983, based on the legendary BBC Micro. Although it was a budget home machine, it came equipped with a decent keyboard. To many of us who grew up in the 80s the sound and feel of an authentic mechanical keyboard brings back many happy memories.
Incomplete, untested or non-working Electrons can still be found on Ebay and elsewhere, sometimes for as little as f10, and this project will give these noble machines a second lease of life. I use mine as a keyboard for a much later British computing success, the Raspberry Pi.
Step 1: Assemble the ingredients!
You will need:
The tools needed are:
You will also need (brief) access to a PC running Windows.
Step 2: Dismantle the Electron
Open the Electron case by removing the four Philips screws on the underside. Gently separate the top and bottom halves of the case: the keyboard is attached to the top half, and the power supply and motherboard PCBs are on the bottom.
The keyboard connects to the motherboard via a flat flexible cable (see photo). Unplug this (it just pulls off) from the motherboard. The motherboard and power supply boards can now be unscrewed from the case and removed; they are no longer needed.
Next, unscrew the keyboard unit from the upper case by removing 5 Philips screws.
If the case or keyboard is dirty, now is a good time to clean it up. I found that an old toothbrush and sodium bicarbonate worked very well: wet the toothbrush, then pick up a small amount of bicarbonate powder with it. If you drop anything between the keycaps, make sure it is removed before proceeding.
Step 3: Detach the flexi cable
The first version of this project use the existing flexible cable connected to a pin header, but it was awkward to construct, and the cable itself was unreliable where it entered the connector. The best solution turned out to be removing the cable altogether and replacing it with ribbon cable.
To remove the cable:
Step 4: Solder in the headers
The two 16-pin headers can be soldered into positions J1 and J9 on the KL25Z board, as shown in the photograph. There is a small capacitor (marked C24) which will prevent the J9 header from sitting on the board properly - I found the easiest answer was to file away a small notch in the header to allow clearance.
Step 5: Prepare the ribbon cables
The keyboard is connected to the KL25Z via two ribbon cables. The "J1" socket (the lower one in the photo) needs a 14-way ribbon cable, and the "J9" socket a 12 way cable. Both of these cables should be placed in the left-most 14 or 12 spaces in the 16-way socket (as shown in the photos). IDC sockets can most easily be assembled by gently squeezing them onto the cables in a bench vice.
Note: if the sockets have a 'polarising' bump, so they only fit in the 16-way headers one way round, make sure you get them on the right way round! Refer to the photos for details.
Once the sockets are on, separate the individual wires at the other ends, strip them and tin them so they will go through the holes on the keyboard PCB. Wiring these up is mostly straightforward...
We'll call the left-most wire in each ribbon cable "wire 1", so we have "J1 wire 1" to "J1 wire 14", and "J9 wire 1" to "J9 wire 12".
We'll number the holes in the keyboard PCB from 1 to 22, with 1 being nearest the edge (at the left in the above photo).
The ribbon cable wires then go into the keyboard PCB holes as follows:
1. J9 wire 1 (PTE5)
2. J9 wire 3 (PTE4)
3. J9 wire 4 (GND)
4. J9 wire 10 (P3V3)
5. J9 wire 5 (PTE3)
6. J9 wire 7 (PTE2)
7. J9 wire 9 (PTB11)
8. J9 wire 11 (PTB10)
9. J1 wire 1 (PTA1)
10. J1 wire 2 (PTC7)
11. J1 wire 3 (PTA2)
12. J1 wire 4 (PTC0)
13. J1 wire 5 (PTD4)
14. J1 wire 6 (PTC3)
15. J1 wire 7 (PTA12)
16. J1 wire 8 (PTC4)
17. J1 wire 9 (PTA4)
18. J1 wire 10 (PTC5)
19. J1 wire 11 (PTA5)
20. J1 wire 12 (PTC6)
21. J1 wire 13 (PTC8)
22. J1 wire 14 (PTC10)
Note that four of the signals on the J9 cable are not used. The signal names (PTE5 .. PTC10) are shown on the Quick Reference card which accompanies the KL25Z board - you can use this for fault-finding if the keyboard doesn't quite work as planned.
If you've got this far: well done, the hardest part is now over! Time to put the kettle on and fire up that PC.
Step 6: Load the KL25Z firmware
The firmware required to run the keyboard was built using the tools at mbed.org. To set up the firmware on the board requires two stages:
You will need a PC running Windows to do this.
Changing the bootloader
The official instructions for upgrading the bootloader are at http://mbed.org/handbook/Firmware-FRDM-KL25Z , but I'll recap them here.
Loading the keyboard firmware
Modifying the firmware
If you would like to create your own custom keyboard firmware, or are just curious, the source code is available on the website at http://mbed.org/users/IH/code/electron_kbd/
The source file main.cpp contains detailed comments about the keyboard wiring and how the Electron keys are mapped to USB ones.
Step 7: Put it all together!
Once the firmware is loaded, you can assemble the KL25Z board into the Electron case, as shown.
Remove the rubber feet which go through the mounting holes, place the board in a suitable location in the case, and mark through the holes (I used a fine-tipped permanent marker) onto the case. Drill out these holes (a 4mm wood bit will do a good job) then mount the KL25Z using M3 nuts and screws.
I used nylon washers between each nut and the PCB to avoid damage. Note that one of the four holes is very close to J1, and you may not be able to use this mounting hole.
The keyboard's USB cable is a USB A to mini-B cable plugged into the other socket on the board (labelled 'KL25Z') to the one you used for programming. It can be threaded out through the slot in the back of the lower case moulding. I glued a small rubber grommet around the cable at this point to provide some strain relief.
When this is done, you can plug the two ribbon cables in as shown, and you're ready for testing!
Step 8: Troubleshooting
When assembly is complete, you can test the keyboard by plugging it into a Windows, Linux or Mac computer.
If there are any problems, here are some tips:
Check the board is powered
Check the firmware is loaded
Check the keyboard wiring
Step 9: Keyboard mapping
You may have noticed there are far fewer keys on the Electron keyboard than on a modern machine, and that a number of the symbol keys are in odd places. Where there's a discrepancy I've tried to keep keys in the places your fingers expect them to be. This gives the following keyboard mapping: