5

I try to print some text with python and a thermal receipt printer by a Raspberry Pi 2 model B. I use the library developped by Adafruit and the printer sold by Adafruit too. But it fails. The only thing working is the println function, and at least not well. I have to print some characters like .--``[#]..--``--. but I have some random results. Sometimes the line is correctly printed, sometimes the line is vertically mid printed (like a negative interline), sometimes not all the characters.

I use an AC power adaptor from an old Sony electronic equipment to power the printer. Output: DC5V 800mA. The printer is connected to the PI by GPIO and powered by the Sony power supply.

#!/usr/bin/python
from Adafruit_Thermal import *
printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)
printer.setSize('S')
def printfile():
   with open('output') as f:a=f.read()
   a=a.splitlines()
   for i in range(int(len(a))):
      printer.println(a[i])
printfile()

an output file example:

                 [#]            
                [#]]            
                [#]             
            .--``||.            
        .--`     |  .--``--.    
        |       .--`        `--.
        `--.    |              |
`--.        .--``--.           |
 x x`--..--[#]      `--.    .--`
    .--``-[#]][#]      |.--`    
.--`      [#]-[#]   .--`        
|     {`}  ||--|`--.            
`--.    .--|   |x   `--.        
    `--.|              |        
        `--.        .--`        
            `--..--`            

I saw that when it is bad printed, a red led blinks under the printer, that means there are some errors...

Any Idea ?

Links:

Ghanima
  • 15,958
  • 17
  • 65
  • 125
krshk
  • 153
  • 4

1 Answers1

3

It sounds like your power supply is inadequate for the printer. According to Adafruit's documentation (on the link you provided), the printer requires a power supply that can support at least 1.5A output.

Jacobm001
  • 11,904
  • 7
  • 47
  • 58