Saturday, 25 July 2015

Commodore 64 Shared USB keyboard

I've been making Commodore 64 USB keyboards for quite a while now, they have been very popular. The Commodore's of this era came with very nice mechanical keyboards, which are still very nice to use, although they often need a thorough refurbishment to get the best out of them.
You can still use the keyboard almost as a Commodore 64 by running a Commodore 64 emulator on a PC or Raspberry Pi. With the mode switch, the keyboard can be used as if it were a Commodore 64.
I've had requests for various combinations (can you add a Raspberry Pi, can you add a PC etc.). I've also been thinking about another idea for a while, could the Commodore 64 bit be kept intact, but still used as a USB keyboard? Then I got a request asking for just that, so I had to do it.
This is the new Commodore 64 Shared USB keyboard. OK, I'm still looking for a better name. The right hand side of the board is the same as my standard Commodore 64 USB keyboard controller, with the keyboard connector in the middle.
The left hand side is new, you can see if more clearly on the picture above, before I changed the keyboard headers for right angle ones to fit in the case. At the edge is 20 pin header that plugs onto the original keyboard header. In between are some bidirectional buffers. The circuitry on the right there generates a 5V supply if either the USB or the C64 is plugged in. This is used to drive the switching circuits, and can also power the case LED, although I prefer to leave that so it is only on when the C64 is on. When there is no power from the C64 side, the switches are disabled, isolating the C64 from the keyboard, and the USB keyboard microcontroller takes control and scans the keyboard and talks to the PC.
When power is detected from the C64, the USB microcontroller is held in reset mode, so it does nothing. All it's pins become inputs, and so are not driving the keyboard. At the same time, the switchhes are enabled, connecting the C64 to the keyboard and allowing it to take control of scanning the keyboard and work as normal without interference from the USB keyboard microcontroller.
The idea is to take a working Commodore 64, and open it up. Unplug the keyboard connector and plug in this new board. Then plug the keyboard into the new board. Finally, take a USB lead and feed it through a gap in the case, the datasette port seems to best option. Plug the other end of the USB lead into a PC. The PC will recognise a new USB device as usual and the Commodore 64 will function as a USB keyboard, just like any of my other USB keyboards.
Where this differs is that if you power up the Commodore 64, you will hear the 'disconnect' sound from the PC as the USB keyboard appears to be disconnected. The Commodore 64 will have started up and the keyboard can now be used with the Commodore 64 as normal. No keys will be sent to the PC, as the PC thinks the USB keyboard has been disconnected. When the C64 is turned off, the PC will make the sound as if the keyboard had just been plugged in and the keyboard will start to function as a USB keyboard again.
So this is the best of both worlds, have you cake and eat it solution. If you want to use the C64 for real, just switch in on and away you go. When you're not using it, you can use it as a USB keyboard on your PC. You could also load up a Commodore 64 emulator such as Vice on the PC if you wanted.
I'll be selling these as just the board, ready to install in your own C64, or I can repair or refurbish your C64 and fit one of these and return it. Or, the final option, I have a limited number of refurbished Commodore 64's already fitted with these boards, which work as Commodore 64's and as USB keyboards. It will also work on the VIC20, if you prefer, as the keyboard is identical. It could also be used with a C64C, but would need an extension cable as there is insufficient height where the keyboard connector is placed.

Update:
These are available now, see the latest blog post.