Files
personal-site/content/Bash Register.md

34 lines
1.7 KiB
Markdown

Title: Bash Register
Date: 2026-01-25
Category: Creations
Summary: An old cash register with a thermal receipt printer.
Image: bash-register1.jpg
Tags: feed
Guid: 6836532b386642b9879f71f08e5d821f
The Bash Register is an old cash register that my friend and I stuck a Raspberry Pi Linux computer into. It's connected to a thermal receipt printer that prints images sent from the member portal [[Spaceport]] running at my local makerspace, [[Protospace]].
![[bash-register1.jpg]]
Protospace members are able to draw images on the portal:
![[bash-register2.jpg]]
Draw controls include colour, eraser, size, shade, undo history, and reset. The current drawing is stored in local storage so it doesn't get lost if the user accidentally navigates away.
Once a drawing is submitted, its filename is sent to the Raspberry Pi via MQTT. A simple [Python script](https://git.tannercollin.com/tanner/bashregister/src/branch/master/main.py) listens for the message and then immediately downloads and prints it.
All drawings are added to a gallery that can be publicly viewed [here](https://my.protospace.ca/gallery):
![[bash-register3.png]]
## Printing Garbage Bug
While developing the code, I was having an issue where every second print would output several inches of garbage characters instead of the image. After hours of debugging it seemed related to the height of the image being printed. I used `git bisect` to narrow it down to a commit where the canvas's height was changed.
It turned out to be a bug with the printer that happens when printing images with a height that's a multiple of 96 pixels tall:
<https://github.com/python-escpos/python-escpos/issues/367>
The fix for this was simply adjusting the aspect ratio of the canvas on the portal.