Getting Epson receipt printer to print from Arduino

arduinoembeddedepsonserial-port

I'm trying to build a microprinter using an Arduino and an Epson TM-T88II receipt/POS printer. The printer uses the Epson Esc/POS system, but I can't get it to do anything at all from the Arduino. I'm doing things like:

#include <SoftwareSerial.h>

#define out_pin 3
#define in_pin 2
SoftwareSerial printer = SoftwareSerial(in_pin, out_pin);

void setup()
{
    pinMode(in_pin, INPUT);
    pinMode(out_pin, OUTPUT);
    printer.begin(9600);

    delay(1000);

    printer.print(0x1B, BYTE);
    printer.print('@'); // ESC(HEX 1B) @ is supposed to initialize the printer
    printer.print("hello world");
    printer.print(0xA, BYTE); // print buffer and line feed
}

I just can't get the printer to respond at all. The printer powers up and prints its self test just fine. It's a serial (RS-232) printer, and I'm connecting it to the Arduino through a MAX233 chip. I've checked and rechecked my connections through the chip, which I think are right based on a friend who has a similar setup working. I read somewhere that the TM-T88 printers need null-modem serial cables, so I bought an adapter, and that didn't seem to make any difference.

I'm new to electronics, so I'm completely stumped. I just want to get it to print something, so I can get to the fun part – the programming :). Any thoughts on things to test/try? I can give more detail on wiring or anything else, just didn't want this to get TOO long.

Best Answer

Are you using an RS-232 transceiver? The Arduino outputs 0 and 5 V for serial, while the printer uses -12 and 12 V for serial. You should use a MAX232 or similar device to get the correct physical interface. (You might be able to cheat if you invert the serial port on the Arduino, but that might not work, and it's more trouble when just getting started.)

Once that's taken care of, the RTS and DTR may be your problem. You should be able to change the DIP-switch settings on the printer and turn off flow control altogether, or switch it to software flow control.

Also, you may need to send both line feed and carriage return.

However, once all that's done it should print just fine, even without any reset commands. Send a bunch of ASCII characters and line feed/carriage returns, and it'll spit it all out.

You can ignore the RX line (on the Arduino side, TX on the printer side) for now - just send it data until you figure out the wiring, level conversion, flow control, etc.

Related Topic