Skip to content

Building The ZX Raspberry – Part Three

In which our hero triumphs over excessive wiring

Back in Part 2, I completed the USB keyboard conversion of an old, abandoned ZX Spectrum. The next, and final, step is to add in a Raspberry PI so that whole unit can stand alone.

I’ve now got a working USB keyboard but I’m going for something a bit cleverer than that as I want to not only have an on-board Raspberry Pi but also the ability to use the Speccy as a USB keyboard on any other device (I’ve abandoned the original idea of a bluetooth keyboard as there’s no room for an on-board battery, so what’s the point?). To make both possible I had to design a bit of a wiring loom.

Wires! Everywhere!
Wires! Everywhere!

What we have here is a four-pole, double-throw switch (4PDT) that can take the four wires that make up a USB connection. The four central output connections go to the Pro Micro, the two throws connect to an external USB port and to an internal USB plug for the Raspberry PI. You can switch the source of power and data target of the Pro Micro between the internal USB plug for the Raspberry Pi and the external USB connector. If the system is in ‘Raspberry Pi’ mode, the Pro Micro gets its power from the USB port on the Pi. In both cases, a power feed is take from the external USB port to drive the Pi.

It was a real pain to put together. I bought some cheap short cables from Amazon to provide connectors (I’m no fan of soldering at that level and USB has standardised wiring colours). To make everything fit snugly a lot of things had to be stripped down and re-soldered. It took a couple of attempts to get it right, but the final version tested out ok.

Having proved everything I now built up the operating system but with the Raspberry Pi connected as a separate device so it was easy to take things in and out. However, it makes more sense to continue talking about the physical build and come back to software later.

Don't try and configure an advanced OS with a Speccy keyboard
Don’t try and configure an advanced OS with a Speccy keyboard

Brandishing my glue gun, I put the USB mode switch and external connector in place then hooked them up the  Pro Micro. The Raspberry Pi could be stuck into place (using less-permanent sticky pads) being careful to ensure the USB and Ethernet headers would fit in the raised part of the ZX Spectrum’s top cover. I inserted the delicate USB plug into the PI along with a WiFi adaptor (although I built the system up connected directly by Ethernet). Then the power feed from the external USB was hooked up to the Pi.

The last part of the build was to extend the access to the HDMI port. I had some trouble finding a suitable cable and the one I ended up with was less than ideal, but you can see in the pictures I sourced a 20cm HDMI extender and manipulated it into the case, gluing it down flush with the expansion port aperture. That’s the physical build finished.


On to the software.

I used Rasbian Jessie Lite as my operating system. Not only does the ‘Lite’ version have faster boot time, but also does away with the GUI, which I frankly don’t need. There’s lots and lots written on how to get the OS onto a micro SD card and booted on a Pi, so I won’t repeat it here. once the OS is installed, it will boot up and drop you at a login prompt. The username is ‘pi’ and the password is ‘raspberry’.

You’ll then get a $ prompt for entering commands. Now I know not everyone is 100% happy with the using the command line, so I’ll try and describe what’s going on for the less experienced.

To get a ZX Spectrum emulator up and running that’s easy to use without a standard keyboard being attached  there’s a few jobs to do. First let’s configure our little friend. Type the following and press Return:

sudo raspi-config

‘Sudo’ kinda means ‘Super User Do’ which in turn means ‘execute this command as root, the most powerful account on the system’. We’ll be using it a lot.

You’ll see a menu. Choose the first option and follow the prompts to expand the filesystem to use the whole SD card. You’ll need to reboot and log in again. We do this because the Rasbian image only occupies 4GB of your card and by default, it won’t be able to see any further space. This fixes that.

Time to configure your WiFi wotsit. Again, there’s a lot already written about this, so I won’t repeat it here.

Now let’s install FUSE, the ZX Spectrum emulator. We do this using Raspian’s built-in package manager. Type the following:

sudo aptitude selfupdate
sudo aptitude install fuse-emulator-sdl spectrum-roms fuse-emulator-utils

The first command updates all the sources for software downloads. The next downloads and installs the software we need. You’ll see a lot of stuff scroll by as everything is downloaded and installed. Once finished, you can test it.

sudo fuse-sdl

Ta da! Bit small? Key F1 and enable Fullscreen. If you’ve got the keyboard membrane on the Speccy wired up, you can now try it out for the first time!

Once you’ve had a play, exit (F1, Exit). Next we can set the Pi to login automatically, so you don’t have to do it using the ZX keyboard.

sudo nano /etc/systemd/system/

You’re now in nano, a simple text editor. Find the section starting [Service] and then the line that reads:

ExecStart=-/sbin/agetty %I $TERM

…and change it to..

ExecStart=-/sbin/agetty —noclear -a pi %I $TERM

Then Ctrl+X, followed by y to save. Reboot the system again to test:

sudo shutdown -r now

When the Pi reboots, you should find yourself automatically logged in.

Now create a startup script to go straight into FUSE. We’ll call it ‘go’ and place it in the a directory called ‘bin’, of which the system knowns the location of by default.

mkdir ~/bin
nano ~/bin/go

When presented with the text editor, enter the following script:

if [ -z  "$SSH_CLIENT" ]; then

        kb=$(sudo lsusb -v | grep SparkFun)

        if [ -n "$kb" ]; then

                sudo fuse-sdl


        sudo shutdown -h now


Here’s what’s going on. The first line checks if the script is being run on the actually console, i.e. not an SSH session. This prevents it trying to start FUSE when you are SSH-ing in. Next it polls the USB controllers to see if the Pro Micro is connected. If so, it starts FUSE, otherwise it initiates immediate shutdown (The flow also means that once the user exits FUSE, the Pi shuts itself down). This is done so that if the ZX Spectrum is being used as a USB keyboard, as opposed to stand-alone, the Pi will spot this and shut itself down, reducing any potential damage to the file system caused by a sudden power-off.

Ctrl+X, y to exit the editor then type:

chmod +x ~/bin/go

This makes the script executable. To make it run on login:

nano ~/.profile

At the end of the file, add


Ctrl+X, y again. If you’re unfamiliar with ~, it is a convenient alias to your home directory.

Now, re-assemble the ZX Spectrum, carefully placing the keyboard membrane ribbons into their connectors.

Upon booting, the Speccy should go straight into FUSE and give you the classic Speccy boot screen. Press the button the the back  to go into special key mode and then press 1 (now F1) to get the main menu up. Using CAPS SHIFT and the cursor keys with ENTER you can navigate the menus. Exiting FUSE (F1, then Exit) will trigger a system shutdown.

FUSE has a lot of configuration options. I’ve gone for the full purity mode by disabling the speed-ups so loads happen in real-time. Some may think that’s mad but I see it as all part of the fun. One tip: FUSE only stores settings on the options screen if you hit Return to leave the menu. If you Escape, all changes are lost. You also need to go into options and ‘Save Settings’ so they persist on the next run.

Our ZX Raspberry feeds on a high-calorie diet of TZX and TAP files. These can be placed wherever you like, although FUSE defaults to your home directory (~) so why not put them there?

And we’re done. Oh wait, the case itself is looking a little tired. Lets replace the scratched faceplate with one from SellMyRetro (£18) and re-ink the ZX Spectrum legend with an ultra-fine paint pen.

Tricky. Very tricky.
Tricky. Very tricky.


Fresh as a 1980s daisy
Fresh as a 1980s daisy


Rear Connectors and Switches. Snug!
Rear Connectors and Switches. Snug!

Some new feet on the bottom and the ZX Raspberry is complete. If I can complete Central Cavern from Manic Miner, I’ll deem this keyboard a success.

Never mind. 🙂

Possible further improvements

I’d like to get a joystick wired up. There’s space in the expansion slot aperture for a 9-pin connector and I could probably rig it to the Raspberry Pi’s GPIO port.

Speeding up boot time could be achieved by reducing a lot of services that Raspbian starts that I don’t need. You can even create your own Linux distro for the Pi to create a dedicated OS. Sounds like a fun waste of time to shave a few seconds off the boot. Update: See Part 4

Of course, the Raspberry Pi is capable of emulating many other systems. There’s no reason this couldn’t be a Speccy 128, or a NES or a Commodore (if you have a particularly twisted mind).

I hope you’ve found this series useful. If you have any questions or comments, find me on Twitter – @mrpjevans

Published inMakesRaspberry PiVintage Tech


  1. retrofan retrofan


    First of all, congratulations for this great project.
    I’m thinking of doing this ZX Raspberry myself, but I have one big dilemma.
    After I read the text about your Version 2 (with Pi Zero), where you mention that there is a noticeable lag in Version 1, I’m no longer sure what to do.
    I prefer Version 1, mostly because of the fast boot time, the feeling of real Spectrum is much better than waiting for Retropie to boot.
    So, my question is, is this lag in v1 really significantly degrading the use of Spectrum and playing games?
    I watched your video above carefully, while you are typing and playing Manic Miner, and I honestly didnt manage to notice, how much this lag affected usage?
    Is there possible some kind of compromise, for example using Version 2 (hardware and software solution with better keys response), but that Fuse can boot at the start, without RetroPie and Emulation station involved?
    Google Translate for Business:Translator ToolkitWebsite Translator

    • PJ PJ

      Now that the software is there, I would strongly recommend the second (v2) method of building this. It’s easier and faster. It’s also independent of the OS in use, so you can still use something like pipaOS booting straight into FUSE if you wish. The best of both worlds!

  2. retrofan retrofan

    Thanks for the answer.
    Yes, its easier and faster, but with v2 we no longer have standalone usb Spectrum keyboard. which would be a great replacement for the Recreated Spectrum.
    Also, some Linux OS is now mandatory with v2, because the software no longer uses the Arduino interface for communication.
    Ideally, if we had a OS independent Spectrum keyboard with usb connection and good response without lag.
    Is that possible at all?

    • PJ PJ

      I see. I think if you’re just using an Arduino Leonardo (or compatible) I don’t think you’ll find a problem. To be honest, I believe the lag could probably be cured with some better timing in the code. As for the severity, it only really showed up when you play pixel-perfect games such as Manic Miner and you may find that connected to something like a PC it will perform better. in other words, I think it’ll be fine.

  3. Rob Rob

    Hello There
    This is fantastic.
    I’d like to do the same as I have Spectrum + Case (and I believe fried motherboard, but it has the prerequisite connectors) and of course a raspberry PI. However, I don’t think I am technically proficient (the software bit probably but not great on the Hardware side). Therefore, and I am not sure how to ask this, but would you consider building the hardware components again for a reasonable cost? So that one could then ‘plug and play’ on one’s project? I’d done the same with with a broken C64 (don’t hate me) but that was much much easier as can buy a plug board that connects the keyboard directly to the PI. Its kind of weird typing in linux commands on a ’64 keyboard. I look forward to hearing from you (even If I have a C64). Thanks and all the best Rob

    • PJ PJ

      Hi Rob,

      I have a C64 AND a VIC-20, so you’re in good company. 🙂 Have you seen my latest version of the ZX Raspberry? It’s a much simpler build and performs better than this version. Would work exactly the same with a +. If you still don’t fancy it, send me an email to and we’ll work something out.

  4. Stephen Roberts Stephen Roberts

    This is exactly what I want to do, however I’m taking a harder software route by writing my own emulator. Will look this up again when I get my emulator complete.


  5. retrofan retrofan

    After collecting the necessary parts, I finally made the first version with Arduino, based on your guide.
    Unfortunately, I encountered a very strange problem, which I can not solve.
    After I connect the keyboard to the PC, everything works normally, each key I tried in a notepad or with a couple of emulators works perfectly.
    However, when I connect the keyboard to my raspberry pi 2, I constantly have a problem because occasionally random characters appear, although I did not type anything.
    After closer inspection, I realized that it was enough to just touch or just close my hand near the spectrum keyboard membrane and a bunch of unrelated characters began to appear on the screen.
    I came to the conclusion that every contact with KB1 pins or flat cable of the membrane inreasing randomly printed characters, and unfortunatelly the same thing happens also when I directly connect the keyboard to GPIO pins as in your v2 project.
    I double checked all contacts, using your Arduino sketch, (just replaced two INPUT commands, with INPUT_PULLUP) and nothing more.
    All 8 diodes on KB2 are correct and as I said when I connect the whole circuit to my PC, everything works without any errors.
    I dont know what is the cause of this problem, which practically prevented me from completing this project.
    Any help to clarify and solve this problem, would be very welcome…

    • PJ PJ

      How very strange. The first things to come to mind is that the inputs are ‘floating’. Are you using resistors to pull-up the lines on KB1? If so, don’t use INPUT_PULLUP in the script. Otherwise, could be a short on the circuit. Nothing comes to mind that would result in it working on a PC and not on a Pi, although the Pi is certainly more fussy on keyboard inputs.

  6. retrofan retrofan

    No, I used the version without a resistors on KB1, only the Spectrum molex connector directly connected to Arduino or to GPIO in version 2.
    I also suspected that there was a short circuit somewhere, but after a multiple check with the multimeter, I still can not find the cause of the problem.
    It’s possible that my bad soldering technique is the cause of all this, but I’m just not sure how, because it works perfectly on a PC, while on two of my Raspbery Pi it behaves as I described it.
    The strangest thing of all is the effect of increased printing random characters, even when I just put my hand near the Spectrum membrane, and stop when I pull my hand back.
    Also there are no side effects on the KB2 side, only with KB1 pins, with or without Arduino, when print random characters with the smallest contact or touch.
    In the end I attached only two wires to Raspbery Pi – one pin from KB1 and one from KB2 side and the problem is happening again, each time I touch a KB1 pin or connect it to the KB2 pin.
    In addition to all of this, during the whole testing process, last night I managed to bricked my Arduino Pro Micro, so I cant get it back to life, not even with hardware reset described in your guide.
    At the moment I am quite desperate for this failure, I even thought to ask you for help in making this interface and pay for it, becouse it seems that I still dont have enough technical knowledge and equipment to do this right.

    • PJ PJ

      Arduinos can normally be unbricked, but it can be fun. You need to short out a couple of pins and upload a new bootloader. not the best video, but try: for more details.

      The effect with your finger still sounds like ‘floating’ to me, which suggests that something is up with INPUT_PULLUP. When reading a pin, this behaviour is expected (even with a nearby finger) when the circuit is not correctly pulled-up. Agreed it should also happen on the other machine. This video covers the problem well:

  7. Lee Todd Lee Todd

    I got to this command and I got a blank screen. sudo fuse-sdl
    I am using rabian Jessie lite from Noobs.
    I configured the wireless connection and booted to auto login and wait for wifi etc.
    Everything updated prior, not sure what to do from here.
    Thanks in advance

    • PJ PJ

      fuse-sdl can be fun to get going. I presume you’re not SSH-ed in? That won’t work. You may need to change the resolution your Pi is running in in /boot/config.txt to one that fuse is ‘happier’ with. Did you install fuse from apt? If not, try that as it will pull in all the dependancies too.

  8. Lee Todd Lee Todd

    Hi PJ got it up and running on Raspian Stretch Lite.

    I had to change settings to run OpenGL, teak a few things to run without using the password and set screen resolution.

    Thankyou for your help

    • PJ PJ

      Great news!

Leave a Reply

Your email address will not be published. Required fields are marked *