2024-01-04 12:49 PM - edited 2024-01-04 01:57 PM
Hello, all, and Happy New Year.
I'd like to control the contrast and backlight for an 4x20 LCD display (like the NHD-0420AZ-FL-GBW-33V3) using the programming in the micro-controller, in my case, a STM32L010K4Tx. For instance, I want to control the contrast through a user dialog, or use the backlight to 'flash' the display to call attention to it.
The datasheet of the display's contrast pin just states, "Supply Voltage for Contrast (approx. 0V)". A reference schematic just shows it connected to the wiper of a 10-20K pot connected at the ends to GND and VDD. For the backlight, the current is typically 15 mA at a voltage of 2.8-3.3v.
I think that I could implement micro-controller control using PWM output pins, but I suspect that I'll need some sort of low-pass filtering, to smooth out the pulses, and probably current buffering, with a transistor or MOSFET, to deliver more current than the controller can sink or source.
Has anyone done this type of thing before, and can point me to some datasheets or reference schematics that can get me started on this task?
Thanks so much for your advice and guidance.
-Kevin
Solved! Go to Solution.
2024-01-05 11:33 PM
From my experience with LCD test displays:
Contrast may be controlled by PWM output with RC filter. Use <= 1k series resistor and 1..10 u capacitor, set the output as open drain, duty should be quite low - between 0 and 1/10; frequency >= 1 kHz.
For manual regulation you don't really need a potentiomenter between Vcc and GND - just a variable resistor connected between GND and contrast control input.
2024-01-04 01:59 PM - edited 2024-01-04 02:12 PM
The contrast pin of the LCD expects a voltage, you would need a circuit such as an RC-type low pass filter to convert the PWM signal to a voltage. I doubt you need any current buffering for that, likely there is very little current there.
For the LED backlight, I would expect that you could directly drive that with an I/O pin, and use PWM if you want to control the brightness. (Although 15 mA is the maximum current, may want to use a transistor for this, as you mentioned).
2024-01-05 08:34 AM
Hello,
For the backlight it's not mandatory to use a low pass filter. You can just drive it directly with PWM by taking into account the current to drive the backlight.
For the contrast, measure the current that flows over the 10-20K pot (which is a voltage divider) to the LCD input . Your measurement can tell you if you should add buffering or not. I think better to add low pass filter in PWM output for contrast control.
2024-01-05 03:10 PM
If a 10-20k pot is fine as a voltage divider, then obviously MCU output doesn't need additional buffering.
2024-01-05 11:33 PM
From my experience with LCD test displays:
Contrast may be controlled by PWM output with RC filter. Use <= 1k series resistor and 1..10 u capacitor, set the output as open drain, duty should be quite low - between 0 and 1/10; frequency >= 1 kHz.
For manual regulation you don't really need a potentiomenter between Vcc and GND - just a variable resistor connected between GND and contrast control input.
2024-01-06 06:59 AM - edited 2024-01-06 07:00 AM