Difference between revisions of "Party printer project"

From Helpful
Jump to: navigation, search
m
m (The code)
 
Line 43: Line 43:
 
===The code===
 
===The code===
  
Capturing from the IP camera is continuous at a few frames per second.  
+
Capturing from the IP camera is continuous.  
  
 
We detect a sudden increase in brightness, collect a number of candidates, and choose the best.
 
We detect a sudden increase in brightness, collect a number of candidates, and choose the best.
  
 +
With this processing involved and no parallelism it is still easily a few frames per second, which is more than enough.
  
It's done this way because it means we can trigger without any communication beyond the image.
 
The button doesn't have to go to the Pi, just any lamp.
 
  
It also means we can put the box in a safer place.
+
It's done base don brightness because it means we can trigger without any additional wiring or communication.
 +
 
 +
The mentioned button just has to light the lamp; and the Pi does its work purely based on the images.
 +
 
 +
It also means it's much easier to put the box in a safer place.
  
  
Line 60: Line 63:
  
  
Say, that decoration is mostly just sending strings, alternated with cut commands.
+
Say, the decoration below is mostly just consists of "send string, send cut command, repeat".
  
  
The conversion to an image is slightly more involved, because aside from the image massaging, there's also conversion into a 1-bit image, and packing it into bits one a row at a time.
+
The conversion to an image is slightly more involved, because aside from the massaging the image size and orientation, there's also conversion into a 1-bit image with considerations like brightness and dithering, then packing it into bits one a row at a time.

Latest revision as of 18:45, 6 April 2022

It's a box that prints things.

This was made as a selfie thing at a party - at the height appropriate for an erotic party, in fact - with the idea that it was just high quality enough to be recognizable but not very identifying.


Also easy and cheap to run - thermal rolls are small, cost very little, and requires no ink, much of which also means it is minimally wasteful.


The printer is a thermal Point-of-Sale (POS) printer, a.k.a. receipts printer at a checkout.

It turns most of these receipt printers do around 200dpi (more is rarely useful for receipts), so it can do more than letters and barcodes, so with some care it can do a decent image.


In the box

  • a power strip
the image processing is easier to do when you have some memory and some CPU (a uC would be harder)
  • an access point (and power supply)
Using an old AP makes it easy for this to not depend on the environment's WiFi, and a hidden network is a nice little detail.


Currently a HS802UL (USB and network), I previously broke a Star TSP600 (serial)
one with a cutter is nice, though tear-off also has its charm
I would recommend trying to find one with network interface, because serial interface is rather slower, and potentially finicky (particularly if you don't have proper flow control, networking comes down to 'open TCP connection and send data')
  • some creatively positioned plastic and wood for separation and positioning of all the parts


With a little image massaging (contrast enhancement and in particular dithering), the quality is better than you'ld probably expect from a 58mm (2.3") receipt.
It makes random-wordy decoration


Alongside:

  • A WiFi-capable IP camera
Here a DCS-930L, but any should do, as long as it exposes an URL to fetch the current image from without too much trouble

The code

Capturing from the IP camera is continuous.

We detect a sudden increase in brightness, collect a number of candidates, and choose the best.

With this processing involved and no parallelism it is still easily a few frames per second, which is more than enough.


It's done base don brightness because it means we can trigger without any additional wiring or communication.

The mentioned button just has to light the lamp; and the Pi does its work purely based on the images.

It also means it's much easier to put the box in a safer place.


Various POS printers speak their own proprietary and more capable protocol, but most should be able to speak ESC/POS, a relatively basic protocol, which means fairly simple code should work for most POS printers.


Say, the decoration below is mostly just consists of "send string, send cut command, repeat".


The conversion to an image is slightly more involved, because aside from the massaging the image size and orientation, there's also conversion into a 1-bit image with considerations like brightness and dithering, then packing it into bits one a row at a time.