Trying to talk to a serial thermal printer

Hi all,

I’ve got an old thermal printer (from another project) that I want to be able to use with Gadgeteer.

I found this project on gadgeteering.net: gadgeteering.net. But the printer I’ve got must be a bit different to that because using that code won’t work.

Anyway, here are some images of the printer and a link to the two datasheets I’ve managed to find for it online. The on page 33 of the one called 362-dome-plusii you can see some information about the serial connection. On page 26 and 27 there is information on the baud rates etc.

Hardware-wise, I’ve soldered it up to an extender module and am trying to open it as a serial port. I’ve wired the RX and TX opposite to each other (as the gadgeteering.net guy does) and the gnd to gnd and have external power.

On the software side, I am using the following code:

GTI.Serial serial = new GTI.Serial(GT.Socket.GetSocket(9, true, null, ""), 9600, GTI.Serial.SerialParity.None, GTI.Serial.SerialStopBits.Two, 8, GTI.Serial.HardwareFlowControl.NotRequired, null);
            serial.Open();

            serial.Write("dsfsd asdf sdf");

            serial.Flush();

But this doesn’t seem to be working. I’ve changed the printers settings so that it is on 9600 but I’ve tried all other baud rates to no avail. If I send the above string, it does print but it always prints a series of crazy characters and changes everytime.

To me this seems like an incorrect baud rate but it is definitely correct. The only thing I can think of is that I don’t have the DTR (Data Terminal Ready) wire attached to anything because I don’t know what to do with it and also I’ve got no handshaking on. In the printers settings it can be XON/XOFF or “Hardware” which I thought might be the K socket stuff but couldn’t seem to get this working either.

Does anyone have any idea what I’m doing wrong? Or anything else I can try? Is it a handshaking problem?

Thanks in advance,

Poncho

Sorry, I realised I didn’t put the links in doh:

1 page datasheet: Dropbox - Error
Big long datasheet: Dropbox - Error

Here are the images:



Thanks

Sorry I don’t really know what you mean, the link is someone else using a different thermal printer.

I just linked it to give some background/associated info around gadgeteer and thermal printers.

But he does just pretty much set up a serial port and then use Write() to send lines to the printer to print. (With lots of other cool stuff like changing font etc.)

A couple of possibilities:

  1. Are you connected to the TTL interface and not the RS-232?
  2. With older devices, sometimes the levels for 0 and 1 are reversed at the TTL interface. This would result in printing garbage. https://www.sparkfun.com/tutorials/215.
  3. You are getting your 5V for the printer from the mainboard, through the gadgeteer connector. The typical current requirements of this type of printer would exceed that provided by a USB port and the common power modules.

@ andre.m - I have looked all through that datasheet looking for what commands I need to send it to set it up etc but can’t find anything and I couldn’t get the code in that link to work with my printer.

@ Mike - I’m pretty sure I’m on the RS232, how would I know? On my third image you can see the labelling for the pins as GND, RX, TX and DTR which I have wired to an extender board for the serial port, reversing TX and RX as it is output (except for DTR because I wasn’t sure what to do with it?).

I tried looking at that link but it says page not found - do you have another link?

I am getting the power from an external power supply which is plugged into the mains, I did originally try and get it through the mainboard but as you say it isn’t powerful enough.

In terms of setup, the printer has its own setup interface - if you hold down the “paper feed” button on it it prints out its current settings and they are as follows:

[quote]Baud Rate: 9600
Data Length: 8 bits/chr
Parity: None
Handshaking: XON/XOFF
Autofeed: CR enabled
Columns: 24 cols.
Print Mode: Normal
Char Mode: Normal
Print Dens: 0[/quote]

I have tried to replicate these in my Gadgeteer code as previously mentioned but don’t know what to do about the handshaking. The printer only gives me the option of XON/XOFF or RTS/CTS and so I don’t really know what to do with this on the Gadgeteer side.

Thanks for the replies, any ideas?

Poncho