0

Raspberry Pi Zero W, Adafruit Thermal Printer only printing
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Raspberry Pi Zero W, Adafruit Thermal Printer only printing

by KaroLadino on Fri Apr 20, 2018 7:23 pm

I'm trying to set up an Adafruit Thermal printer Mode: CSN-A2-T with a Raspberry Pi Zero W that is running Raspbian GNU/Linux 9.4 (which I believe is Raspbian Jessie).

I need to be able to print using either the terminal or Python (or any other programming language) but the problem is that the printer is only printing a limited quantity of characters.

If I send for instance "0123456789abcdef" (sometimes less, sometimes more) it works, but if I try to print "0123456789abcdefghijklmnopqrst..." or any other long text It stops working or it starts printing random characters.

The printer's test page prints just fine and this issue doesn't appear.

This is the tutorial I used to set it up: https://learn.adafruit.com/networked-th ... re-printer

These are the commands I'm using to print:


Using LPR:

Code: Select all | TOGGLE FULL SIZE
echo "This is a test." | lpr


Sendind a text to the serial port directly:

Code: Select all | TOGGLE FULL SIZE
echo -e "This is a test.\\n\\n\\n" > /dev/serial0



This is the printed test page holding the feed button (my printer have one) while connecting power as the tutorial said:
Image

This is how it prints a short text:
Image

This is how it prints a large test (notice that before it was printing correctly):
Image

Finally this is the printer setup:
Image
Image


I hope there's enough information. Thanks for your help :) .

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit_support_carter on Thu Apr 26, 2018 11:10 am

The printer's test page prints just fine and this issue doesn't appear.

It sounds like the printer is functional, so it's most likely just something with the software.

To make sure I understand what' s going on, you can create the issue by simply doing:
Code: Select all | TOGGLE FULL SIZE
echo -e "This is a test.\\n\\n\\n" > /dev/serial0

and it prints fine. But if you do:
Code: Select all | TOGGLE FULL SIZE
echo -e "0123456789abcdefghijklmnopqrst\\n\\n\\n" > /dev/serial0

it prints garbled output. Is that correct?

adafruit_support_carter
 
Posts: 5244
Joined: Tue Nov 29, 2016 2:45 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Sun May 06, 2018 9:22 pm

Sorry for answering so late. Correct, that's what happens.

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit2 on Mon May 07, 2018 2:03 pm

sounds like a buffer is getting overly full. what about the example python code we provide, does that worK?
e.g. https://www.adafruit.com/product/1289

adafruit2
Site Admin
 
Posts: 16358
Joined: Fri Mar 11, 2005 7:36 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Thu May 10, 2018 11:51 pm

Hi! I already finished the tutorial and the result of test with
Code: Select all | TOGGLE FULL SIZE
python printertest.py
from the Github Repo Python-Thermal-Printer is the following:

Image if you can't see the photo check this link

I'm wondering if that is the correct result. I made the test with two printers and the same happens with both.

It's still not printing as expected. What could be missing?
Last edited by KaroLadino on Thu May 10, 2018 11:54 pm, edited 1 time in total.

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit2 on Thu May 10, 2018 11:53 pm

maybe post photos of your wiring? could be linux changed something, they like doing that and breaking our example code :/

adafruit2
Site Admin
 
Posts: 16358
Joined: Fri Mar 11, 2005 7:36 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Fri May 11, 2018 12:02 am

Hi!

Of course, see here how is connected the printer to Raspberry Pi Zero W:

Image

The color code is Black to Black, White to Yellow, Blue to Green.

And here is the connection to the printer:

Image

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit2 on Fri May 11, 2018 12:05 am

what are you powering the printer from

adafruit2
Site Admin
 
Posts: 16358
Joined: Fri Mar 11, 2005 7:36 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Fri May 11, 2018 12:09 am

I have two AC/DC adapters.

One for the raspberry:

Image

One for the printer:

Image

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit2 on Fri May 11, 2018 12:01 pm

hmm maybe try powering the printer with 7.5 or 9V DC?

adafruit2
Site Admin
 
Posts: 16358
Joined: Fri Mar 11, 2005 7:36 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Sun May 20, 2018 4:29 pm

Hi Admin!

Finally I could buy the adapters. With the 7.5V adapter my printers don't work even don't turn on the led. But with the 9V adapter:

Image

IT WORKS!!!!

Image

Both printers! Thanks a lot! You don't imagine how much I appreciate your help!

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by adafruit2 on Sun May 20, 2018 4:44 pm

yyayy!

adafruit2
Site Admin
 
Posts: 16358
Joined: Fri Mar 11, 2005 7:36 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by KaroLadino on Sun May 20, 2018 9:37 pm

Thank you for all your help, Admin. One last thing, I'm printing tweets from the twitter.py script, and I notice the text is not bold enough. Only the last line is printed bold, even if I add "printer.boldOn()" the text continues light. I think it can be the speed it is using to print and feed the paper, maybe it's too fast. But I'm not sure where can I set that up. I modified some lines in Adafruit_Thermal.py , specifically lines 137 and 138, but nothing happened, I increased the values. Do you know what could be happening?

This is how looks:

Image

KaroLadino
 
Posts: 7
Joined: Fri Apr 20, 2018 7:10 pm

Re: Raspberry Pi Zero W, Adafruit Thermal Printer only print

by pburgess on Wed May 23, 2018 2:18 pm

Something to try: in the file Adafruit_Thermal.py, look for this this chunk of code (starting around line 113):
Code: Select all | TOGGLE FULL SIZE
                        heatTime = kwargs.get('heattime', self.defaultHeatTime)
                        self.writeBytes(
                          27,       # Esc
                          55,       # 7 (print settings)
                          11,       # Heat dots
                          heatTime, # Lib default
                          40)       # Heat interval

Try changing the '11' to a '7' and re-run the twitter script. If it looks somewhat better but not 100% right, you can try with smaller numbers there.
This reduces the number of thermal 'dots' that the printer heats at a time. An alternative approach would be to find a power supply that can deliver more amps.

pburgess
 
Posts: 3945
Joined: Sun Oct 26, 2008 2:29 am

Please be positive and constructive with your questions and comments.