Over the last few weeks, I’ve been playing with a few small thermal printers. Meant as POS or information booth printers, they make a diverting project for the lo-fi printing enthusiast. While they all have common features â€” 58 mm/2Â¼” paper width, 8 pixel/mm resolution, 48 mm print width, serial connection â€” they all have their quirks. You may have seen these sold as the Adafruit Mini Thermal Receipt Printer or Sparkfun’s Thermal Printer, but there are many others. I’m going to write more on interfacing these directly to Raspberry Pi, Arduino, and (if I can navigate the documentation) a CUPS driver.
Update, July 2015: Here’s a CUPS driver: klirichek/zj-58, and my writeup on installing it on a Raspberry Pi â€” Thermal Printer driver for CUPS, Linux, and Raspberry Pi: zj-58
For now, I’m just leaving you a list of things I’ve found helpful for the DP-EH600 and 701 printers. Note that the similar-looking BTHT-v6 printer uses a completely different command set.
- Replacement paper is sold as 2Â¼” Ã— 30′. Staples have a box of 30 rolls for under $25 (item 279096, not on their website). Longer rolls don’t fit.
- You’ll need a USBâ†’TTL Serial adaptor, preferably one with DTR control. I use one from JY-MCU. In a pinch, you can use a simplerÂ Debug / Console Cable for Raspberry Pi, but you risk serial overruns and dodgy results. Remember that RX on the adaptor goes to TX on the printer, and vice versa.
- A good solid power supply is needed; these printers draw ~8 W when printing. Some printers only support 5 V (for which a 3 amp adaptor would be ideal), others 5-9 V. The higher voltage makes text printing faster. You can’t drive these directly from your Raspberry Pi/Arduino power supply.
- Linux serial ports are set to some defaults which may have been historically useful, but now corrupt 8-bit data. A trick I picked up here is to first issue the command
stty -F /dev/ttyUSB1 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
which clears all settings, then set the device up as you need it:
stty -F /dev/ttyUSB1 speed 9600 raw cs8
(Most of these printers default to 9600 baud. Your device may be called something different to ttyUSB1.)
- I’ve written a couple of Python driver stubs which take an image and produce the relevant binary output:
- scruss / esc-pos-image.py – prints an image as a single command. May not work on the SparkFun printer. Does not work on the BTHT-v6.
- scruss / esc-pos-image-star.py – prints the image in 24 pixel deep bands. Can sometimes cause visible gaps in the printout, but will work on almost all printers, except the BTHT-v6.
- These Python libraries also work, as long as you address the printer properly (right device, right speed):
- python-escpos – image support limited to 255 pixels high, for some reason.
- Reed Zhao (of Tangram Software) lent me a couple of different printers for testing after I bought a different one from him. He’s put a lot of work into sourcing these printers direct from the manufacturers. Thanks, Reed!
NB: Reed doesn’t sell printers any more. Try eBay.
- Image credits for print samples:
- Stephen Notley, Bob the Angry Flower: excerpts from I Have Absolutely No Idea What I’m Doing! and Achilles’ Heel
- Kate Beaton, Hark, a vagrant: even more about arses
- True Image of J. R. â€œBobâ€ Dobbs, a trademark of The SubGeniusâ„¢ Foundation, Inc
Posted more for historical reference:
- BTHT-V6 manual (Chinese) â€” probably just enough info to follow the wiring and some of the basic control codes. Looks like the one I had was 5V only, so needs a 5V 3A power supply.
- “701 Printer” data/power pinout
- “701 Printer” driver/control codes â€” most likely applies to the DP-EH600 too.
Incidentally, I did some printing in Thai with this printer â€¦
For the DP-EH600 which version do I need?
“Option 1 24VDC,Serial(TTL) interface
Option 2 12VDC,Serial(TTL) interface
Option 3 5-9VDC,Serial(TTL) interface
Option 4 5-9VDC,Serial(RS232)interface
Option 5 5-9VDC,USB interface”
To use with a ______?
Options 1, 2 & 3 will work with an Arduino (5V), or Raspberry Pi / 3V3 microcontroller if you can get the right power supply. 24 V is mostly for truck use, 12 V might be a little easier to get and still prints quickly, and the 5-9 V options are very easy to get but often drive the printer pretty slowly.
Option 4 you likely don’t want at all. Real RS232 levels are a bit rare these days.
Option 5 would work nicely with a Raspberry Pi, but difficult with a microcontroller.
I have an 80mm thermal receipt printer, do you have a version capable of that?
No. Only the 58 mm one.
If someone wants to buy me one, I’d take a crack at it.
Alternatively, this fork of the driver – moeseth/zj-58 – claims to support 80 mm printers.
how do i achieve like the one face/head smoking in the picture above? is that halftone? i am using CUPS and the result i am getting it not like that its comes out dark so can you please tell me how do i get something like this output?
That’s a real optical halftone (or possibly Ben Day dots) in the Dobbshead image. If you want good results, manually halftone your images beforehand. You don’t have a lot of resolution on these printers â€” 8 dots/mm, 384 dots total width â€” so maybe make a feature of the halftoning by making it deliberately coarse.