2 min read

works: Radio Shack TP-10

There's nothing for a hot summer day but relaxing with a thermal printer. I haven't yet gotten my Canon TypeStar thermal typewriter to function as a printer, so I turned to a Radio Shack TP-10 from 1984. Speaking of "1984", I bet the novel-writing machines down in minitruth would have been quieter and more reliable with a dash of thermal technology.

The TP-10 turns a stream of 600 baud serial data (8 bits, no parity, two stop bits) into a silent procession of dot matrix characters across a 4 inch wide strip of thermal paper. The printer has one status line that indicates that it can receive data. There is little or no buffer to speak of in the printer, so status is important while the head returns at the end of its travel.

The author's TP-10 printing merrily after writing a quick Arduino sketch.Save

Three things worth noting. First, the printer merrily accepts 5v data from my Arduino. Second, the Arduino does not instantly melt with the +12/-12 status signal from the printer. Will it eventually? Don't care.

Third, and more complicated, the Arduino serial library for the Arduino Micro doesn't seem to support 600 baud. The Software Serial library doesn't support 2 stop bits. You could go down a whole rabbit hole here or recall that rs-232 is just not that complicated. Set pin, wait, repeat. This is what microcontrollers are for.

Here's a quick sketch that turns an Arduino Micro into a USB->serial adapter for this printer. I ordered the DIN 4 plug from Amazon.

// driver for radio shack tp-10

int bitdelay = 1700;

void writechar(unsigned char tx, unsigned char cts, unsigned char c) {
    unsigned char array[8];
    array[0] = ((c >> 0) & 0x01)?0:1;
    array[1] = ((c >> 1) & 0x01)?0:1;
    array[2] = ((c >> 2) & 0x01)?0:1;
    array[3] = ((c >> 3) & 0x01)?0:1;
    array[4] = ((c >> 4) & 0x01)?0:1;
    array[5] = ((c >> 5) & 0x01)?0:1;
    array[6] = ((c >> 6) & 0x01)?0:1;
    array[7] = ((c >> 7) & 0x01)?0:1;

    while(!digitalRead(cts));

    digitalWrite(tx, HIGH); delayMicroseconds(bitdelay); // start

    digitalWrite(tx, array[0]); delayMicroseconds(bitdelay); 
    digitalWrite(tx, array[1]); delayMicroseconds(bitdelay); 
    digitalWrite(tx, array[2]); delayMicroseconds(bitdelay);
    digitalWrite(tx, array[3]); delayMicroseconds(bitdelay);
    digitalWrite(tx, array[4]); delayMicroseconds(bitdelay);
    digitalWrite(tx, array[5]); delayMicroseconds(bitdelay);
    digitalWrite(tx, array[6]); delayMicroseconds(bitdelay);
    digitalWrite(tx, array[7]); delayMicroseconds(bitdelay);

    digitalWrite(tx, LOW); delayMicroseconds(bitdelay); // stop
    digitalWrite(tx, LOW); delayMicroseconds(bitdelay); // stop
}

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial);

  // tx
  pinMode(1, OUTPUT);
  digitalWrite(1, LOW); // idle

  // cts 
  pinMode(6, INPUT);
}

void loop() { // run over and over
  char c;
  while(!Serial.available());
  c = Serial.read();
  writechar(1, 6, c);
}
  

Could this be simpler and shorter? Yes. Did I lose all interest in that once it worked? Also yes. It's a hot summer day after all and I have printing to do.

The TP-10 uses a 5 x 7 character matrix and does not appear to support bitmap graphics, however it does have a blocky graphic character set that ... actually I can't think of a good reason to use those chunky forms, except printing QR codes from a TRS-80. I would bet an Arduino that the printer's i8049 firmware has a couple of additional escape codes for barcode printing but that's a topic for another day.