How to connect a thermal printer to Arduino?

Connect and print data from arduino to thermal printer. Sketch code and wiring diagram.

How to connect a thermal printer to Arduino?
How to connect a thermal printer to Arduino

There are many different projects in which it is necessary to display the data received from various sensors on the display, in the smartphone application, or, as in our case, the data needs to be printed using a Thermal Printer.


In the example, the model printer is used: Thermal Printer with Interface RS232

Simple connection. To work with the code in the development environment, you need two libraries.

  1. Adafruit_Thermal.h
  2. SoftwareSerial.h


#include "Adafruit_Thermal.h"
#include "SoftwareSerial.h"

#define TX_PIN 2 //6 // Arduino transmit  YELLOW WIRE  labeled RX on printer
#define RX_PIN 3 //5 // Arduino receive   GREEN WIRE   labeled TX on printer

SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial);     // Pass addr to printer constructor

void setup() {
  // NOTE: SOME PRINTERS NEED 9600 BAUD instead of 19200, check test page.
  mySerial.begin(9600);  // Initialize SoftwareSerial
  printer.begin();        // Init printer (same regardless of serial type)

void loop() {

void print_report() {
  printer.println(F("ROORKEE, INDIA"));
  printer.println(F("Contact For :"));
  printer.println(F("-STEM Education"));
  printer.println(F("-IoT Solution"));
  printer.println(F("-Automation Solution"));
  printer.println(F("STEM Modules :"));
  printer.println(F("-Robotics & Coding"));
  printer.println(F("-Machine Learning"));
  printer.println(F("-Mobile App Development"));
  printer.println(F("-Game Development"));
  printer.println(F("-3D Technology"));
  printer.println(F("-One Day Workshop"));
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults


on the site are taken from open sources. The site does not contain files for download. All links to files from open sources. Owners of copyrights to the material may request removal of the post from the site.

Buy me a coffee