Saturday, 22 February 2014

ZX Spectrum +2A Raspberry Pi Case Mod

This was another 'by request' USB Keyboard system. There were a few requirements for what started as a ZX Spectrum Plus USB Keyboard request.
  1. USB Keyboard for emulator use
  2. Raspberry Pi
  3. Visibility of the lights on the Raspberry Pi
  4. Joystick support
One of the problems with the ZX Spectrum Plus USB keyboard is the keyboard was originally designed back in the 80s so the original ZX Spectrum board could drop right in.
The case was a lot larger, and it had extra keys, but it used the same circuit board, so could only handle the original 5x8 matrix 40 key keyboard.
What they did was the make the extra keys press two of the original keys. So, for example, double quotes is Symbol Shift + P on a Spectrum, so they added a key which when pressed actually pressed Symbol Shift and P and the screen showed a double quote. Whilst this was a neat idea, it makes it difficult to use these extra keys. I can't assign separate functions to these keys as they just appear to the USB keyboard microcontroller as if you had pressed Symbol Shift and P, so it doesn't know whether to send Ctrl and P, or Shift and 2 (double quote on a UK keyboard). What I normally do with these keyboards is to capture the symbol shift and caps shift keys and process them internally to generate appropriate keys. Unfortunately, this means the keys aren't right for emulators, and there is no way to get to the F1 menus in Fuse or whatever.
Later on, they moved away from the original board, when they added 128K RAM on the Spectrum + 128K (the heatsink on the side leading to this being called the 'toast rack' model) and an integrated tape deck on the original grey Spectrum +2's. However, the same 5x8 matrix and 'double press keys' were also used, probably for backward compatibility.
Not too concerned with backward compatibility, Amstrad did some nasty things to the Spectrum architecture, however, one thing they did do was give the black Spectrum +2's, but they do have a different keyboard matrix. This means for once, I am able to map those keys separately from the original 40 keys. So lets go with the Spectrum +2A, add one USB keyboard controller and that's that part sorted.
The question was what to do with the cassette recorder, and where to put the pi, and how to show the indicator lights from the pi. Putting these together, I came up with the idea of a windowed case. I initially looked at replacing the cassette cover with clear perspex and a recreation of the 'Datacorder' logo, and converting the cassette buttons into extra keyboard keys.
Whilst that sort of worked, the buttons were a bit wobblier that I would have liked, I need to revisit the technique I use if I do that again. The logo also obscured the bottom half of the pi, and the whole point was to show it off. The second attempt was to use the logo to cover the keys and icons, leaving the window clear, but retaining the look and feel of the original.
It's now the Spectrum Pi, and although it doesn't come out too well in the photo, the activity lights are clearly visible. The last challenge was the joystick element. I've been working on a USB joystick controller for a while, so this seemed a good place to use it.
This has two 9 way D connectors for Atari / Commodore joysticks and presents as two USB joysticks. Alternatively, it can be configured to act the like the Sinclair Interface 2 joystick controller which made the joysticks press keys 1 through 5 and 6 through 0 (Left = 1, Right = 2, Down = 3, Up = 4, Fire = 5). I've designed it so it could be configured in software to use Sinclair joysticks or other 9 way D joysticks that have odd wiring, but the Atari / Commodore sticks seem the most prolific.
So, put it all together with a couple of extension cables and USB hubs and a lot of hot melt glue and there you have the Spectrum Pi in all it's glory.
If you want one of these, or have ideas for something like this, let me know and I'll see what I can come up with.