8 August 2011
Author: Giorgos LazaridisPWM LCD Contrast Adjustment
Most of you probably know the popular HD44780 character LCD controller from Hitachi. Usually you find it on LCD display boards with 16 pins. One of these pins is called "Contrast Adjustment" and does exactly this: It adjusts the LCD contrast. This pin requires a voltage level. If a microcontrollers has a Digital to Analog module, then this pin can be directly interfaced with this module. But the D/A module is not very common, instead, the PWM module is.
In such applications, the backlit is usually done with LEDs, so a simple PWM driver can directly adjust the brightness. Unfortunately, the PWM module cannot be directly used to adjust the contrast. So, i made a very simple and small circuit to interface the PWM output of a microcontroller to the contrast adjustment pin of an HD44780 Character LCD.
Here is the circuit schematic: (click to enlarge)
There is a red rectangle at the bottom right corner of the schematic. This is the interesting part. The rest of the circuit (the PIC along with the LCD) is only added to demonstrate the circuit operation. The PIC initializes the LCD and then sends a simple string to be displayed. The potentiometer R1 is used to generate a control voltage from 0 to 5 volts, and it is directly interfaced to an analog input of the PIC. The PIC then translates this control voltage into a binary number with the internal A/D module. Finally, it generates a PWM signal with a duty cycle from 0 to 100% according to the analog control value taken from the R1 potentiometer.
The PWM output from the PIC (RB3) is then driven to the interface circuit. This circuit is composed by a transistor amplifier (T1) and a low-pass filter R3/R4 - C1. This low pass filter will convert the PWM signal into a voltage level. This voltage level is higher when the PWM duty cycle is closer to 0%, and lower when the duty cycle is closer to 100%. This signal can be directly used for the contrast adjustment of the LCD.
The PIC Firmware
Bill Of Materials
Contact Forum Projects Experiments Circuits Theory BLOG PIC Tutorials Time for Science RSS
Site design: Giorgos Lazaridis
© Copyright 2008