The backlights used in some LCD panels are not exactly economical: typical current draws of 20 mA to 100 mA are common. Normally the current is determined by a series resistor, which leads to additional power losses. It is considerably more efficient, if a little more complex, to use a switching regulator IC. Alternatively, it is often the case that driving the LCD panel is a microcontroller, which we can press into service to provide regulation in software. Fortunately, the regulation does not need to be exceptionally precise. At the heart of our circuit is T1, a pchannel MOSFET, which is driven by an inverted (active low) pulsewidth modulated signal from the microcontroller. Components D1, L1 and C1 form the remainder of the standard step-down switching regulator configuration. In the circuit diagram the LCD backlight is represented by two LEDs; the current flowing through these LEDs is measured by a shunt resistor, filtered, and finally amplified to a level suitable for input to the A/D converter in the microcontroller using an operational amplifier. R1 ensures that the transistor switches off completely when the microcontroller is reset (at which time all ports become inputs).
The circuit can be used with any microcontroller that can generate an inverted PWM signal at a frequency in the range 10 kHz to 100 kHz. We have developed a demonstration program and code module for the Atmel ATmega32 using GNU C. The source code can be downloaded from the Elektor website at http://www.elektor.com or from the author’s site at http://reweb.fh-weingarten. de/elektor.
The program generates the PWM signal at 31.25 kHz (if the processor clock is 8 MHz) on the OC2 output (PD2) of the ATmega32 microcontroller. The pulse width can be adjusted in 256 steps. If the gain of the operational amplifier is 25.5 a current of 100 mA through the LEDs will correspond to a voltage of 2.55 V at the input to the A/D converter. The internal reference voltage of the ATmega32 is nominally 2.56 V, and so an LED current of 100 mA will lead to a ten-bit conversion result of 03FFh. It is sufficient to monitor only the top eight bits of this value, and depending on the error from the desired value, increment or decrement the pulse width of the PWM signal. This forms an integral controller. As it stands, this solution cannot compete on simplicity with a series resistor. However, we can make some simplifi cations to the circuit by eliminating the regulation feedback loop. Dispense with the operational amplifi er and surrounding circuitry, and have the software output a fi xed PWM signal. This loses the ability of the circuit to compensate for part-to-part variation in the components and for temperature, but in practice such compensation is rarely necessary. The software also supports the simplifi ed version of the circuit.