Now that the keyboard is fully converted to USB and working, the top half of the Spectrum is finished. Everything else (our computer) goes in the bottom. In this post, I’ll talk about installing the Raspberry Pi and by the end we will have the finished article! The bits you will need for this part of the project are:
- Your Speccy’s lower casing
- Raspberry Pi (I used a model-B) with SD card and OS installed
- Type-A male to female USB extension cable (the shorter and more flexible the better)
- Type-Micro B male to female USB extension cable (again shorter and flexible is better)
- A 4 port USB hub with 2 pairs of ports on opposing sides (such as this one)
- A USB Wi-Fi dongle (make sure it is Pi-compatible such as this one)
- HDMI (male) to VGA adapter
- The USB-Speccy Keyboard (top half) at the end, along with the casing screws
Before we begin, it’s good to know your Pi is in working order with an OS of your choice installed. If it’s your first time with a Pi, stop here and play with it first, ensuring it is desktop-ready and you know how to use it. If you want something that requires minimal setup I recommend buying a starter pack, which has the operating system pre-installed on an SD card for you. Please also enable the VGA now if you are using a HDMI to VGA adapter. A tutorial on how to do it can be found here.
Preparing the Pi
If you too have a model-B Pi, the first thing you’ll notice is that it doesn’t fit inside the Spectrum; the stacked USB sockets and Ethernet port are too tall to fit inside the casing. The best way to remove these is with an airgun. I also removed my audio and composite ports so that I could put the Pi wherever best suited me. With all except my audio port removed, my Pi looked like this:
We’ll talk about reusing some of the ports later. The plug-in parts are your Micro-B USB extension for power, SD card with the OS and the HDMI cable / HDMI to VGA if you are using one of those. Have these plugged in when you do any placements of components inside the case; you want to make sure that these all go to where they need to be before you fix anything down.
The first thing to do is restore USB capability, using your USB hub. Snip your USB plug off the hub wire, leaving as much wire on the hub as possible, and strip the four wires so you can solder them. You may also want to tin the wires’ tips. Remove the hub casing. You will likely get more wire and the USB ports will sit lower in the case. Now you need to solder the hub’s USB wire directly into the USB socket connectors on the Pi. I’ve colour-coded the holes for you below.
If you wish to install a second internal hub (though room is very tight), you can repeat the same colour sequence with the empty row in front of the one indicated. You can now place your USB hub (and Pi) inside the case. The expansion card slot at the back of the Spectrum is the ideal place to put larger ports such as your USB hub. Hopefully, two of the ports face internally and two externally. One of the internal ports is for the keyboard and the other for your wireless dongle, so you can have Wi-Fi built in.
Now is the time to prepare your video output. The model-B comes with a composite out and a mini HDMI connection. HDMI cables tend to be bulky and inflexible so I didn’t want a HDMI extension inside my Speccy; instead I opted for a VGA adapter. As with the USB hub, it was necessary to strip away the casing to fit it into a tighter space. Again, have this plugged in when you make the final placement of the Pi. You can see how I arranged my USB and VGA ports below.
If like me you want the keep the power socket in the original power socket’s place, also take care that any ports you place in the expansion bay leave sufficient room for your USB Micro-B extension on the right-hand side.
This is good time to reconnect audio and composite ports. Solder long wires to the composite and audio connectors. Now you can place them on the appropriate holes at the back and judge how long the wires will need to be, as shown below.
Still leaving more length than you require, strip and tin the wires, then solder them to the Pi, carefully matching each connection to where it originally went.
Fixing all the components
Lay everything down one last time and ensure everything fits in place, adjusting any cables that may be bent into a springy position that is likely to pop out or dislodge something. Also make a final check of how your top half fits on to your bottom half to ensure your Arduino fits and the membranes won’t be damaged. If you’re happy with how it all goes in, you can now glue everything down. I used a glue gun for this – be excessive with your ports because they are going to get wiggled and may come away. I found that type-A USB heads made the perfect spacers to raise my power, composite and audio sockets at the back, lining them up nicely with the holes.
I also glued my internal cables down, but left the Pi unglued. It is effectively suspended by all the cabling attached to it, so it places no pressure on the board’s sockets. You could glue sponges underneath and overhead to cushion it if you wish, but ensure you’re not putting the sponges where the pi will get hot!!!
Here is my project with all the components in place.
The final thing before you put the casing back together is to use your type-A USB extension cable. If you have the spare wire and a male and female USB type-A connector, you can easily make a tiny extension cable. I used 5cm sections of single-core wire. Ensure the connectors are the same way up and join the connectors as shown below. This will be very compact and bend according to the positions of the hub and Arduino, so it is ideal for minimising physical stress on the components.
Plug one end into your USB hub on the bottom, using an internal port. Then plug the other end into the Leonardo or LeoStick on the top. That’s it – that’s your ZX Spectrum’s keyboard connected to the Raspberry Pi. Nice and easy to put together, or take apart again if you need to.
You can now place the two halves together (careful not to squish anything – especially your membrane ribbons), and pop the screws back in. Congratulations on your Speccy-Pi with working USB-Spectrum keyboard! I hope you’ve enjoyed this project as much as I did.