Hacks, Portfolio

Fun with thermal receipt printers

I gave a talk last week at Spec.la about playing with thermal receipt printers, which you can watch above. Here is some more information about the project:

This is the original video of the token of affection printer and a picture of the token itself (portrait by Flynn Nicholls).

My specific thermal printer is an Epson TM-T88IV. The PHP library I’m using throughout is Michael Billington’s escpos-php. It has a list of all of the printers it supports with the ESC/POS command set.

From Mike’s quick start guide, you can see it’s as easy to print as sending:

echo "Hello World" | nc 192.168.192.168 9100

The video of a printer printing code page 437 ASCII art is by burps. You can see the full DOS Code page 437 on Wikipedia. In the Epson world, this is Code Page 0 and is probably supported on their entire product line. The Cobra ASCII art I printed is by fUEL’s the knight for Break#11. The jitter is from me using the printer’s onboard color inversion and the printer not quite keeping up (ASCII is usually white characters on a black screen, not black characters on white paper). I chose Font B and Double Height text to remove any whitespace between the lines.

I showed the @PETSCIIBOTS Twitter account. I also mentioned The Little Printer and Chumby. I’m pretty sure the rstevens project for The Little Printer I was actually thinking of is Pixel Presidents which were delivered every Friday. I also say “The IOT” at this point in the video much to my amusement. Although not mentioned in the video, Adafruit has done a lot of work with thermal receipt printers.

Maze of the Moment

I used Bill Parrot’s PHP-Maze-Generator which uses the Union-Find algorithm to create the maze. There’s a brief discussion in the video with jbum of KrazyDad where he suggests Kruskal’s algorithm might be able to generate it line by line or at least more efficiently.

Other notes: My printer does two colors according to the specs but I haven’t found the proper paper for this. I assume it’s just printing at two different temperatures. Also, it seems almost impossible to buy fewer than 10 rolls of paper at a time.

The final thought of the video is about the RJ12 port on the back of the receipt printer. The port is designed to trigger the opening of a cash drawer when the ESC p command is sent to the printer. This wiring appears to be fairly standard and you can find compatible cash drawers all over the place. Finding receipt printers on the network and opening their cash drawers is left as an exercise for the viewer. I also wonder if you could induce a charge in the unshielded cable to get the drawer to pop. What could possibly go wrong?

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.