Connections are explained on the prior page. For the Arduino example code, we’ll connect the printer’s data out (TX) wire to digital pin 5, and data in (RX) to digital pin 6. Ground can go to any Arduino GND pin. Pins are configurable, but this is what the example uses, so let’s stick with that for now.

On the Arduino side, pin 5 receives (RX) and 6 transmits (TX)…opposite of the printer’s pin functions…called a crossover configuration, something you’ll hear a lot in serial communication and networking.

Install Library

We made an Arduino library to assist working with these printers.

Go to the Arduino Library Manager under Sketch→Include…Library→Manage…Libraries…

Search for and install the Adafruit Thermal Printer library:

We also have a great tutorial on Arduino library installation at:

You should now be able to access the sample code by navigating through menus in this order: File→Sketchbook→Libraries→Adafruit_Thermal→A_printertest

If your printer test page shows 'BAUDRATE: 9600', you'll need to make a small change to the library source code. Using a text editor (Notepad, etc.) open the file Adafruit_Thermal.cpp and change this line:

#define BAUDRATE  19200
to this:
#define BAUDRATE  9600

Some printers arrive from the factory set for 19200 baud, but a few may be set to 9600. This will not negatively impact the performance of your unit! The speed of the paper through the printer is already much less than this and you will not see any difference…it's strictly a data protocol issue of getting the microcontroller and printer communicating.

OK upload the sketch (with baudrate change if necessary) to the Arduino. You should see the printer print out the example receipt which includes all the capabilities of the library.

If this does not work, first check that the printer and Arduino are both powered, and that the data in, out and ground wires are properly connected to the Arduino.

This guide was first published on Sep 02, 2012. It was last updated on Sep 02, 2012.

This page (Arduino Code) was last updated on Aug 30, 2012.

Text editor powered by tinymce.