The thermal Printer:
I was first fascinated by the cheap thermal printer made by Cashinotech. Their model CSN-A2 can be found quite easily. By seeing the datasheet link, the printer might be compatible with ESC/POS protocol. It use a serial port at 115200 baud, TTL level.
I start to connect a scope on the serial lines. In my case the pull-up on TX and RX are not 5v but 3.3v. I can then safely connect it to the RaspberryPi serial port.
Then I faced to the behavior of the printer when you want to print a bitmap image. It takes me some time to understand why the printer speed is not constant. It implies also to understand correctly the parameters, which is not very easy from the datasheet.
Many faced to this problem and it's written on the Adafruit arduino code, there is no flow control to avoid overrunning the printer's buffer. If we send data too fast, the printer could either crash, print garbage characters, or just jump into newer data. If we send data too slowly, the printer wait and makes some stops, and the printed image have some white lines.
The printing module inside the printer is a "FTP-628MCL101" link. By combining the datasheets, we can suppose the meaning of the configuration parameters of the printer. The "max heating dots" is apparently the amount of black dot (heated) can be heated at ones. A line is 384 dots, if you put this parameter to 64 as the default ((7+1) *8), it means that for a black line, it takes 6 heating steps. Which a step time is the parameter "heating time" plus "heating interval". We cannot heat all the 384 dots at ones, probably due to the current peak. So here we can try to predict the printing speed to not overrun the data buffer, by counting the black dots sent to the printer, and make some stops. That is for the case when the printer is slower than the data rate. But when there is blank of very light parts on a bitmap, I face the inverse where the printer stops to wait data.
I found someone who also dig quite far on this printer , and he found a software link to change the serial speed from 19.2 Kbaud to 115.2 Kbaud. In addition, it also allow to change the character set from chinese to international.
Even knowing that, it is very hard to find the right delays and I still faced to wrong behaviour. I had a better look to the board of the printer.
The micro used is a NXP LPC1114. The stepper motor driver is an Allegro A3906. The motor makes a step for each printed line. I connected one of the 4 motor driving input lines to a scope. To do so, I used the brutal method. I scratch the copper line to solder directly a wire. (And use an unused pad to secure it)
And yes: each transition correspond to a step. "Bingo" I have a way to know how much line is printed, and have to take care of not sending too much bytes in advance.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.