ZX0 is my Sinclar ZX81-like hobby computer. The idea is to make something in the ZX81 form factor, use a Raspberry Pi Zero for emulation, and then write some interesting apps that run on the emulator.

Today I got the prototype keyboard working. This uses the ZX81 40 key layout and uses a SAMD21 to scan the keys and report the LEDs. The SAMD21 is running Zephyr, talks to the Pi over I2C, and emulates the LM8333 key matrix scanner.

In the future I should be able to use the built-in Linux driver but for now the Pi runs a simple program that sends SMBus commands to read the key FIFO and publishes the keys via uinput.

Board running an emulator

I found quite a few issues with my schematic:

  • SDA and SCL were swapped. This was fixed in software.
  • RX and TX were swapped. This was fixed by swapping the pins in the cable.
  • The SAMD21 really needs an interrupt line to wake up the Pi. The work-around is to poll.
  • The USB connector is too hard to hand solder. I’ve switched this for a chunkier Adafruit connector for future versions.
  • The regulator has the wrong footprint and pin order. I couldn’t get my first choice and ordered something that I thought was pin compatible, but I was wrong. The work-around is to pull the 3V3 line from the Pi.

Next step is to create a bootloader for the SAMD21 so I can program it from the Pi. I’m thinking of starting with the Adafruit UF2 bootloader and adapting the SAM-BA / BOSSA protocol to work over I2C.

Michael Hope
Software Engineer