So, you know those little receipt printers you see at coffee shops? Turns out, you can totally hijack that tech for your own ESP32 projects. No ink, no cartridges, just a roll of thermal paper and a print head that burns your text (literally with heat) onto it. Cheap, fast, and surprisingly fun to play with.

I grabbed a PNP-500 thermal printer module and hooked it up with an ESP32 to see how far I could push it. Spoiler: you can spit out receipts, QR codes, barcodes, or even goofy bitmap graphics straight from your microcontroller.

Why Thermal Printers Are Cool

Downsides? Sure:

But for receipts, logs, or quirky IoT projects, they’re perfect.

Direct vs Thermal Transfer

There are two flavors:

For hobby stuff? Direct thermal is more than enough.

Meet the PNP-500 Printer

This little panel-mount printer is basically plug-and-play. It’s compact, reliable, and built to live inside control panels or diagnostic gear. Perfect size for projects.

Specs in a nutshell:

Yep, kilometers. That’s a lot of bad dad jokes you can print.

Inside the Printer (Teardown Time)

Couldn’t resist...I popped mine open. Here’s the anatomy:

  1. Main control PCB - This single board handles everything. You get pins for RS232 and TTL, plus a power input. I powered mine with a 2S Li-ion pack because 5V made the prints too light. There’s also: Status LED (blinks in patterns when things go wrong, like “no paper” or “overheating”).
    A handy test-print button that spits out a demo page showing fonts, settings, and even a QR code. On the back: NOR flash, motor driver IC, RS232 transceiver, and a 32-bit ARM MCU doing all the heavy lifting.
  2. Print head - The real hero. It’s a strip with 384 heating dots in a row. Heat them in the right pattern, and text magically appears. Also has a thermistor to prevent overheating and sensors for paper detection.
  3. Spring suspension - Two springs push the print head against the paper, making sure the dots burn evenly.
  4. Paper feed mechanism - A bunch of gears and a stepper motor precisely pull the paper through. The ratios are tuned so every line prints cleanly.
  5. IR-based paper sensor - Uses an IR LED + photodiode to check if there’s paper. Simple but effective.
  6. Paper storage - Holds up to a 40mm roll (around 16–20 meters). That’s plenty for a test project.

Word of warning: if you take yours apart, be gentle with the ribbon cable. It’s flexible but fragile.

Programming the Printer

Good news: you don’t need to reinvent the wheel here. The printer already understands a bunch of standard ESC/POS commands (same family used in receipt printers everywhere). Just send the right bytes over serial.

A few handy ones:

You can also tweak print density and heat for darker prints, or even blast out bitmap images if you’re feeling fancy.

And yep, it can print barcodes too. Just set height, width, and position, then feed the data.

Wiring with ESP32

Couldn’t be simpler:

I used around 7.4V from my Li-ion pack and it printed crisp and dark.

Code Example

Here’s a minimal snippet to test print (drop in your Arduino IDE with ESP32 selected):

#include <HardwareSerial.h>


HardwareSerial mySerial(1);


void setup() {
mySerial.begin(9600, SERIAL_8N1, 16, 17); // RX=16, TX=17
delay(1000);


mySerial.println("Hello from ESP32!");


// Center align
mySerial.write(0x1B); mySerial.write(0x61); mySerial.write(0x01);
mySerial.println("Centered Text");


// Feed 3 lines
mySerial.write(0x1B); mySerial.write(0x64); mySerial.write(0x03);
}


void loop() {}

Change pins if needed. And remember, the printer is happiest with its own power supply.

The complete code is available here: Code for Thermal Printer ESP32

Final Thoughts

Thermal printers like the PNP-500 are surprisingly hacker-friendly. With just a couple of wires and some serial commands, you can:

It’s one of those modules that feels intimidating at first, but once you realize it’s basically just a fancy serial device, the ideas start flowing.

If you’ve got an ESP32 (or Arduino, or even Raspberry Pi), grab a cheap thermal printer and give it a spin. It’s a lot more fun than printing boring receipts.

A more in-depth version of this is available here: ESP32 Thermal Printer