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.

Monday, 17 February 2014

Texas Instruments TI99/4A USB Keyboard

This came in as a request from a previous buyer of my Commodore 64 USB Keyboard, could I make a TI99/4A USB keyboard? I don't see why not. This first step was to locate one, I didn't have a TI99/4A in my ever expanding collection of vintage computers, so I looked around and managed to get hold of one which was 'untested'.
So here it is, the first commercially available 16-bit home computer, powered by the impressing looking 64 pin TMS9900NL chip.
And true to form, untested means broken. In this case, it looks like a memory fault, not in the massive 256 bytes of 16 bit RAM, but in 16K of 8 bit DRAM hung off the video controller that was actually also the main system RAM.
These are 4116 chips a common source of failures these days. Oddly, these are NEC brand chips. TI had its own massive memory production arm. Many a Spectrum is full of TMS4116 chips, no wonder TI were making a loss on these things if they bought their competitors DRAM chips!
This spectrum not only has 8 TMS brand 4116's, but a further 8 TMS 4532's. That's more TI chips than TI's own computer.
The memory fault in this case is good because I can put that aside to fix later. What I need here is the keyboard and case to become the USB keyboard.
The keyboard PCB is separate from the main board and connected via a short ribbon cable, so once the main board is carefully removed, the ribbon can be reconnected to the USB keyboard controller PCB.
Here I'm using the latest version of my USB keyboard PCB, all surface mount this time (don't look too closely at the soldering!).
A fairly easy keyboard to map, most of the major keys you would want are there, apart from delete. There is a handy 'function' key bottom right, which I have used to select the functions on the front of the keys, and other missing keys such as F1-F10 and delete across the top row.
So another keyboard type added to the repository, you can buy a complete converted TI-99/4A from my Etsy store.

Update: I've updated the USB keyboard controller now, and this is available as a kit f you have a dead TI-99/4A with a good keyboard. The kit has with all the bits you would need, the USB controller, power LED, USB cable and mounting pillars.

TI-99/4A USB keyboard kit
If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.

Sunday, 9 February 2014

Setting the time

I've had a query about how I have been setting the time on the LED clocks I've made. Well, it depends. When I replaced the LED driver board on my old Cascade LED clock radio, I didn't bother with any buttons etc., so the only way to set the time is to reprogram it.
So every 6 months, I plug it into the PC via an FTDI cable (as shown here) or an Arduino USB Serial Light (as in the original article). I then upload the code with the following line uncommented.

  RTC.begin();
  //RTC.adjust(DateTime(__DATE__, __TIME__));

This sets the time to the system time and date at the point of programming. I then comment the line out again and immediately reprogram it, or it would reset to that that time each time power was applied.
That's fine for me, but for the ones other people have to use, I tend to add buttons to set the time, such as on this LCD clock. Note in this case, I use the USB cable for power, there is no data connection.
So I suppose it's down to how complicated you want to make it. I'm happy to reprogram a few clocks twice a year to cope with daylight saving. But obviously the average user would prefer buttons to change the time. You could use serial (directly or via USB) to set a time from a PC, but that's probably more work that reprogramming it. You could even use an Arduino Ethernet and get the time over the internet via NTP, or connect to a rugby radio module if you wanted to.