Thermal printer problem

I bought adafruit mini thermal printer( i am not sure if it is original or Chinese copy). It stops printing after few minutes of inactvity and when I call function to test printing my program just hang there and I have to reset my arduino. I am using adafruit thermal printer library and the testing code is as follows

#include "Adafruit_Thermal.h"

Serial1.begin(9600);    // for printer communication
  printer.begin();

int PrinterTest()      // Test printer
{
  lcd.setCursor(0,1);
  lcd.print(F("In printer test func"));   // 
  printer.justify('L');
  
  printer.println(F("Printer Test"));
  printer.println(F("1234567890"));
  printer.println(F("ABCDEFXYZ"));
  printer.print(F("Printer OK"));
 
  delay(2000); 
  return 0;

could someone guide me what could be wrong and how can this problem be resoled.
PS: Actual code is very long. Just shared the printer relevant code

Hi,
Can you post a link to data/spec of the printer please?

What are you using to power the printer?

Thanks… Tom… :slight_smile:

Then there is something in the "setup" part of your program you did not tell us about.

Paul

Without seeing your initialization it is a bit hard to speculate, but in the interim, here are a couple ideas:

I understand that this printer has an automatic low energy state (sleep mode). I’m not sure what default sleep timeout has been initialized, but have you tried issuing the following command before you engage with the printer after an extended period?

printer.wake();

If that doesn’t work, then I wonder if the thermal library may be getting stuck in the blocking timeouts that it uses internally before issuing additional commands to the printer. I looks like these timeouts depend on either DTR or an absolute time delay. I couldn’t see your thermal constructor to see whether you had enabled DTR signaling.

Impulsive:
Without seeing your initialization it is a bit hard to speculate, but in the interim, here are a couple ideas:

I understand that this printer has an automatic low energy state (sleep mode). I’m not sure what default sleep timeout has been initialized, but have you tried issuing the following command before you engage with the printer after an extended period?

printer.wake();

If that doesn’t work, then I wonder if the thermal library may be getting stuck in the blocking timeouts that it uses internally before issuing additional commands to the printer. I looks like these timeouts depend on either DTR or an absolute time delay. I couldn’t see your thermal constructor to see whether you had enabled DTR signaling.

Thanks Impulsive. I think that will work. will test and update. Thank you all.

Now I got another problem.
My printer print some commands and print only half part of others.
Also it does not print this at all

printer.print("---------");

Hi,
Can you post your complete code please?

Thanks.. Tom... :slight_smile:

Code exceeds 9000 character limit so attaching it as file

Few other things that i noticed about printer
1 it does not print test page if I press feed key for few seconds but feed paper at every press.
2.LED on printer blink with less than 20% duty cycle (ust felt from its on/off time.
3. Does not print anything on printer.testPage() function.
and miss few prints as mentioned earlier.

simulation_testing.ino (48.8 KB)

TomGeorge:
Hi,
Can you post a link to data/spec of the printer please?

What are you using to power the printer?

Thanks.. Tom... :slight_smile:

This is the link of website from where I puchased

the power supply is second hand 5V 3A industrial power supply

Please help. I am really stuck with this printer

If the printer is not generating a test page when you hold down the FEED key at power-on then I would suggest asking the seller for an exchange. It sounds like there could be a printer hardware issue since this is supposed to be a basic operation of the printer itself (according to the manual).

Note that the manual describes a few different LED flash indicators (1, 2, 3, 5 flashes) for various error conditions. Do you see any of those? (It wasn’t clear to me from your description of the 20% duty cycle which it may have been)

I would recommend resolving the printer test page operation before trying to debug the other issues you noted.

As a separate check, did you run the Adafruit A_printertest example and see everything print OK?

It is working properly. Thanks to suggestion of

printer.wake();

suggestion
I tried to increase speed of printing by changing value in

printer.begin();

function that created problem. Now I have left it void. It would be great if someone could give suggestion to increase speed of printer other than increasing supply voltage(I am currently running on 5v);