Mini Thermal Printer Flow Control

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Mini Thermal Printer Flow Control

Post by Kyle1997 »

Hi, I'm following this tutorial, https://learn.adafruit.com/networked-th ... re-printer for my thermal printer. I'm attempting to change the flow control using the gv2_thermal_printer_config.py file but am getting errors returned that I don't fully understand. The default flow control for my printer is HW Flow Ctrl according to the test sheet.

Code: Select all

pi@raspberrypi:~/zj-58 $ sudo python gv2_thermal_printer_config.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 398, in _reconfigure_port
    orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/zj-58/gv2_thermal_printer_config.py", line 12, in <module>
    ser = serial.Serial(PORT, BAUD, timeout=0.5)
  File "/usr/local/lib/python3.9/dist-packages/serial/serialutil.py", line 244, in __init__
    self.open()
  File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 332, in open
    self._reconfigure_port(force_update=True)
  File "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 401, in _reconfigure_port
    raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mini Thermal Printer Flow Control

Post by mikeysklar »

Can you show a photo of your test page printout?

Have you been able to print the simple command line test to verify the baudrate and serial lines?

Code: Select all

stty -F /dev/serial0 19200
echo -e "This is a test.\\n\\n\\n" > /dev/serial0
Once we can rule out wiring, configuration and permissions we can focus on your actual question of changing flow control.

User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Re: Mini Thermal Printer Flow Control

Post by Kyle1997 »

I've been able to do some short prints, one line max. Any more than one line and the printer begins to print gibberish. For instance, printing a multi-line text file or an image or even just a string that's too long. When I get home I'll post pictures of the test sheet and the prints I've gotten so far. But as far as wiring, configuration and permissions go I believe that's all functional as my initial single-line prints do work.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mini Thermal Printer Flow Control

Post by mikeysklar »

Seeing the test print page photo and an example for a short amount of text fail might help. It does sound like HW flow control is the area to focus on.

User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Re: Mini Thermal Printer Flow Control

Post by Kyle1997 »

Sorry for the delay, something came up.

https://imgur.com/a/FnXzGma

That’s the test sheet and a sheet I printed with basic commands.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mini Thermal Printer Flow Control

Post by mikeysklar »

The self test page is really light. I see 8v on the power supply. Do you know how many amps your power supply is rated for?

The following image "mini-project -thermal printer / This is a test." reads much better.

Have you tried using this repo?

https://github.com/adafruit/Python-Thermal-Printer

User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Re: Mini Thermal Printer Flow Control

Post by Kyle1997 »

Yeah, sorry about the test page. The printer won’t print another one so all I have is the one that came in the box with it. The manual says to hold the button in “for some time” but it doesn’t do anything.

The power supply I’m using is the one that was suggested by the retailer, this one https://core-electronics.com.au/5v-dc-2 ... gpack.html. It appears to be 5V

User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Re: Mini Thermal Printer Flow Control

Post by Kyle1997 »

Just realized you asked for amps, it looks like it’s rated for 2A

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mini Thermal Printer Flow Control

Post by mikeysklar »

Try this printertest script. It has some configurable settings like warmup time which might help. We do recommend the 5v 2A so your power supply sounds correctly sized.

https://github.com/adafruit/Python-Ther ... tertest.py

; scroll down the github page for instructions.
https://github.com/adafruit/Python-Thermal-Printer

User avatar
Kyle1997
 
Posts: 6
Joined: Wed May 18, 2022 4:51 am

Re: Mini Thermal Printer Flow Control

Post by Kyle1997 »

Thanks for all of your help but it looks like I was able to fix it. The university I’m studying at has their own version of Raspbian, which I had installed on the Pi due to needing it for other components of my study. After digging through the system files I figured it was worth flashing the latest vanilla version of Raspbian onto the SD card, which evidently fixed the issues I was having with printing (after some tinkering with config files to enable uart).

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Mini Thermal Printer Flow Control

Post by mikeysklar »

Great work. I had no idea you were running a custom older release. We probably should have started with that. Good to know the current release seemed to resolve the issue.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”