Compliment Receipt Printer

A receipt printer which prints randomized compliments.

Raspberry Pi Zero with Python
Custom 3D-printed case, designed in SolidWorks

Overview

I am always looking for project ideas to develop and practice my product design skills. With this project, I saw an opportunity to not only create a thoughtful gift for my girlfriend, but also to get some experience designing a full “product”. To make it work, I would have to combine my knowledge in mechanical, electrical, and software engineering.

I used the Mini Thermal Receipt Printer by Adafruit, and control it using a Raspberry Pi Zero. The Pi runs a Python script on startup to control the printer. When the user presses the button, the printer prints a random compliment on receipt paper which can then be easily torn off.

This project was a great exercise in enclosure design, especially where electrical components and its wiring needs to be integrated together.

Why a random compliment?

I had a few ideas for the kinds of things that I could print using this printer. The original concept was actually to print poems, but I eventually scrapped that idea because I felt that the limited line width of the receipts would detract from the poetry. I settled on random compliments because I liked the idea of serendipitous results and the laughter it might spark.

 

Mechanical Design

To produce a 3D model in SolidWorks, I took measurements from datasheets when possible, but I had to manually model a few components including the case, printer module, button, rubber feet, and solderable breadboard. I I found a model for the Raspberry Pi on GrabCAD.

To design the case, I started by sketching a few concepts of what it might look like. After deciding on a rough design I liked, I started to build it up in Solidworks based on the dimensions of the other parts. I had to consider the fit of other components like the printer module, button, and DC power jack. I did have one key advantage: rapid prototyping. Because I planned to produce the case using my 3D printer, I was able to quickly iterate on the design to produce new versions and improve any poor fits. This did, however, mean that I needed to design it within the constraints of 3D printing. I wanted the part to require no support material to reduce post-processing time, so I avoided steep/extended overhangs.

3D-printing a case prototype

I made the edges nice and rounded so that it would be more comfortable to hold. I added stiffening ribs to the inside of the case to try to find a good balance between stiffness and mass. I also added engraved markings near the power connector as an indicator of power supply requirements.

 
 

I designed the lid so that it can be removed by removing only one screw. The other side of the lid is held in by three tabs. The lid installs flush with the case, as it has a lip to sit on along the inner edge of the main case. I included a draft angle on the outer mating surface to make the lid slide into place more easily.

Since I figured that I might need to disassemble and reassemble the printer a few times for troubleshooting, I designed the case to use heat-set threaded inserts.

 

Lid installation, with just one screw

 
 

Electrical and Software Design

I used the Mini Thermal Receipt Printer by Adafruit. It was easy to communicate with the printer module thanks to the handy Python library published by Adafruit. I also bought a DC power jack and push button from Digikey, which help to give the product a more finished appearance.

Originally, I wanted to include some indicator LEDs. However, I eventually backed away from including them because the visual clutter would increase, and the functionality of the product wouldn’t really be improved since it is so simple already. The receipt printer module already indicates power status using its own LED.

I encountered many problems during assembly, since the connectors and wiring ended up being much more bulky and stiff than I anticipated. I first tried to use JST connectors to make the pre-assembly connections, but I found that the wires ended up breaking from strain too easily. Other connections used heat shrink, but the wires were made too stiff as a result. Though not the most elegant solution, I ended up using screw terminals with ferrules for strain relief to make connections between the breadboard, Raspberry Pi, printer, and button.

 
 

On the software side, I needed to write a Python script to generate random compliments and then send the printing commands to the printer. The compliments are of the format

“Your <body part> is <qualifier> <positive adjective>!”

To accomplish this, I downloaded a list of English adjectives, and filtered it manually to find the ones with appropriately positive definitions. I manually created my own list of body parts, as well as a list of qualifiers.

The script loops, waiting for a button press. Once the button is pressed, a software debounce is applied to prevent multiple activations. Then, one entry is randomly picked from each word list, the compliment string is assembled, and the commands are sent to the printer using the thermal printer Python library.

The Raspberry Pi was configured to run the script on startup, and the project was complete!

 

Final Thoughts

As with any project, there are always things that could be improved:

  • The case could use increased stiffening. The stiffening ribs I included turned out to be insufficient, as they only provide stiffening along one axis. The lid is also insufficiently stiff. It’s a good lesson for me in the future if I’m ever working with plastic enclosures: plastic is great, but it’s pretty floppy!

  • If I were to change the controller from a Raspberry Pi to something lower level such as an STM32 or an ATMega chip, and create a custom PCB, several problems would be addressed. The number of external electrical connections would be reduced, which would improve robustness and ease of assembly. Such a change would also reduce the overall volume of the product, and dramatically reduce startup time. On the other hand, doing so would remove the ability to make software adjustments remotely.

Overall, however, I am quite proud of the product I made. It was great practice in enclosure design with electrical requirements and constraints. And as for the most important criteria of all, the gift was well received! 😊