Monday 26 January 2015

Arduino boxed


The TV is a Procaster DTV007 with a Video In.

Here are the first results from my previous keyboard rewiring. I've been dying to create some kind of "fake computer" in the 8-bit style, and this is one step towards this goal. I put the keyboard inside a Tactix brand plastic box with adjustable compartments, and connected it to an Arduino.

I don't like the appearance of this plastic all that much, but at least it is quite robust and re-openable.  Cutting the keyboard hole was a bit of a chore, so I cheated and melted rough lines using a soldering iron and then smoothed the edges with a carpet knife.

The Arduino, connected to the keyboard, runs the TVout library. The TVout generates a small resolution video signal, not much better than some LCDs, but in some ways more handy as it only uses 3 pins.

A bit closer up.
The keyboard with a 5x8 matrix uses most of the pins, 5 analog pins are used as digital pins for one matrix direction, whereas pins 2,3,4,5,6,8 & 12 are used for the other direction. (The TVout needs pins 7,9 and 11 for audio. TVout is quite particular about these).

I did not use the available keyboard library because it often seems to mess with whatever else I happen to be doing. So I simply read the 8 input lines each time Arduino sets one of the 5 lines as an INPUT, keeping the others as OUTPUT. The whole setup is largely copied from a ZX Spectrum, as seen from the rough layout below:


The setup does not do anything much as yet, it's bit like a simple typewriter. Let's say a kind of non-mobile Hemingwrite with a ridiculously low memory. The typing feel is pretty good, as the keyboard is of high standard and Arduino does not seem to miss any key presses. I did not make a key repeat, though.

It's not perfect: If I press several keys horizontal and across along the matrix, additional keys covered by the area might be registered. This can fumble rapid operations with SHIFT+key and some other key, depending on their matrix location. I may make a separate switch altogether for the SHIFT.

I'm now thinking of putting a second Arduino inside the box, if the two can be made to communicate. One Arduino could mostly concentrate on handling the keyboard whereas the other would be keeping up the video and some more interesting communications. We'll see...

The Arduino, doing what Arduinos usually do.

Wednesday 14 January 2015

Rewiring a keyboard matrix

New year, new old projects. I'll go back to one of my past favorites, a keyboard. I'm rewiring an Apple keyboard into a different electrical matrix, removing all the ICs and stuff. There are some plans for this keyboard but let's focus on rewiring first.

I've lost the picture of the intact keyboard.
This Apple Extended keyboard is a good starting point because it has a switch for each individual key. If nothing else, tearing out all the keys leaves you with a valuable stash of switches.

I was thinking of keeping the arrow keys, but no, too big, too heavy.
After hacking the full keyboard to pieces (with a hacksaw), I'm left with a more limited "8-bit" keyboard. I left out the keypad, arrow keys and function keys, and still I'm left with a fairly heavy lump of keys.

It's possible to tear out individual keys, too.
Then, I cut the electrical connections on the circuit board with a Dremel wheel. I have previously done this with a carpet knife, which produces less dust and noise. But the Dremel saves time. 

Lisää kuvateksti
The above shows it's easy to re-solder the switches, but it is very time consuming. Here I have to hope there are no connections on the other side of the board, but from what I can see it is very unlikely.

I re-wired the switches according to a ZX Spectrum keyboard matrix, using tiny pieces of wires. I'm not going to connect this keyboard to a Spectrum (unless for testing), but it's nice to have some "standard" to work on. 

Halfway there...
Of course, the 5x8 matrix is not sufficient for connecting all the keys, it will have to wait.

I got tired soldering the matrix with small bits of wire, and with the other direction I tried an alternative approach (i.e. an even more horrible kludge). The red wires are longer, and only parts of the wire are exposed where needed. I did this by brutally melting through the plastic coating on the wire, so it's not certain the connections are very good.

Almost there... note that some keys like Space and Enter are further away than they would be on the Speccy.

And there I have it, an old Apple keyboard re-wired into a ZX Spectrum keyboard matrix, although without any lines leading out... yet. So there's still a significant amount of work to do.