The ESP-Rainbow: Flatter than a Speccy
The ZX Spectrum is beloved of British microcomputer enthusiasts everywhere. (Of course the British are everywhere, hence why they had the whole Empire thing) Its cheerful appearance is iconic even across the pond, with its small plastic case and rubbery “dead-flesh” keyboard. But what if there was a ZX Spectrum with an even worse keyboard? That was the question Atomic14 dared to ask.
It’s a rainbow
The ESP-Rainbow is named to avoid touching on any trademarks, but the appearance is unmistakable; but it doesn’t stick to the 48k Spectrum look with its built-in screen and speaker. It’s also a bare PCB. Other than the components on the PCB, there’s nothing else here. The only switches and buttons are a few tiny ones at the top. And points to Atomic14 for releasing the sources to the hardware design as well.
The brains of the operation is the ESP32S3 microcontroller. So yes, this is an emulator box. For fun, let’s compare it to the hardware it’s emulating.
ESP32S3 | Sinclair ZX Spectrum | |
---|---|---|
CPU | <240MHz XTensa LX7 | 3.5MHz Zilog Z80 |
ROM | 16-32kiB | |
Flash | 8MiB | |
RAM | 8MiB | 48kiB-128kiB |
So yes, the ESP32, a commodity microcontroller, is definitely capable of emulating an entire home computer that was actively sold until 1992. 1992 was actually awhile ago. This emulates both the ZX Spectrum 48kiB and 128kiB models; no Timex Sinclair 2068, sorry my fellow Americans.
Keyboard
My favorite thing about the ESP-Rainbow is the keyboard. For one thing, it makes excellent use of color PCB printing to give the full legends necessary for the original Sinclair BASIC. Unfortunately, the red on grey isn’t the most readable, but it’s fine if you squint.
You might wonder how exactly this keyboard works. Essentially, it is a capacitive touchscreen (or, perhaps more pedantically, capacitive buttons); GPIO lines on the ESP32S3 can be configured for capacitive touch input. The way these are expanded over all of these buttons is in the series of surface-mount chips under the ESP32.
These are 74HC4051 chips. That wasn’t a 74-series chip I’ve seen before, so here’s a datasheet. Essentially, these are multiplexers, which have shown up a lot in this blog, including in the discrete logic Dottori-kun post. A multiplexer allows you to use a small number of input lines to control a larger number of output lines.
The difference for the 74HC4051 is that these are analog multiplexers. Thus, they’re capable of handling the analog signals provided by your finger on a capacitive button. This permits the ESP32 to have any other GPIO lines for anything else.
It also produces a keyboard that has absolutely no feedback for your fingers at all. Thankfully, the firmware and a lot of ZX Spectrum software do the same trick as the Atari 8-bit computers of playing a slight click whenever you make a sound, which helps more than you might think.
Another fun consequence of this is that if you’re holding it in your hands, it’s possible (unreliably) to hit keys from the back. That’s less fun, but is an unfortunate consequence of this design.
Software
The device takes USB-C for power. There’s a header for a battery but I don’t have one to attach; this does look like something that would lend itself well to battery power, though.
The system boots up to a number of options. The 48K and 128K options simply boot to different versions of the Spectrum BIOS; those familiar with the platform will note that the 128K Spectrum BIOS also then gives the user an option between 128K and 48K BASIC (the former using letters, the latter using cool single-press commands).
But look, if we’re using an emulator box, what we care about is ease of use. Even for a hobbyist-tier project like that. So how do I get games onto it? One option would be to use a MicroSD card, but somehow I couldn’t find one.
The ESP32 offers control through a website. Now, as a retro enthusiast, my first thought when I hear that is ‘a website will go down one day’. But at least in this case the site is open source. (Hard mode: GitHub, too, will go down one day)
The other annoyance is that my preferred browser, Mozilla Firefox, doesn’t support the necessary WebSerial API. However, there is some recent activity on the Bugzilla, so maybe it will be supported eventually? From a theoretical standpoint I’m not sure how I feel about web browsers having access to serial ports, but it’s certainly convenient for things like this.
So, the hiccup of having to download a Chromium-based browser aside, it didn’t take long at all to add Manic Miner to the ESP32’s flash memory and start playing.
As long as there’s no spurious back-presses, holding the ESP-Rainbow in my hands to press the movement and jump buttons on the sides of the system is actually not too bad, and the screen is crisp and bright.
Also useful for Manic Miner is the fact that the default firmware has rewind. I have never said I was good at video games.