My Raspberry Pi Powered
Sinclair ZX Spectrum

I've previously posted about my Raspberry Pi Powered Commodore Plus 4 build, now it's time to revisit another one of my cherished childhood machines, the Sinclair ZX Spectrum. I had the Toastrack model back in the day, Although I now have a Spectrum +2 in my collection.

I have seen this build done several times before, so it's nothing new, and after stumbling across a reasonably cheap empty Spectrum 48K case on eBay, I'd thought I'd give it a go myself. Obviously I would have to improve on the build when I do it...

So let's get down to business, there's not much going on inside this machine, just a Raspberry Pi Zero, two home made connectors for the keyboard membrane, some extensions for the Zero's ports, and a couple of buttons mounted on piece of strip board.
The Spectrum keyboard membrane connects directly to the Zero's GPIO pins, and is read by a Python script and the uinput module

The parts required for this build are...
One (preferably dead) ZX Spectrum 48K (or 48K+) with working keyboard membrane
One Raspberry Pi Zero (Original/W/WH)
Power supply for the Pi
Heatsink for the Pi
Micro SD card (16GB at least)
Eight 1N4048 diodes
Mini HDMI plug to HDMI socket
Micro USB Plug to USB socket (mine wasn't long enough, so I needed a short extension as well
Micro USB socket to micro USB plug
Some small pieces of strip board
Both of the connectors for the keyboard membrane (you can take these from a dead board, or you can buy them new)
A load of GPIO jumper wires
Header pins for the Zero and strip board
Two small normally open momentary buttons
The Software of your choice (Retropie / ZXBaremulator / Sinclairian etc)

Tools required
Screwdriver
Soldering iron
Solder
Double sided tape or glue
Computer

Build details
First thing to do is remove the five screws on the bottom of the case then remove the main board, be careful with the keyboard membrane, they are fragile.

Keyboard connectors



There are two membrane connectors, a five way and an eight way, the five way just needs the connector soldering to the strip board along with a pin header, the eight way is the same, but needs a diode in between each connector and pin header, the negative end of the diode (marked by a black band) needs to be away from the membrane connector, ie, towards the Pi. In the second image above you can see the cut I made in the board to electrically separate the two sides of the diode

Switch board



The next step is to make the board with the buttons fitted, I found these buttons in an old Freeview box, and with a bit of persuasion they fitted nicely on the strip board, the two sides of each switch just go to a pin header, you don't need a resistor, and you can use a common ground if you prefer

Positioning it all inside the case




Now it's time to fit the extension leads in place, the first picture was an early mock up, the second and third pictures show the final position of the ports, the power and USB sockets are mounted on small scraps of strip board stuck together, the HDMI socket has been filed down to the plastic inside because it was too big to fit in the expansion port, then it was stuck down with double sided tape, the two buttons fit nicely in the EAR and MIC port holes, although I'm sure you could do a better job of lining them up in the centre of the holes than I did

Connecting the GPIO leads to the Pi

This is tricky as there's a lot of wires to connect, so here's a crudely made image showing which wire goes to which GPIO pin. This is viewed from above looking into the bottom half of the Spectrum, the left track on each keyboard membrane is pin 1.


Software
The original ZXScanner scripts and installation instructions can be found here. You may notice things have changed a bit and the instructions aren't quite right with the installation of the dependencies, but it's not too hard to figure out.

You will need to modify the zxscanner.py script slightly

Open the file in Notepad++ and look for the code under the line # MagPi Article Mappings

dataLines = [26,19,13,6,5] and addressLines = [25,24,23,22,27,18,17,4]

Put a # in front of both of these to comment them out

Scroll down to the next section where it 's headed # Original Mappings and remove the # from the lines starting dataLines and addressLines

You have just swapped the GPIO pin numbers over, the script was featured in the same MagPi as my Plus4 was, but with different GPIO pins used, so the script now contains both

You will also need to install mpg123 to hear the sound when the buttons are pressed

apt-get install mpg123

It was at this point during testing I discovered the keys 6, 7, 8, 9, and 0 weren't working. So the whole build was stripped down, the membrane tested, the code analysed, and continuity tests performed, it was eventually discovered to be a broken track on the eight way connector board.

The script as it is only allows one button, which swaps over the key mapping and exits FUSE, I added the code for the second button myself, also I swapped the key mapping around to include a backspace key, so you can delete text easier

You can download my version of the script and the updated sound files here, just replace the original files with this these

The differences are, Two buttons are supported, connect the 2nd button to GPIO3 and ground, this gives start, restart, and shut down functions

So on my build a short press on the left button swaps between the different key maps for the Speccy keyboard, and a long press exits FUSE. While a short press on the second button when the Pi is halted will start it up, when it's running pressing the button for a second will restart the Pi, and a long press will shut it down

Finally
That's it really, not much hardware to assemble, it's mainly about the software

Enjoy!

?STRING TOO LONG ERROR

Welcome to the brand new comment section for Rpispectrum
No comments yet, be the first to leave a comment for Rpispectrum












Any inappropriate comments or spam can be reported using the report inappropiate comments option in the share menu below, and could be deleted without notice by the cats, or site security as we call them.





Exhibits in the Recreations room
• 400mini
• A500mini
• C64mini
• Rpiplus4
Rpispectrum

• Recreations home • Homepage
Share this page
• Share page to Facebook • Share page to Threads • Submit page to Reddit • Copy page URL to clipboard
• My social media pages • Feedback about this page • Report inappropiate comments
Copied!