Datasheet Thermal Printer
Datasheet Thermal Printer
Datasheet Thermal Printer
https://learn.adafruit.com/mini-thermal-receipt-printer
Overview 5
• Models
Power 7
• Making the Power Connection
First Test 11
• Print Test Page
Making Connections 14
• TTL Serial
• For Product #597: “Mini”
• For Product #2751: “Tiny”
• For Product #2752: “Nano”
• For Product #2753: “Guts”
• To Arduino
• To Raspberry Pi
• To USB-to-Serial Cable (FTDI, etc.)
• “Tiny” Printer: USB to Linux (Raspberry Pi, etc.)
Arduino Code 23
• Install Library
Printing Text 26
Bitmap Printing 27
• Windows
• Mac and Linux
Barcode Printing 31
Python Docs 42
Downloads 42
• Firmware Changer
Troubleshooting! 43
Add printing to any microcontroller project with these very cute thermal printers. Also
known as receipt printers, they’re what you see at the ATM or grocery store. Now you
can embed a little printer of your own into a project. These printers is ideal for
interfacing with a microcontroller, you simply need a 3.3V to 5V TTL serial output from
your microcontroller to print text, barcodes, bitmap graphics, even a QR code!
These printers use very common 2.25" (58mm) wide thermal paper, available in the
Adafruit shop or most office or stationery supply stores. You will also need a 5 Volt to
9 Volt regulated DC power supply that can provide 2 Amps or more during high-
current printing — our 5V 2A power supply will work very nicely (http://adafru.it/276).
You can pick up a thermal printer pack including printer, paper, power supply and
terminal-block adapter in the Adafruit shop! (http://adafru.it/600)
Of course, we wouldn't leave you with a datasheet and a “good luck!” — this tutorial
and matching Arduino library demonstrate the following:
Models
Our Mini Thermal Receipt Printer () is a
popular choice as it accommodates a full-
length thermal roll (15m/50') (), meaning
fewer paper changes. It’s also available in
a starter pack () that includes a 5V power
supply and DC jack adapter.
The thermal paper rolls in the Adafruit shop are BPA-free and ready sized to each of
the above units. You can also find compatible 2.25" (58mm) wide thermal paper at
many office supply stores, though usually in 80–85 foot (25m) lengths that won’t fit
as-is in any of these printers. With some patience you can re-roll these onto an empty
spool, cutting when the roll reaches a suitable diameter.
None of these small thermal printers have a cut feature; pull the finished print against
the perforated edge. The Thermal Printer Guts has no perforated edge; you’ll need to
design this into your enclosure.
We offer documentation and guides for using these printers with ARDUINO,
CIRCUITPYTHON and RASPBERRY PI. No support is provided for “native” OS
printing in Windows, Android or macOS. Most can be used to some degree via
the Blinka library for Python, with a USB-to-serial/FTDI cable or with the USB-
equipped Tiny unit, but nothing beyond that scope is presented.
Power
These printers use a thermal head to heat the special receipt paper and draw images
and text. That makes them very small — there's no moving ink head — but it means
they require a lot of power: 5 to 9 Volts DC, at least 2 Amps of current. That means
you will need a fairly beefy supply and you cannot run it off of USB power. An external
adapter is required!
A quick way to connect this to the printer’s red/black power wires is with a 2.1mm jack
adapter (http://adafru.it/368):
The 5V 2A supply mentioned above is a baseline. If using this, you might want to
power the microcontroller separately through its USB port, to prevent a brownout
condition when the printer is drawing a lot of current. Higher current supplies — 4
Amp () and 10 Amp ()* — are also available in the shop, bulkier but with ample
overhead for both the printer and supporting hardware you might be adding.
The higher current can make for darker printing and quicker, more assertive paper
feed. Slightly higher voltage can too — to a point. One should never exceed 9 Volts to
A benefit to 5V power is that many dev boards can run from this directly and will
regulate to 3.3V if needed; only a single power source is needed. That’s not
necessarily true with higher voltages…though some, like the Arduino Uno, can accept
9V through the board’s DC power jack.
* The printer will never draw anywhere near this much current, but larger supplies are
less susceptible to voltage droop when there’s a sudden demand. Sometimes just a
matter of what’s presently in stock without waiting, or what other projects you might
want to use this with in the future (e.g. large NeoPixel projects could benefit from the
extra capacity of a 4A or 10A 5V supply).
First Test
The first test you should do will ensure that paper is loaded and power is wired up
correctly and the printer is running.
First up, pull the little plastic tab up top to open up the paper holder. Then insert a roll
of 58 millimeter (2 1/4 inch) thermal paper into the bay as shown in the image below.
To reiterate from the first page, the printer models and corresponding roll sizes are:
Make sure that the paper doesn't bind or stick in the bay, it should rotate freely.
Most of these thermal printers have a test feature providing basic diagnostics. You’ll
then know that power is good, paper is correctly loaded, and have some
configuration details of the particular unit.
On most Mini and Tiny printers: hold down the button on the top of the printer while
connecting power to print a test page. In normal use, tapping this button feeds the
paper by one line.
Not all “printer guts” units have a button installed. If needed, you can make a
temporary connection across the “J1” pads using a jumper wire or metal tweezers.
Occasional factory production changes occur…if you don’t get a test page using the
method above for you model, try the opposite method. A few may even lack a test
page feature, but the status LED provides an indication of good power.
The status LED may blink when the printer is powered. It will not necessarily be
on steady! This varies from model to model.
If you don't get a printout, check that the paper is inserted correctly and not binding,
that the power is correctly wired, power supply is plugged in, etc. Then try again.
Note the baud rate on the test page. This may be 19200 or 9600. We'll need this
number later:
Making Connections
These printers might see use with microcontrollers or with Linux-based computers
such as Raspberry Pi. The Tiny printer has the distinct option of connecting to a
Raspberry Pi’s USB port, covered later on this page. But to start, let’s talk about TTL
serial—the non-USB connection present across all of these printers.
TTL Serial
Most microcontrollers can provide a 3.3V or 5V TTL serial connection. It’s not same as
the 10V RS232 serial from a computer’s 9-pin serial port — don’t connect the printer
directly to a standard PC port or you may damage it. A USB-to-serial cable (such as
those made by FTDI, or similar) is an option on Linux PCs, but most will be using it
with a microcontroller.
It makes no difference if the controller is a 5 Volt or 3.3 Volt device. The printer logic
is 3.3V, but “5V tolerant,” meaning no extra level-shifting circuitry is needed in either
direction. Some older documentation may still show a voltage divider (two resistors
and some extra wires), but that’s since been found unnecessary. The printer and 5V o
r 3.3V devices can connect directly.
To start, we’ll connect to the data cable of the printer. Easiest is to simply press
breadboard jumper wires into the data plug, then use those to extend the connection
to the host: an Arduino or other microcontroller, Raspberry Pi, or USB-to-serial cable.
If the controller is a Raspberry Pi: use female/male jumper wires to the Pi’s GPIO
header.
The wire color for each pin is not the same across all these printers. Please read the
descriptions carefully. It’s nice (but not mandatory) to match jumper wire colors to the
printer’s data cable, to help keep track of things.
This is in addition to the separate power cable, described on the prior page.
• Red = GROUND (yes, red, and yes this totally is the opposite of common
electronics conventions)
• Green = data IN to the printer (RX)
• Blue = data OUT of the printer (TX)
• Yellow (DTR) and black can be left unconnected
The Nano printer cable has five wires and no separate power cable.
Power and data share a single connector here. Ground must go to both the power
supply and the microcontroller, meaning you’ll need a split here, perhaps using a
breadboard’s power rail.
The Printer Guts cable has five wires and no separate power cable.
Some printers have a color-coded cable, while others have just have a plain white
cable. Unplug this temporarily from the printer and you should find the pin functions la
beled on the PCB:
The pin order here is not the same as the Tiny or Nano printers. And if you have both
Guts and Nano printers, be super careful about the wiring, because the plugs are
• VH = 5–9V DC power
• GND = power and signal GROUND
• RX on the PCB = data IN to the printer
• TX on the PCB = data OUT of the printer
• DTR on the PCB = can leave unconnected for now
As with the Nano printer, power and data share a single connector. Ground must go to
both the power supply and the microcontroller, meaning you’ll need a split here,
perhaps using a breadboard’s power rail.
To Arduino
For a board like the Arduino Uno, the other end of the jumper wires can insert into the
board edge sockets. For smaller devices on a breadboard, insert into the
corresponding contact strip.
Ground from the printer always connects to GND on the microcontroller board. For
the data wires (TX and RX), which pins to connect to can vary by hardware and
software, explained further on subsequent pages. Some situations may require
specific pins, but you can usually use any two pins. Here’s the printer’s TX line
connected to digital pin 5, and RX to digital pin 6:
To Raspberry Pi
Before connecting any TTL serial printers to Raspberry Pi, it’s vitally important to
perform a little system configuration first.
The Raspberry Pi board has a TTL serial connection on the GPIO breakout header. By
default, it’s configured for a serial console — connected to a terminal, this provides
another way to log into the system (along with Ethernet, WiFi or
keyboard+monitor). We need to turn off the serial console behavior, or a connected
printer will just spit out endless gibberish! This only applies to a TTL serial connection;
Tiny printers using USB, or others when using a USB-to-serial adapter, don’t need this
step.
You’ll find the Serial Port settings under “Interface Options.” Select “No” for the login
shell, and “Yes” if asked about the serial port hardware (this option might not show up
on older Pi models, where it’s always on). Tab over to “Finish” and reboot when
asked.
TX and RX from the printer go to specific GPIO pins with opposite functions. TX to RX
and RX to TX, known as a crossover configuration:
Really you can use any GND shown in the pinout diagram above. The third pin is easy
to locate, but that spot’s sometimes occupied by other hardware like small cooling
fans.
The diagram here is representative, not literal. Some adapter cables might have this
pinout, but others will not. FTDI cables, for example, usually have a 6-pin header with
its own color code; only 3 pins are needed here. You’ll find pin functions and colors in
the specific cable’s documentation.
Any of these cables will require device driver software. Popular ones (FTDI, Prolific,
etc.) might already be present on Linux systems. Check documentation.
Also, how the device manifests when connected to a computer’s USB port will vary
among manufacturers and drivers. In Linux it might show as /dev/tty.USBserial
The Tiny printer has the lovely option of connecting via USB cable, no jumper wires
needed. On Raspberry Pi, there’s no need to change anything with raspi-config…but
there are some things to know about the system.
On current Tiny printers, and on earlier ones when suitably configured, the printer
appears to the system as /dev/usb/lp0 and operates through the USB printing
subsystem. Sometimes there will be a different number at the end, if more printers are
attached.
On earlier Tiny printers, the factory configuration instead has it appear as /dev/
ttyUSB0, which mimics a Prolific USB-to-serial bridge. Sometimes there will be a
different number at the end, if other USB-to-serial devices are attached.
Any software or commands that want to issue data to the printer should speak to the
appropriate device name (try ls /dev from the command line to see what’s present,
or try lsusb ). Project code will often have the system device name in a global
variable somewhere. Aside from that difference, they should both function the same;
open the device, issue data, printer prints it.
If you have an older Tiny printer (defaulting to USB-to-serial bridge) and specifically re
quire USB printing subsystem compatibility instead, there’s a way to switch it over:
1. Similar to the self-test, hold the paper feed button while applying power…but
now keep holding it.
2. After the QR code, the current USB mode is printed: this will either be COM
(USB-to-serial mode, the default) or Printable Port (USB printing subsystem).
3. Release the paper feed button.
4. To keep the current setting, tap the paper feed button once more.
5. To change to to the opposite USB setting (COM or Printable Port), hold the feed
button for at least 2 seconds. The printer will confirm the change.
Arduino Code
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
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:
to this:
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.
The thermal printer has a few handy things it can do, most of which are in the A_print
ertest sketch. These are shown in the image above. In order, starting from the top:
Look through the source of the A_printertest sketch to see these used in context.
The first step is to get the image prepared. The printer can only do monochrome (1-
bit) images, and the maximum width is 384 pixels. We suggest starting with a small
bitmap (100 pixels or less on each side) and then experimenting to get the size and
look you want.
A few steps are required to prepare an image for printing. For Windows users, there’s
a nice graphical user interface for this. For Mac and Linux, different tools are used…
not as visually slick, but they do the job well.
These barcode printers shouldn't be confused with a LaserJet - they're not good
at printing heavy/dense images with lots of black or they might stick and stall!
Windows
Use an image editing program to save your image as a 1-bit BMP — in Windows, the
built-in Paint program will suffice.
Download, install and run LCD Assistant (). This program is for Windows only but does
a really fantastic job! Load the BMP file you previously generated (in Paint, etc.). The
file must be in BMP format — the software won’t read PNG, GIF, etc. Then a couple of
settings need to be adjusted…
Second (item B above), you may need to change the Width setting. Because this
software (and the thermal printer) handle images in horizontal groups of eight pixels,
if the image width is not a multiple of 8, it will be truncated (cropped) to the nearest
smaller 8-pixel boundary. For example, with the 75 pixel wide image above, the output
will be cropped to only 72 pixels wide, losing some data from the right edge. To avoid
this, increase this number to the next multiple of 8 (that would be 80 for the example
above), and the output will be padded with blank pixels to cover the gap. Remember
the number you use here, you’ll need it later.
The image height does not need to be adjusted this way, only width.
Set the table name to something short but descriptive (e.g. “adalogo” above), then
select Save Output from the File menu. Give the file a similarly brief but descriptive
name, ending in “.h” (e.g. “adalogo.h”).
To get this file into your Arduino sketch, select “Add File…” from the Sketch menu. This
will add a new tab to your code. Your original code is still there under the leftmost tab.
A couple of small changes are now needed in both tabs. First, at the top of the file
containing the new table data, change “const unsigned char” to “static const uint8_t
PROGMEM” as shown below:
#include "adalogo.h"
Check the A_printertest example sketch if you’re not sure how to include the code
properly.
You can now output the image by calling printBitmap(width, height, tablename), where
width and height are the dimensions of the image in pixels (if you changed the image
width to a multiple of 8 as previously described, use that number, not the original
image size), and tablename is the name of the array in the new tab (e.g. “adalogo”
above).
Having a graphical user interface is nice, but some of these extra steps can be
confusing and error-prone. If you prefer, the technique below for Mac and Linux works
in Windows as well.
First, if you don’t already have the Processing language installed, download it from
processing.org (). Processing looks almost exactly like the Arduino IDE, but it’s for
writing code for your normal computer, not a microcontroller. This can be a little
confusing to first-timers, so if something doesn’t seem to compile, make sure you’re
running code in the right environment: Arduino for for the Arduino board, Processing
for your computer.
This code runs in Processing 2.x, the latest version of Processing available from
their website. Don't use the older Processing 1.5.x version!
The Adafruit_Thermal library folder that you previously downloaded contains a sub-
folder called processing. Inside that is a sketch called bitmapImageConvert.pde. Load
this into Processing and press RUN (the triangle button).
You’ll be prompted to select an image using the system’s standard file selection
dialog. The program runs for just a brief instant, and will create a new file alongside
the original image file. For example, if you selected an image called “adalogo.png”,
there will be a new file called “adalogo.h” in the same location. This file contains code
to add to your Arduino sketch. You shouldn’t need to edit this file unless you want to
change the variable names within.
To get this file into your Arduino sketch, select “Add File…” from the Sketch menu. This
will add a new tab to your code. Your original code is still there under the leftmost tab.
Next, in the tab containing the main body of your code, add an “include” statement to
reference the new file:
#include "adalogo.h"
Check the A_printertest example sketch if you’re not sure how to include the code
properly.
Barcode Printing
Thermal printers are really good at printing barcodes! This printer supports 11 different
codes - UPC A, UPC E, EAN13, EAN8, CODE39, I25, CODEBAR, CODE93, CODE128,
CODE11 and MSI. It only supports linear (1-D) barcodes, and can’t generate 2-D
barcodes like QR codes (although there is a hack you can do, see below!) Barcodes
are generated “on the fly,” which is nice — you can customize the height and data
included quite easily.
Some barcodes are very restricted — you can only put in 12 numbers, no characters.
Others are very flexible and take nearly any character input. Please check out the
wikipedia list detailing kinds of barcodes ()to pick the right one for your application.
The available range of barcodes varies with the printer firmware revision. Check
Adafruit_Thermal.h for a list of codes.
It’s also possible to print QR codes, if you’re willing to pre-generate them. This might
be handy if you want to, let’s say, include a URL on the receipt and the URL doesn’t
change. You can generate QR codes at many sites including this one. () Use the
smallest QR code size. The image will be in PNG format, so if you’re using the
Windows LCD Assistant tool you’ll need to convert it to BMP first (Windows Paint
works for this). Then you can convert and embed this in your Arduino sketch as
previously described.
On Raspberry Pi, a common choice is to use the board’s GPIO pins to connect to the
printer’s TTL serial port. Also on Pi, and on most other computer (not microcontroller)
situations, there’s the USB port on the Tiny printer, or using a USB-to-serial or FTDI
cable. Please visit the guide for CircuitPython on Linux to see whether your platform
is supported ().
First make sure you are running the latest version of Adafruit CircuitPython () for your
board.
Next you'll need to install the necessary libraries to use the hardware--carefully follow
the steps to find and install these libraries from Adafruit's CircuitPython library bundle
(). Our introduction guide has a great page on how to install the library bundle () for
both express and non-express boards.
Copy the adafruit_thermal_printer folder into the CircuitPython drive’s lib directory.
Place the whole folder itself there, not the individual files within.
If you're using a Raspberry Pi or other computer with Python, you'll need to install the
Adafruit_Blinka library that provides the CircuitPython support in Python. This may
require verifying you are running Python 3. Since each platform is a little different, and
Linux changes often, please visit the CircuitPython on Linux guide to get your
computer ready ()!
Once that's done, from your command line run the following command:
Before you can use the printer module you must determine the firmware version and
baud rate of the printer. This is easy to find out by printing a test page from the
printer as described on the “First Test” page (), hold the printer button as power is
applied. Print out the test page and take note of these values printed at the bottom:
To demonstrate the usage of the sensor we'll initialize it and print some text from the
REPL.
First you must import the necessary modules to initialize the hardware serial
connection to the printer. These commands will vary depending on your hardware -
choose the appropriate set:
# On a CircuitPython microcontroller:
import board
import busio
uart = busio.UART(board.TX, board.RX, baudrate=19200)
Notice the baud rate of the serial connection is specified with the baudrate keyword.
For most printers they'll use a rate of 19200 baud, however other printers might be
configured to use a different rate like 9600 baud. Use the baud rate you saw printed
on the test page of your printer!
Next you'll need to import the thermal printer module and call a function to get the
right class depending on the version of your printer firmware. Be sure you've found
the exact version number for your printer by following the steps mentioned above and
on the previous test page!
import adafruit_thermal_printer
ThermalPrinter = adafruit_thermal_printer.get_printer_class(2.69)
Initialize ThermalPrinter
printer = ThermalPrinter(uart)
Notice you must pass in the serial UART connection that was previously constructed.
Be aware it will take from a half to even 5 seconds for the printer to be created and
initialize itself and warm up. You can optionally specify auto_warm_up=False as a
printer.test_page()
You can advance the paper forward a number of lines with the feed function, try
feeding 2 lines to make some space:
printer.feed(2)
Now print a small line of text with the print function and feed a few lines to move it
out of the printer to read:
There are a few properties you can use to adjust how text is printed. Each of these
can be set to a True value to enable, or a False value to disable:
There are a few properties you can set to special values to further control text
printing:
• underline - This controls underline printing and can be None (off), adafruit_
thermal_printer.UNDERLINE_THIN , or adafruit_thermal_printer.UNDERL
INE_THICK .
• size - This controls the size of text and can be
adafruit_thermal_printer.SIZE_SMALL , adafruit_thermal_printer.SIZ
E_MEDIUM , or adafruit_thermal_printer.SIZE_LARGE . The default is
small.
For example to print thick underlined, medium text, with center justification:
printer.underline = adafruit_thermal_printer.UNDERLINE_THICK
printer.size = adafruit_thermal_printer.SIZE_MEDIUM
printer.justify = adafruit_thermal_printer.JUSTIFY_CENTER
printer.print('Medium center!')
# Reset back to normal printing:
printer.underline = None
printer.size = adafruit_thermal_printer.SIZE_SMALL
printer.justify = adafruit_thermal_printer.JUSTIFY_LEFT
# Feed lines to make visible:
printer.feed(2)
Print Barcodes
Finally you can print a barcode with the print_barcode function. Each printer
supports a different type and format of barcode so consult the product sheet in the
downloads section for each type. However here's an example of printing a UPC A
barcode with value '123456789012':
printer.print_barcode('123456789012', printer.UPC_A)
printer.feed(2)
• printer.UPC_A
• printer.UPC_E
• printer.EAN13
• printer.EAN8
• printer.CODE39
• printer.ITF
• printer.CODABAR
• printer.CODE93
• printer.CODE128
Check Paper
With some printers (not all, and it varies among firmware releases), if you've
connected the RX pin of your board to the printer TX, you can query paper status with
the has_paper function that returns True or False if there is paper present:
printer.has_paper()
On the Raspberry Pi, comment out the uart = busio(...) line, and uncomment
the import serial and uart = serial.Serial(...) lines, changing /dev/
ttyUSB0 to the appropriate serial port.
Unless you used a voltage divider to hook up the printer TX line, make sure you
comment out the paper check code:
# Check if the printer has paper. This only works if the RX line is connected
# on your board (but BE CAREFUL as mentioned above this RX line is 5V!)
#if printer.has_paper():
# print('Printer has paper!')
#else:
# print('Printer might be out of paper, or RX is disconnected!')
Now you can run the program with the following command:
python3 thermal_printer_simpletest.py
import adafruit_thermal_printer
# Pick which version thermal printer class to use depending on the version of
# your printer. Hold the button on the printer as it's powered on and it will
# print a test page that displays the firmware version, like 2.64, 2.68, etc.
# Use this version in the get_printer_class function below.
ThermalPrinter = adafruit_thermal_printer.get_printer_class(2.69)
# Define RX and TX pins for the board's serial port connected to the printer.
# Only the TX pin needs to be configued, and note to take care NOT to connect
# the RX pin if your board doesn't support 5V inputs. If RX is left unconnected
# the only loss in functionality is checking if the printer has paper--all other
# functions of the printer will work.
RX = board.RX
TX = board.TX
# Create a serial connection for the printer. You must use the same baud rate
# as your printer is configured (print a test page by holding the button
# during power-up and it will show the baud rate). Most printers use 19200.
uart = busio.UART(TX, RX, baudrate=19200)
# Initialize the printer. Note this will take a few seconds for the printer
# to warm up and be ready to accept commands (hence calling it explicitly vs.
# automatically in the initializer with the default auto_warm_up=True).
printer.warm_up()
# Check if the printer has paper. This only works if the RX line is connected
# on your board (but BE CAREFUL as mentioned above this RX line is 5V!)
if printer.has_paper():
print("Printer has paper!")
else:
print("Printer might be out of paper, or RX is disconnected!")
# Disable underlines.
printer.underline = None
Python Docs
Python Docs ()
Downloads
• Adafruit_Thermal library for Arduino ().
• LCD Assistant () — optional bitmap conversion utility for Windows.
• Processing () language — needed for bitmap conversion for Mac or Linux (and
optionally Windows). DOWNLOAD VERSION 1.5.1, not the 2.0 beta.
• Thermal Printer User Manual ().
• An older version of the Thermal Printer User Manual ().
• Thermal Printer Product Sheet ().
Firmware Changer
If you'd like to risk it, you can revert/change the firmware using this tool that is from
the manufacturer. We haven't tried it. It's completely utterly unsupported and you may
break your printer. We won't replace it if it stops working due to a firmware change!
update_firmware.zip
Make sure the paper is in the bay correctly, it should feed under and up so that the
paper comes through the slot without bending.
For mini and tiny printers, hold down the button on the top, then plug in the printer
to power. It should print out a test page. On nano printers and guts, connect power
first, then tap the button.
The printer’s LED will not be on solid, it will blink once in a while, that's normal.
I'm trying the self test and it's still not working.
Make sure you have a good power supply that can deliver the required current. If
you are trying to operate at 5V, your power supply must be able to maintain a
constant 5V even when the current demand spikes during printing. If your printer is
making an attempt to print, but then struggling, then it is likely your power supply is
dipping below 5V.
If you have one available, try a higher voltage power source, but no more than 9
Volts.
Make sure the paper roll is not 'stuck' feeling in the bay, it should rotate easily!.
Old syntax:
New syntax: declare a SoftwareSerial object and pass its address to the
Adafruit_Thermal constructor, like so:
Adafruit_Thermal printer(&mySerial);
mySerial.begin(19200);
printer.begin();
Some boards (e.g. Arduino Due) have multiple hardware serial ports, and the extras
might be named Serial1 , Serial2 , etc. These can be used by passing the
address of the serial device like so:
Adafruit_Thermal printer(&Serial1);
Some features just behave a little differently among releases…barcodes, line feeds,
etc.…if you were previously using an older library or an older printer, you may need
to tweak the code to produce the desired formatting with a current setup.
Earlier model Tiny (USB) printers might appear by one of two different device
names. Switching between them is explained toward the bottom of the “Making
Connections” page. Newer units always appear in the /dev/usb subdirectory.
Hacking!
The following…
• Have first confirmed that the printer works as expected when operated through
conventional procedures.
• Have a genuine performance bottleneck that cannot be adequately resolved
by adjusting the printer timing and thermal settings first.
• Are comfortable opening things and soldering.
These printers have a limited serial receive buffer. Push bits to the printer faster than
it can physically heat dots and feed paper, and you experience an “overflow” —
bitmap images become garbled, text and formatting commands may be skipped.
The thermal printer library tries to throttle data to the printer at just the right rate. Too
fast and an overflow occurs. Too slow and it wastes your time; the printer isn’t
operating at peak throughput. This is an imperfect process…though we use very
conservative timing estimates, the actual speed through the printer is impossible to
predict…sometimes overflows still occur.
Hardware handshaking is a means by which a printer or other device can report to the
microcontroller that it’s ready to receive more data, virtually eliminating buffer
overflows while operating at peak throughput…the paper feed stops only when it
physically absolutely must. Optimal performance.
The “Tiny” and “Nano” printers (plus the “Printer Guts”) have an exposed DTR pin
— no modification is necessary! Scroll down to the “Code Changes” section to
continue.
Language pedants may note that this isn’t technically a DTR pin, but rather CTS. It’s
long-standing thing among printer manufacturers…apparently the misnomer was
made decades ago but has stuck for consistency.
You can then reconnect the power and serial sockets, and wire those up as before.
Use a jumper wire to connect DTR to any available Arduino pin. In our examples, we’ll
use digital pin 4.
The printer electronics operate at 3.3V (but are “5V safe”), so no level shifting is
needed with 3.3V boards (Arduino Due, etc.)…this can safely be connected directly.
This works just as well with a hardware serial port (e.g. Arduino Mega or Due):
No other changes are necessary. Try this with one of the example sketches…you’ll find
the printer is suddenly lots faster! That’s because the software throttle is no longer
used…the printer continually reports its actual “ready” state to the microcontroller.
The printBitmap() function can output images from an open stream or stored in
PROGMEM (flash memory)…as explained on the “Printing Bitmaps” page.
Although the Arduino Mega has a whopping 256K flash space, a limitation of the AVR
microcontroller is that a single array can’t exceed 32K…that’s about a 384x680 pixel
bitmap image. If you try to embed a larger image in your code, the compiler will report
an error.
If you try to print a “dense” image and the paper jams (image gets squashed
vertically), pass a lower density value to printer.begin(). Default value is 120. So for
example: