loading

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.

<p>Hey, thanks for this tutorial. I've got it mostly working, but my printer seems to skip a few lines and the image comes out &quot;squashed&quot; and shortened in a consistent way each time I print. Off the top of your head, can you think of what might be going on? I understand if that's not enough to go off of... I'm a beginner so I'm not sure what information would be relevant. </p>
The processing sketch expects a baud rate of 19200 but not all thermal printers are factory set to that value. Follow the instructions here: https://cdn-learn.adafruit.com/downloads/pdf/mini-thermal-receipt-printer.pdf (page 7) to print a test page, which will tell you the baud rate. If it's not 19200, change the baud rate in the processing sketch to match the value on the test page. If that doesn't help, increase the delay between the lines of the bitmap - where it says delay(20); within the two 'for' loops. Set it to a high value like 500 - the print will be slow, but if it prints correctly with the larger delay, gradually reduce it to find the fastest you can print without missing lines. Hope that helps, and if you have any more trouble leave more comments.

About This Instructable

428views

7favorites

License:

Bio: Please see this Instructable they refused to list https://www.instructables.com/id/Hammer-Time-Arduino-Hammer-Pendulum-Clock/
More by OpenTronic:Lasercut Longworth Chuck Rotary Lasercutter Axis Lion Makeup Compact 
Add instructable to: