Nice Photo Prints on a Thermal Printer - Halftone and Threshold

by OpenTronic in Circuits > Art

4407 Views, 9 Favorites, 0 Comments

Nice Photo Prints on a Thermal Printer - Halftone and Threshold

Nice photo prints on Thermal Printer tutorial - Circuit diagram + how + why!

The code in this project will work with an Adafruit / Sparkfun style printer. The model number on the base is CSN-A2-T. You may be able to use the same principle to print photos on other models of thermal printer.

You will need:

  • Thermal printer
  • 5-9V DC power supply that can supply at least 1.5A. If your prints come out very light, you may need a power supply that can supply more current. Some thermal printers run on 12V, check the manual of your printer.
  • USB to TTL board. FTDI, CH340 or CH341 for instance.
  • Jumper wires with male and female header connections
  • A power jack that fits your power supply
  • Soldering iron and solder
  • Computer with the Processing and Arduino applications installed

Connect the Thermal printer, power supply, and USB to TTL board together

0:39 Circuit diagram.

1:53 - the jumper wires should just push into the plugs on the wires that came with your printer.

2:27 Before plugging in the power supply, double check the label on the base of the printer to make sure that you have the right power supply - either 12V or 5-9V should be marked on the base of the printer.

3:41 The easiest way to connect the power supply to the printer is to solder jumper wires to a power jack.

3:56 Push those jumpers into the plug on the printer power wires.

4:17 Plug the USB to TTL board into the computer, and plug in / turn on the power supply.

Test the connection with the printer

4:20 Open the Arduino application, and open the Arduino Serial Monitor. Set it to 19200 baud - that's the default baud rate of the printer. Set the line ending to Both NL & CR.

4:34 Type some text into the Serial Monitor and press Enter. The printer should print the text.

Print an image

4:48 Open the Processing application and open the write_to_printer_direct.pde or write_to_printer_direct_tones.pde sketch. On a Mac, the sketch should find your USB serial port automatically, but on a PC your may need to manually set the 'ports[i].indexOf("usbserial")' line in setup() to your USB port. There are tutorials about serial comms in Processing on the Processing website.

(not shown in video) Choose an image to print. Copy it to the sketch folder and rename it source_image.jpg (or .gif, .png, .tga)

Press Play in the Processing application, and your image should start printing.

4:55 This is how the print will look using write_to_printer_direct.pde.

5:17 Some examples of bad prints using write_to_printer_direct.pde. If the image doesn't look very good, you can play around with the threshold level, which controls what tonal level is treated as black. This is the line if(rgb > 382){ - change 382 to a higher or lower value.

5:44 This is how the image should look, using write_to_printer_direct_tones.pde.