Visit Us On FacebookVisit Us On TwitterVisit Us On Google PlusVisit Us On LinkedinVisit Us On YoutubeCheck Our Feed

Thermal Printer Driver

One of my latest projects i just finished is a hardware thermal printer driver. This project designed/developed for Delmac Instruments as a part of my internship. Thermal printers are used in cash and weighting machines for receipt printing.

Thermal Printer Connected on the driverThermal Printer attached on the driver

What the specific hardware does is to receive ASCII characters, escape sequences in UART and convert them in a printable form to send to printer mechanism for printing. Escape sequences are used to send commands to the printer to change character size, line spacing etc.

Thermal Printers don't use ink as usuall printers but they have a head of tiny resistors in a row (about 384) which behave on the paper as dots. Also they use a suitable paper which is thermal sensitive. 

By supplying voltage to a single resistor, you heat the resistor and you make the paper burn at the specific point drawing a tiny single dot on the paper. If you supply voltage to a single resistor and you move the paper at the same time by stepping the head motor you will have a tiny width vertical row. This is the basic. (Resistors are refered as elements).

The main behavour of the head is like a shift register. You shift data to be print on the head register and then you supply voltage to the elements, mapping the shifted data, on the paper. For example if you shift a value like 000011100111000111 and you power the elements you will have the '1' bits appeared on the paper with dots.

Here is a diagram showing how the data are shifted.

To print a single character you have to draw it line by line. To do this fast and simple the character pattern has to be saved on a table with all the other characters. Then you select each line of each character you want to print and you shift it on the printer register by the order you want.

For example a simple character pattern of A in 8-bit width and 9-bit height could be:

00000000
00011000
00011000
01100110
01111110
01100110
01100110
00000000
00000000

If we want to print A A then we have to shift the following data line by line.

0000000000000000
0001100000011000
0001100000011000
0110011001100110
0110011001100110
0111111001111110
0110011001100110
0110011001100110
0000000000000000
0000000000000000

The main printing algorith is:

1) Shift one pattern line data to the head register

2) Power the Elements

3) Move motor one step

4) Power the Elements

5) Shift next pattern line data to the head register

Repeat.

 

Note.   Steps 2 and 4 are repeated because each line we see on the paper is two dot lines of the printer head.

Thermal Printer DriverThermal Printer Driver
Thermal Printer Driver