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:

  • 1
    Have you checked that your power supply is not overloaded? – Craig Dec 14 '15 at 15:25
  • How is the printer powered and connected to the Pi? You should also link to the product and tutorial on adafruit's site in your question. – Steve Robillard Dec 14 '15 at 15:49
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.