Setting up the Pi Tiny Thermal Printer (Zijiang ZJ-58)

Setting up the Pi Tiny Thermal Printer (Zijiang ZJ-58)

I recently acquired a Tiny Thermal Receipt Printer from ThePiHut. Setting it up with my Raspberry Pi 6 via USB was mostly straightforward, with a few small hiccups.

Setup

I followed this guide from Adafruit. Despite the warnings about the guide being out-of-date, it was mostly correct except for a couple of small points:

1: Different device name

When I set up the printer device, it was shown as "SUPERRISC S31 (S31GUID)" instead of "UNKNOWN".

The printer device being shown as "SUPERRISC S31 (S31GUID)" in the Raspbian printer device selector.

2: Soft reset required to avoid printing garbage

Initially, the printer would print fine via redirection:

echo -e "This is a test.\\n\\n\\n" > /dev/serial0

but would print a header of garbage for everything printed via lp except for the very first print after power-cycling.

Two images of garbled printouts from the printer, both showing many lines of garbage before printing the expected text / image.

The solution was to add configuration CUPS's usb-quirks file to soft-reset this specific printer between every print:

echo "0x0fe6 0x811e unidir soft-reset" | sudo tee -a /usr/share/cups/usb/org.cups.usb-quirks

This fix was based on this Gist from Irdroid, except with a different USB device and vendor ids. You can look up these by running lsusb, and if you're struggling to identify which device it is, try unplugging it, run lsusb again and play spot the difference:

user@pi:~ $ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Result

The printer now works nicely, both for text and images. It does seem to have a bit of banding (i.e. some rows print more nicely than others) so it's not super-high quality.

It prints very quickly -- as soon as I hit enter it starts, and takes at most a second to print small things.

A printout of the Dreamcat logo -- a snoozy cat.

Other reading

I found a post on the adafruit forums describing the same garbage issue I saw. In this case their resolution was to switch over to direct serial, which I believe is slower than USB.