Skip to content

ZX Raspberry Version 2

In which our hero downsizes radically

A couple of months ago we held the first in the ‘regeneration’ of the Milton Keynes Raspberry Jam. I took along my ZX Raspberry for all to see and wonder over. One eager and Sinclair-experienced attendee soon put me in my place. “Shame it’s so laggy”, he said. Ah. A brief defence of the necessary compromises in design ensued but I had to admit he was right, it was laggy; too laggy to be of any real use if you finally want that Jetpac high-score.

A couple of weeks later, in one of those classic ‘shower’ moments, I realised that the build was vastly overcomplicated. Recent Raspberry Pis have more than enough GPIO inputs for the ZX Spectrum’s keyboard matrix (13) and my experiences with the Atarpi project had shown me that handling keyboard inputs in Raspian had come a long way.

So here’s the original ZX Raspberry:

And here’s our version 2:

Keep it simple, right? This version takes all the keyboard lines direct to the GPIO (with a switch for handling keyboard modes) and uses a Python script to scan the keyboard for presses which uses the python-uinput module to inject those keypresses into the kernel. Did I think Python would work? Not for a second. It did. Brilliantly. The new ZX Raspberry v2 is significantly more responsive and the Raspberry Pi Zero W has plenty of horsepower to run everything.

I also decided to move to RetroPie as the OS for this project as it is just so good and refined. Setup was a breeze and Fuse works perfectly. I’ve finally got rid of that dratted mouse pointer too. As a bonus, the bluetooth capabilities of the Zero W mean I could pair a PS3 controller and use it as a Kempston joystick. Again, never expected it to work. Again, worked perfectly.

My ZX Raspberry v2 made its debut at the second Milton Keynes Raspberry Jam last weekend. There were no complaints*.

* Ok, one. “Have you got Chuckie Egg?” “Does this look like a BBC to you?”

UPDATE: After many requests, I’ve made the Python keyboard scanning script available on Github along with some notes to get you started.

Published inMakesRaspberry PiVintage Tech


  1. Great stuff! I’ve just ordered a replica case from Retro Radionics with the idea of doing the keyboard mod and maybe the Pi later but the cleanness of this has changed my mind.

    I have an original Model B and original Zero gathering dust. I guess there’s enough Pins on the Model B for this but the Zero could potentially be switched into gadget mode and be a USB keyboard in addition.

  2. Jozef Gallik Jozef Gallik

    Hello, great work!
    I had an idea to make just simple keyboard version for PC with emulator from my old Didaktik Gama (Czechoslovakian Spectrum clone) and found your page. After seeing you using Raspberry Pi for the complete standalone HW/SW emulator, I followed your path and seized your knowledge with version 2 (Raspberry Pi only and Retropie) 🙂
    Now, the job is done, waiting just for some additional extension cables and fan to finish the back design of the keyboard nicely with all connectors and ventilation.

    I would like to report just couple hickups to you:

    1. the libsuinput library didn’t install on my system based on your guide for some reason and as I am not very skilled with linux, fortunately I have found help on the library home site as alternative way descibed below:
    git clone
    cd libsuinput
    make install

    2. The Raspberry Pi is overheating, so I checked and it seems that the Python running is getting 100% of CPU, while Fuse only something around 20% – not sure how the CPU is running on 120%, expecting that each core has it’s own 100%.. Anyway, is there some way how to make the script use some kind of interruptions or so, so that it’s not taking that much CPU, please?

    3. Not sure if it’s possible, or it’s more of an OS issue, but the ZX keyboard is not usable in linux CLI where each keypress generates at least 3-10 characters typed instead of making a delay after first character written after keypress. Also, we cannot use backspace (shift+0) and we have no other alternative on ZX keyboard. I will try to check and maybe update the script myself, but as I never worked in Python, it will take some time and maybe you have already tried..

    4. Not anything wrong with your guide, just reporting that Didaktics have same type of keyboard as original Spectrum, just the order of pins is different, so I had to connect the 8 pin part of cable pin by pin, each time testing the keys captured. Nothing too difficult.

    That’s all I can remember just now from top of my head. Anyway, great thanks for your guide here, it saves me huge amount of time and also made me ending up with even more enhanced version of the system comparing to what I was about to build first, based only on Arduino board.


    • PJ PJ

      Hi Jozef,

      Interesting stuff. I haven’t had the CPU problem, nor have I had the cli ‘repeat’ issues you report. try adding some time.sleep(10) after a keypress detection to ‘de-bounce’ it. I’ll have a think about it and report any insights here.

      • Jozef Gallik Jozef Gallik

        Hi PJ,
        yes, that is what I did and it helped me to reduce the repetitive key presses together with the CPU load – from 100% to 1.5% with time.sleep(.05).
        Currently tried to control the fan within the same script, but not successful yet. I am used to debug things, but not sure how to do that with python, especially when it starts after boot.. I think I will need to stop that first and run normally..

Leave a Reply

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