Maybe you’ve used an HD4480-based LCD before (pictured) and you know that it requires a potentiometer for adjusting contrast. Is there a way to remove this potentiometer completely?
Why a Potentiometer?
The potentiometer acts as a voltage-divider for voltage levels to LCD pin V0 that will adjust the LCD screen’s contrast. There is no exact value given for that voltage (even the datasheets don’t give anything) but according to users, the voltage should be around 0.5 V. So we can just use fixed resistor voltage-dividers to provide that voltage, right?
Not So Fast
It turns out, it’s not that easy. The 0.5 V target voltage swings with temperature. When the temperature goes low, the display starts to disappear (low contrast) and when the temperature goes high, the screen starts to go black (high contrast). This justifies the use of the potentiometer: you can just adjust the contrast when temperature effects kick in.
In fact, this datasheet gives some circuit examples for temperature compensation. Here is one example circuit from the datasheet:
The circuit employs a thermistor that reads the environment temperature and adjusts the voltage towards V0 accordingly. There’s one problem though, Vz should be a negative voltage!
How About PWM
Since V0 needs a specific voltage for the right contrast, why not use PWM? Pulse width modulation can provide various voltage levels by varying its duty cycle.
I found this circuit in employing PWM for contrast adjust:
Using PWM, we can ditch the potentiometer for contrast adjustments. But how about the temperature variation problem?
I tried to combine temperature compensation and PWM control and this schematic is what I came up with:
The LM335 is a temperature sensor with a 110mV/C sensitivity. This sensor should be mounted to the LCD as close as possible.
But again, this schematic may need some adjustment for it to work on your project due to different characteristics of LCDs. I suggest you start with finding out what voltage to V0 is perfect for your LCD and adjust your PWM to that!