Introduction: How to Make Static LCD Driver With I²C Interface
Liquid Crystal Displays (LCD) are widely used for commercial and industrial applications because of their good visual properties, low cost and, low power consumption. These properties make the LCD the standard solution for battery-operated devices, like portable instruments, calculators, watches, radios, etc.
However, to properly control what the LCD shows, the LCD’s electronic driver must generate appropriate voltage waveforms to LCD pins. The waveforms should be AC (alternate current) in nature because DC (direct current) voltages will permanently damage the device. The appropriate driver would source these signals to LCD at a minimum of power consumption.
Two types of LCDs exist, the Static, with only one backplane and one pin for individual segment control and, the Multiplexed, with multiple backplanes and multiple segments connected for each pin.
This Instructable will present the design of one static LCD driver with SLG46537V GreenPAK™ device. The designed LCD driver would drive up to 15 LCD’s segments, using a few microamperes of current from the power supply and offer an I²C interface for control.
In the following sections will be shown:
● basic knowledge information about LCDs;
● the SLG46537V GreenPAK LCD driver design in detail;
● how to drive a seven segment, 4-digit static LCD with two GreenPAK devices.
Below we described steps needed understand how the solution has been programmed to create the static LCD driver with I²C interface. However, if you just want to get the result of programming, download GreenPAK software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit program to create the the static LCD driver with I²C interface.
Step 1: Basics of Liquid Crystal Displays
Liquid Crystal Displays (LCD) is a technology that does not emit light, it only controls how an external light source passes through. This external light source could be the available ambient light, in the reflective display type, or the light from a backlight led or lamp, in transmissive display type. LCDs are constructed with two plates of glass (upper and bottom), a thin layer of liquid crystal (LC) between them and two light polarizers (Application Note AN-001 – Basics of LCD Technology, Hitachi, Application Note AN-005 – Display Modes, Hitachi).The polarizer is a light filter for the light electromagnetic field. Only the light components in the right electromagnetic field direction pass through the polarizer, while the other components are blocked.
The liquid crystal is an organic material that rotates the electromagnetic field of the light 90 degrees or more. However, when an electrical field is applied to the LC it does not rotate the light anymore. With the addition of transparent electrodes in the upper and bottom display glass, its possible to control when the light passes through, and when not, with an external source of the electrical field. Figure 1 (see Application Note AN-001 – Basics of LCD Technology, Hitachi) above illustrates this operation control. In Figure 1, the display is dark when there isn’t an electrical field. This is because both polarizers filter the light in the same direction. If the polarizers are orthogonal, then the display will be dark when the electrical field is present. This is the most common situation for reflective displays.
The minimum electrical field, or voltage, to control the LCD is called the ON threshold. The LC is only affected by the voltage, and there is hardly any current in LC material. The electrodes in LCD forms a small capacitance and this is the only load for a driver. This is the reason for an LCD being a low power device to show visual information.
However, its important to note that the LCD can’t operate with a direct current (DC) voltage source for too long. The application of a DC voltage will cause chemical reactions in LC material, permanently damaging it (Application Note AN-001 – Basics of LCD Technology, Hitachi). The solution is to apply an alternate voltage (AC) in LCDs electrodes.
In static LCDs, a backplane electrode is built in one glass and individual LCD’s segments, or pixels, are put in the other glass. This is one of the simplest LCD types and the one with the best contrast ratio. However, this type of display usually requires too many pins to control each individual segment.
In general, a driver controller sources a square wave clock signal for the backplane and a clock signal for the segments in the front plane together. When the backplane clock is in-phase with the segment clock, the root-mean-square (RMS) voltage between both planes is zero, and the segment is transparent. Otherwise, if the RMS voltage is higher than LCD ON threshold, the segment becomes dark. The waveforms for the backplane, on and off segment are shown in Figure 2. As can be seen in the figure, the ON segment is out-of-phase in relation to the backplane signal. The off segment is in-phase in relation to the backplane signal. The applied voltage could be between 3 and 5 volts for low cost, low power displays.
The clock signal for LCD’s backplane and segments usually are in the range of 30 to 100 Hz, the minimum frequency to avoid a visual flicker effect on LCD. Higher frequencies are avoided to reduce the power consumption of the overall system. The system composed of LCD and drivers would consume little current, in the order of microamperes. This makes them perfectly suitable for low power and battery power supply source applications.
In the following sections, the design of an LCD static driver with GreenPAK device that can generate the backplane clock signal and the individual segment clock signal for a commercial LCD is presented in detail.
Step 2: GreenPAK Design Basic Block Diagram
A block diagram that illustrates the GreenPAK design is shown in Figure 3. The basic blocks of the design are the I²C interface, the output segment driver, the internal oscillator, and the backplane clock source selector.
The I²C interface block controls each individual segment output and the backplane clock source of the LCD. The I²C interface block is the only system input for segment output control.
When the internal segment control line is set (high level) the respective LCD segment is dark opaque. When the internal segment control line is reset (low level) the respective LCD segment is transparent.
Each internal segment control line is connected to an output driver. The output segment driver block will generate an in-phase clock signal with relationship to the backplane clock for transparent segments. For dark segments, this signal is out of phase with relationship to backplane clock.
The backplane clock source is selected with I²C interface too. When the internal backplane clock source is selected, the internal oscillator is turned on. The internal oscillator will generate a clock frequency of 48Hz. This signal will be used by output segment driver block and is addressed to the backplane clock output pin (GreenPAK pin 20).
When external backplane clock source is selected, the internal oscillator is turned off. The output segment driver reference is the external backplane clock input (GreenPAK pin 2). In this case, the backplane clock output pin could be used as an additional segment control line, the segment OUT15.
More than one GreenPAK device could be used on the same I²C line. To do it, each device must be programmed with a different I²C address. In this way is possible to extend the number of LCD segments driven. One device is configured to generate the backplane clock source, driving 14 segments, and the others are configured to use an external backplane clock source. Each additional device could drive more 15 segments in this way. It is possible to connect up to 16 devices on the same I²C line and then is possible to control up to 239 segments of an LCD.
In this Instructable, this idea is used to control 29 segments of an LCD with 2 GreenPAK devices. The device pinout functionality is summarized in Table 1.
Step 3: Design Current Consumption
An important concern in this design is the current consumption, that should be as low as possible. The GreenPAK device estimated quiescent current is 0.75 µA for 3.3 V supply operation and 1.12 µA for 5 V supply operation. The current consumption of the internal oscillator is 7.6 µA and 8.68 µA for 3.3 V and 5 V power supply operation respectively. It is not expected to have a significant increase in current consumption from switching losses, because this design operates at a low clock frequency. The estimated maximum current consumed for this design is lower than 15 µA when the internal oscillator is on, and 10 µA when the internal oscillator is off. The measured current consumed in both situations is shown in Section Test Results.
Step 4: GreenPAK Device Schematic
The project designed in GreenPAK software is shown in Figure 4. This schematic will be described using the basic blocks diagrams as the reference.
Step 5: I²C Interface
I²C interface block is used as the main control block of the device operation control. A close view to the block connections and configured properties are shown in Figure 5.
This block is connected to PIN 8 and PIN 9, that are I²C SCL and SDA pins respectively. Inside the device, the I²C block offers 8 Virtual Inputs. The initial value for each Virtual Input is shown in the properties window (see Figure 5). Virtual inputs from OUT0 until OUT6 are used as segment control lines. These control lines correspond to segment output 1 to segment output 7 and are connected to the segment output driver. Virtual Input OUT7 is used as backplane clock source selector line control, with net name BCKP_SOURCE. This net will be used by other blocks in the design. The I²C control code is configured with a different value for each IC in the project.
8 more internal segment control lines are available in the Asynchronous State Machine (ASM) output, as shown in Figure 6 above. Segment output line 8 (SEG_OUT_8 in properties window) through segment output line 15 (SEG_OUT_15) are controlled by ASM output on state 0. There isn’t any state transition in ASM block, it is always in state 0. The outputs of ASM are connected to segment output drivers.
The segment output drivers will generate the output signal of the device.
Step 6: Output Segment Driver
The output segment driver is essentially a Lookup table (LUT) configured as an XOR logic port. For each output segment, it must be an XOR port connected to segment control line and to backplane clock (BCKP_CLOCK). The XOR port is responsible to generate the in-phase and out-of-phase signal to output segment. When the segment control line is at a high level, the XOR port output will invert the backplane clock signal and generate an out-of-phase signal to segment pin. The voltage difference between LCD backplane and LCD segment, in this case, will set the LCD segment as a dark segment. When the segment control line is at a low level, the XOR port output will follow the backplane clock signal and then generate an in-phase signal to segment pin. Because no voltage is applied between the LCD backplane and segment in this case, the segment is transparent to light.
Step 7: Internal Oscillator and Backplane Clock Source Control
The internal oscillator is used when the signal BCKP_CLOCK from I²C interface is set to a high level. A close view of the clock source control diagram is shown in Figure 7 above.
The oscillator is configured as 25 kHz RC frequency, with the highest output divisor available at oscillator OUT0 (8/64). The entire configuration is seen in the properties window shown in Figure 7. In this way, the internal oscillator will generate a clock frequency of 48 Hz.
The oscillator is active only when BCKP_SOURCE signal is at a high level together with POR signal. This control is done by connecting these two signals to the NAND port of the 4-L1 LUT. The output of the NAND is then connected to the input of the oscillator power down control pin.
Signal BCKP_SOURCE controls the MUX built with 3-L10 LUT. When BCKP_SOURCE signal is at a low level, the backplane clock source comes from PIN2. When this signal is at a high level the backplane clock source comes from the internal oscillator.
Step 8: Backplane Clock Output or Segment 15 Output Pin Control
Pin 20 in this design has a double function, which depends on the selected backplane clock source. The operation of this pin is controlled with one 4 input LUT, as shown in Figure 8. With a 4-bit LUT, it is possible to associate the operation of XOR port with an output MUX. When the BCKP_SOURCE signal is at a high level, the LUT output will follow the internal oscillator clock. Then pin 20 operates as a backplane clock output. When BCKP_SOURCE signal is at a low level, the LUT output will be the XOR operation between SEG_OUT_15, from ASM output, and backplane clock signal. The 4-bit LUT configuration to do this operation is shown in Figure 8.
Step 9: LCD System Prototype
To demonstrate the use of the GreenPAK design solution, an LCD system prototype was assembled on a breadboard. For the prototype, a seven segment, 4-digit static LCD is driven by two GreenPAK devices on DIP board. One device (IC1) uses the internal oscillator to drive LCD backplane, and the other device (IC2) uses this signal as backplane input reference. Both ICs are controlled over I²C interface by an STM32F103C8T6 microcontroller (MCU) in a minimum development board.
Figure 9 shows the schematic of the connections between the two GreenPAK ICs, the LCD display, and the MCU board. In the schematic, the GreenPAK device with U1 (IC1) reference drives LCD digit one and two (LCD left side). The GreenPAK device with U2 (IC2) reference drives LCD digit three and four, plus the COL segment (LCD right side). The power supply for both devices comes from the regulator in the microcontroller development board. Two removable jumpers between the power supply and VDD pins of each GreenPAK device are added for current measurement with a multimeter.
A picture of the assembled prototype is shown in Figure 10.
Step 10: I²C Commands for LCD Control
The two GreenPAK devices on the breadboard are programmed with the same design, except by the Control Byte value. The control byte of IC1 is 0 (I²C address 0x00), while the I²C control byte is 1 (I²C address 0x10). The connections between display segments and device drivers are summarized in the table above.
The connections were selected in this way to create a clearer schematic and to simplify assembling the breadboard connections.
The control of the segment’s output is done by I²C write commands to I²C Virtual Inputs and ASM output registers. As described in the application note AN-1090 Simple I²C IO Controllers with SLG46531V (see Application Note AN-1090 Simple I²C IO Controllers with SLG46531V, Dialog Semiconductor), the I²C write command is structured as follows:
● Control byte (R/W bit is 0);
● Word address;
All the I²C write commands are made to Word Address 0xF4 (I²C Virtual Inputs) and 0xD0 (ASM Output for state 0). The commands to write in IC1 and control LCD digit 1 and 2 are summarized in Table 3. In the command sequence representation, the open bracket “[“denotes the Start signal, and the close bracket “]” denotes the Stop signal.
The two bytes above control segments of LCD digit 1 and digit 2 together. Here, the approach is to use an individual lookup table (LUT) in software for each digit, considering the segments in both bytes. The byte values from lookup table should be mixed using a bitwise OR operation, and then send to the IC. The Table 4 shown the Byte0 and Byte1 value for each numeric value that should be written in each display digit.
For example, to write in the Digit 1 the number 3, and in the Digit 2 the number 4, Byte0 is 0xBD (0x8D bitwise OR with 0xB0) and Byte 1 is 0x33 (0x30 bitwise OR with 0x03).
The command to write in IC2 and controls Digit 3 and 4, are described in Table 5.
The control logic of digits 3 and 4 are like the control of digits 1 and 2. Table 6 shows the LUT for these two digits.
The difference in IC2 is the COL segment. This segment is controlled by Byte1. To set up this segment dark, a bitwise OR operation between the Byte1 and the value 0x40 should be done.
Step 11: I²C Commands for LCD Test
For LCD test a firmware was developed in C language for the MCU board. This firmware will send a sequence of commands to both ICs on the breadboard. The source code for this firmware is in the Appendix section. The entire solution was developed using Atollic TrueStudio for STM32 9.0.1 IDE.
The sequence of commands and the respective values shown in the display are summarized in Table 7 above.
Step 12: Test Results
The prototype test consists of verifying the display values after an MCU command and measuring the current sink by each IC during operation.
Pictures of the LCD for each command value are shown in Table 8 above.
The current sink for each device was measured with a multimeter, in its lowest current range of 200 µA. Pictures of the measured current for each device, during start-up and normal operation, are shown in Table 9 above.
Conclusion and Results Discussion
The design of a low power static LCD driver with GreenPAK device was presented. This design clearly shows one of the greatest features of the GreenPAK devices: their low quiescent current. Because GreenPAK devices are a hardware-based solution, it is possible to work at a low-frequency operation, in this case, 48 Hz. An MCU based solution will require a higher operation frequency, even for periodically short periods of time, and then will draw more power. And, comparing GreenPAK device with a CPLD (Complex Programmable Logic Device), it is clear to see that usually a CPLD has a quiescent current higher than 20 µA.
It is interesting to note that this design could be easily modified for a better fit in the requirements of a specific project. A good example is the segment controls pinout. They could easily be changed to simplify the printed circuit board and the software development at the same time. This is an interesting feature when the device is compared with an off-the-shelf ASIC (Application Specific Integrated Circuit). Usually, ASICs are designed to fit on a broad range of applications, and an initial software routine should be written to properly configure the IC before the operation. A configurable device could be designed to start ready to use after power up. In this way, it’s possible to cut the software development time for IC initial configuration.
Source code to the application can be found here in Appendix A.