You are on page 1of 7

Developing highly-integrated thermal printer-based applications

By Sachin Gupta, Applications Engineer Sr, Cypress Semiconductor Corp. Whenever a money transaction is completed, there is always the need for a printer-based system for printing receipts of transactions, be it a sales terminal, ticket dispenser, weighing scale, gas station, or ATM. Almost all of these systems use thermal printers. The reason thermal printers are more common as compared to other printer technologies is because of their reliability and lower maintenance costs given they are inkless printers. These printers work by selectively heating regions of heat-sensitive paper that is infused with a chemical that changes color when it comes in contact with the heated print head. Thermal printers, however, are much more than just a printing unit. They have many other components, including a key matrix to enter data, some communication protocols to communicate with the host, an LCD to display data, an ADC for measuring voltage, and so on. This article talks about the basics of designing a thermal printer based system. Before we jump into the complete system, let us quickly go through what comprises a thermal printer unit. Figure 1 shows the block diagram of a thermal printer module, though there can be variations based upon the manufacturer and model of module.

Figure 1: Thermal Printer module Thermal head: The primary block of a thermal printer unit is the thermal head. It consists of a number of heating elements (dots). Figure 2 shows the diagram of the thermal head with its associated signals.

Figure 2: Thermal Head The number of elements varies from model to model. The distance between one heating element (dot) and another, called pitch, determines the printing quality and font size which can be achieved. Each heating element is controlled by a register bit.
Article Title Published in Magazine/Website Name (http://www.zzz.zzz.com) Page 1 of 7 Month 2010

‘1’ corresponds to the pixel needing to be printed and ‘0’ otherwise. Printing must be started after making sure that paper is available by checking the comparator output. R1. Also. For stepper motor control. In this circuit. shown in figure 4. and C1 need to be connected externally. Now the strobe signal comes into the picture. resulting in slower printing. The speed of the motor is a function of the operating voltage. discussed later in this article. and C1 is the bypass capacitor.zzz. Stepper motor: Another integral part of this module is a stepper motor. However. Dots are divided into a number of groups (defined by manufacturer) and each group has one strobe signal associated with it. the darker the printing. R1 is the emitter resistance. current sense output can be used to check is there is excessive current flowing through the winding and any required action can be taken. to avoid permanent damage of the head. if the strobe is asserted for too long. There are numerous options available in the market for the H-Bridge ICs and one can be selected based upon local availability and pricing. there are ways to reduce the probability of damaging the head due to overheating. the output of this circuit should go to the comparator. the temperature should not go outside the absolute maximum rating. There should be bulk capacitors connected on the thermal head and motor supply pin as they consume very high current on switching. So. The longer the duration of the strobe signal. if the temperature goes outside the reliable operating range. To heat the elements which have a value ‘1’ in their corresponding latch register cell in that group. Now let’s look into the block diagram of a basic thermal printer controller system. Also. However. Also. printing should be halted. Note that there are thermal printer modules available which do not have an integrated temperature sensor for temperature measurement in order to keep cost down. Care should be taken while selecting the strobe signal’s duration.com) Page 2 of 7 Month 2010 . decoupling capacitors should be connected in parallel to bypass noise. if higher reliability is needed. R2 is the current limiting resistance for LED. Therefore. Paper sensor: A paper sensor circuit is needed to check if paper is there between the roller and thermal head.zzz. it may burn the paper and heating element. In these registers. The reasons for how temperature affects printing speed are explained later in this article. Then a latch signal is applied to latch the shifted data into the latch register which in turn controls each dot. it will increase the thermal head’s temperature. Each shift takes one clock cycle.The thermal head has two registers called the latch register and shift register. Temperature Sensor: For the best printing quality. current sense output of the H-bridge is not needed as the speed is directly controlled by the control signals. the temperature of the head should operate within a specified range. Article Title Published in Magazine/Website Name (http://www. Commonly drive current for the motor is on the order of 1A so an H-bridge circuit is needed to drive the motors. Selecting a device with internal freewheeling diodes reduces the BOM and board space. The size of these registers is equal to the number of dots. These values are shifted into shift registers by the host. Figure 3 shows a typical paper sensor circuit. While this does affect the reliability of the system. Figure 3: Paper sensor circuit A reflective photosensor is used for detecting paper and is an integral part of the thermal head unit. and so the maximum speed is defined by the operating voltage of the motor. R2. the strobe should be asserted. The output of this circuit may not be as per the Vih and Vil of the controller. However. which requires the need for a temperature sensor to be integrated in thermal printer module to measure head temperature.

The upper and lower reference of the comparator has to be selected according to the temperature range. As these systems have both analog subsystems and high-speed communication lines/clock/data signals to the thermal head. One solution is not to apply all the strobe signals at the same time. However. If such supply is not available. the latch signal is asserted. Instead of an ADC. However. One is to write an algorithm which checks and makes sure that the same element is not energized more than a particular number of times consecutively. So.zzz. it will not be effective method to wait for long enough before the strobe is applied again. This will help in increasing header life but will require a lot of firmware overhead. However. whenever a high frequency digital signal is routed. if an ADC is used. its block diagram will be similar to as shown in figure 5. Since most controllers do not have a hardware shift register. Once all the bits are sent. This may result in a need to halt printing due to high head temperature. a window comparator can be used to detect whether the temperature of the head is within the valid range or not. printing speed can be made adaptive to the instantaneous temperature to make sure that system is never driven in red zone. A better approach is to alternate strobe signals in the same group because there will be more area for each strobe segment to dissipate the power. If we consider a ticket dispenser system. Now let us look at the complete picture of a thermal printer based system. The temperature sensing circuit does not need to be very much accurate as the major requirement is to make sure that printing is being done within the specified temperature range. The supply voltage can be used to excite the temperature sensing circuitry provided we have a stable power supply. Also. it does not need a current or voltage DAC for temperature sensing circuit excitation. this requires the CPU to do this job in firmware.zzz.Figure 4: Basic building block of thermal printer module control system The first thing needs to be done in the system is to send the bit stream to thermal head via a shift register. Then ADC is used to measure the voltage across the thermistor circuit. it should be guarded with the ground traces. All the current carrying traces back to the source must be as short as possible to reduce the current loop as this helps in reducing electromagnetic emissions. If one has. then a DAC can be used. there are multiple ways to handle this. This is the time to check if paper is available. One may apply the first half (or any number based upon how many groups strobes need to be divided). When it comes to the speed of printing. in systems where a temperature sensor is not used. Article Title Published in Magazine/Website Name (http://www. so that thermal head can cool down. Designing a power supply which has to supply high current is costly. care must be taken during board layout that analog and digital ground are kept separate. One of the major points to be looked at in such system is the power supply. this practice will ensure maximum reliability of the system though there is no temperature feedback. the head can move to next the row not printing that pixel and then can come back to that row again. The instantaneous current needing to be supplied is proportional to the number of elements being energized. its temperature will increase. When the same element is being energized continuously.com) Page 3 of 7 Month 2010 .

com) Page 4 of 7 Month 2010 . The reason is that SPI natively uses a shift register and it has both clock and data output. apart from the thermal printer unit control. a SPI master is used to generate the clock and data for the printer in place of shift register. analog input measurement etc. keypad interface. From the designer’s perspective. power. make up the user interface. LCD driver.zzz. In this implementation. developers can utilize SoC-based devices that can perform many of such tasks and consolidate a design to optimize. Article Title Published in Magazine/Website Name (http://www.zzz. two of the most important blocks – keyboard and LCD. and space. Of course one can have discrete modules which can do the job of printing. mechanical switches can be considered ancient as every user prefers a capacitive sensing interface due to higher reliability and their streamlined look.Figure 5: Block diagram of the ticket dispenser system In this diagram. Looking at the need for higher integration and system cost concerns. A graphic or segment LCD can be used as an output interface based upon the system requirement and cost constraints. Figure 6 shows one of the possible implementation of this system using PSoC3/5. cost. the use of capacitive sensing buttons drives down system cost as the sensors are nothing but traces on the PCB. rather than designing a system with discrete components and an independent MCU for each function. Today.

some mathematic calculations. so SoCs fit well. Due to higher CPU operating frequency requirements in such implementation. communicating with other host processors in the system. R&D cost is nothing but the expense in any product’s development cycle and everyone wants to cut it down as much as possible. LCD controllers. Based upon the requirements. they prove to be cost-effective as well. in a discrete based solution. hardware shift register.com) Page 5 of 7 Month 2010 . in ATM machines. What may change in each design are thermal printer’s specifications such as number of elements. PGA. execution of an algorithm to selectively control the thermal element excitation. The LCD glass needed to be driven may have different Article Title Published in Magazine/Website Name (http://www.zzz. As SoC integrate almost all the system hardware required. and time to market. it may fall short of IO pins based upon the number of keys required and number of commons/segments needed to be driven for the segment LCD glass. These SoCs have on-chip ADCs. dynamic power consumption is very high. and output user interface. dealing with changing product specifications. One of the most important aspects of any design in today’s competitive market is design reusability. DMA can also be used to write data to the shift register to be sent to the thermal head. it is hard to power down the peripherals which are not being used on the moment. Few things are common in all of these systems and those are a thermal printer driver unit with all of the associated circuitry to accomplish the task of printing. An implementation using DMA and hardware shift register/SPI. comparators. DACs. for example. etc. reliable printing temperature range. For motor control and generation of control signals. A thermal printer based system can be used in a restaurant. Any design architecture needs to be easy to incorporate small changes in the product specification without major changes in hardware or firmware. in a transport facility for dispensing tickets. DMA is one of the most important features in advanced SoCs. avoids having to impose overhead on the CPU to generate the bit stream as is required for a conventional microcontroller-based implementation. etc.Figure 6: SoC-based implementation of ticket dispenser High-end SoCs are capable of handling almost all of these tasks in a single chip. in SoC-based architectures. power consumption is a major consideration. The number of keys may change. For battery-operated devices.zzz. or a departmental store. Though SoCs have enough hardware resources on chip. No doubt. input user interface. more than a single chip may be needed. Also. maximum RPMs of motor. number of strobe signals. the CPU should run at a reasonably high frequency as compared to when most of these tasks are being handled in hardware. However. etc. every peripheral can be powered down individually. They offload CPU to do other tasks related to data manipulation. Let us take an example.

non-exclusive. CA 95134-1709 Phone: 408-943-2600 Fax: 408-943-4730 http://www. and power requirements. translation. non-transferable license to copy. another may not. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND.cypress. create derivative works of. or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. life support. WITH REGARD TO THIS MATERIAL.based system where most of the peripherals are programmable. critical control or safety applications. The information contained herein is subject to change without notice. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. use. Article Title Published in Magazine/Website Name (http://www. 2007. Furthermore. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign). All other trademarks or registered trademarks referenced herein are property of the respective corporations. Nor does it convey or imply any license under patent or other rights. Cypress reserves the right to make changes without further notice to the materials described herein. and PSoC Express™ are trademarks and PSoC® is a registered trademark of Cypress Semiconductor Corp. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. INCLUDING. unless pursuant to an express written agreement with Cypress. cost. If the same system is developed around discrete components.specifications in terms of number of segments and number of commons etc.com © Cypress Semiconductor Corporation. it may be challenge to look for another part which can do the job every time the requirements change. Also. Cypress products are not warranted nor intended to be used for medical. BUT NOT LIMITED TO. Any reproduction. EXPRESS OR IMPLIED. compilation. it is easy to incorporate these changes without spending much design time. modify. Programmable System-on-Chip™. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product.com) Page 6 of 7 Month 2010 . SoCs fit well to develop applications around thermal printer unit for today’s market meeting timing. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. life saving. In So. they enable the designers to enter in different market segments with only minor changes in their existing design. One system may need some mechanism for the blade. and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Cypress hereby grants to licensee a personal. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user.zzz.zzz. modification. Cypress Semiconductor 198 Champion Court San Jose. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. SoCs also allow frequent and fast changes in design to assist in customizing existing designs into altogether different applications. United States copyright laws and international treaty provisions. PSoC Designer™.

zzz. Article Title Published in Magazine/Website Name (http://www.Use may be limited by and subject to the applicable Cypress software license agreement.zzz.com) Page 7 of 7 Month 2010 .