Category Archives: Retrochallenge 2016/2

Retrochallenge 2016/2 – Interak keyboard wrap-up

160915-img_20160915_204655In my last two posts I wrote about how I made an adapter for my 1980’s Interak-1 computer so that it could make use of USB keyboards as the original Alphameric keyboard had failed.

Those posts were a bit rushed and the adapter was still a work in progress. It’s finished now and so in this post I’ll try to tell the full story and in more detail so if anyone else has the need for a USB keyboard to 7-bit parallel ASCII keyboard they will have something to follow.

The problem.

The Interak comes from an era before USB became ubiquitous, when a parallel cable running from a semi-intelligent keyboard to the main CPU was commonplace.

161005-img_20161005_192546With these keyboards, when a key is pressed, the binary representation of the key, in ASCII, is presented on seven data lines. An eighth bit called Strobe is then pulsed high (5V) and then low (0V) to indicate to the CPU that a character is ready.

Sadly, the keyboard that came with my Interak had developed a fault and several columns of keys didn’t work at all. I tested the socketed chips with my IC tester but they seemed OK and so I suspected the micro-controller and I didn’t want to go too far down that road and so I decided to do away with theΒ  original keyboard.

What to do now?

I looked around for a while and found a number of solutions that will use PC keyboards with the PC-mini-DIN connector but they haven’t been mainstream for over ten years and I didn’t want to end up with the same problem later.

USB is the way to go.

When USB is the solution… Crikey.

161001-img_20161001_181323In all honesty, I don’t know a great deal about USB and the though of writing a USB host to interface with a keyboard seems like no kind of fun (Retrochallenge is meant to be fun) and so I looked around for solutions and found HobbyTronics who produce a small USB host board that just needs 5v and will produce a serial output.

Although a serial stream isn’t what’s needed, it is easy to pipe it into an Arduino and get that to output the ASCII in parallel on its IO pins.

161001-img_20161001_205049I made a prototype using an Arduino UNO connected to the Hobbytronics board.

To make debugging easier I used a software serial library to keep the hardware serial port free. More on that later.

The real thing.

The Arduino UNO worked very well. Well enough to convince me to use a small Arduino Pro Mini and make the thing real.

The Interak uses a 15 way D type on the front for the keyboard connector and so I soldered the Pro Mini as close as I could to the connector and the the three wires to the USB board.

161003-img_20161003_210244Next, get it into a small case… 161005-img_20161005_200524

Proof if proof were needed.

161005-img_20161005_200700So there you go. My beloved Interak has a new lease of life.

One more thing…

There is a nice little addition waiting in the wings here. The Arduino has another serial port, the hardware one and so It would be quite easy to add the standard USB to serial board and then the Interak’s keyboard port would appear to my PC as a serial port and I could squirt data into from a terminal emulator. There would be no handshaking and so I’d have to artificially drop the data rate with delays but it would work.

The code.

/*
* Interak-1 USB keyboard adapter
*
* By Andy Collins.
*
* This code is free to use.
*/
#include <SoftwareSerial.h>

#define CR 0x0d
#define LF 0x0a

SoftwareSerial mySerial(11, 12); // RX, TX

const int STROBE = 9;
const int D6 = 8;

int inByte = 0; // incoming serial byte
int lastInByte = 0;

void setup()
{
// Open the hardware serial port for debugging
Serial.begin(9600);

// Start the SoftwareSerial port
mySerial.begin(9600);
DDRD = DDRD | B11111100; // Using d2-d7 as output. Saving d0-1 just in case.

pinMode(STROBE, OUTPUT);
pinMode(D6, OUTPUT);

digitalWrite(STROBE, LOW);
}

void loop() // run over and over
{
inByte = -1; // Nothing yet

if (mySerial.available()) // USB Keyboard
{
inByte = mySerial.read();
}
else if (Serial.available()) // USB Serial port
{
inByte = Serial.read();
}

if(inByte != -1)
{
Serial.write(inByte);

if( (inByte == LF) && (lastInByte == CR) )
{
;
}
else
{
PORTD = inByte << 2; // Shift left to avoid TX, RX;

// Catch the overflow.
digitalWrite(D6, inByte & 0x40);

// Bits set up. Now Strobe;
digitalWrite(STROBE, HIGH);
delay(30);
digitalWrite(STROBE, LOW);
delay(100);
}

lastInByte = inByte;
}
}

 

 

Retrochallenge 2016/2 – Interak keyboard

So RC is upon us and I have decided to replace the failed keyboard on my newly acquired Interak-1 with a modern USB item.

The Interak keyboard uses a 7 bit parallel interface to present an ASCII character to machine itself with a strobe line to say that the data is ready. It’s a bit much to ask the Interak to cope with USB directly and it’s a bit much for me to learn enough about USB to be able to program a Z80 to cope in the time allowed and I don’t want to.

161001-img_20161001_181323Enter HobbyTronics who produce a small USB host board that just needs 5v and a USB keyboard and will produce a serial output.

The serial output can’t go straight in to the Interak either but serial to parallel isn’t too bad.

Enter Arduino.

161001-img_20161001_205049So, here we have an Arduino UNO with a prototype shield and a tiny USB keyboard. At the moment it’s just reading the serial input from the keyboard adapter and squirting it down the serial port to the PC but it’s a start.161001-img_20161001_205115 Next is to set up some pins for the parallel interface.

Keep watching (if you want).

Retrochallenge 2016/2 – Throwing my hat into the ring.

It’s Retrochallenge time again and how quickly it comes around and how ill-prepared I am.

Recent competitions have seen great entries by talented retro-folks the world over whereas my contributions have been less glorious but filled with enthusiastic zeal.

This time around will be no different πŸ™‚

I’m not sure what I will do to be honest. I may take a broken retro system down from the “shelf of good intentions” and try to fix it. I may try and interface a ZX printer to something non-Sinclair or perhaps get the Tandy 4 colo(u)r plotter talking to my PDP-11. Who can say?

Whatever happens there will be joy and frustration but mostly joy.

In the words of poppy-funster “Jem”

It’s just a ride, it’s just a ride
No need to run, no need to hide

Though there may be a need to solder…

See you on the other side.