Using pwm to control LCD contrast

Hi, it's possible to use a pwm pin to control the lcd contrast without more stuff? can be directly wired?


can be directly wired?

How much current does it take, if the answer is over 30mA then no you need other stuff like a transistor.

Is a standard HD44780 will i need something?


The problem with getting a good answer is that there's some variation in how modules do contrast control: some do it with a 0-5V input, some have a contrast input that needs to be varied between 5V and some negative voltage.

It's possible that a module with a 0-5V range will have some filtering that would let you get away with just connecting the PWM, but I don't recall seeing any datasheets that specified that. Most likely, you'd need a simple RC network to smooth out the PWM to a fairly constant and ripple-free DC.

I would think all that is needed is a resistor. Why would he need a transistor?

I just connect mine to a pot. No need to try and tie it into a pin. The more you put on the screen the lower the contrast needs to be otherwise it starts to black out on you.

I have connected the contrast pin directly to a pwm pin and for the most part it worked. At some contrast level there was a slight flickering. Without knowing the current drawn or the timing of the pwm, I don't know what to work out exactly how to smooth out the PWM. I only had a couple of spare CAPs to try. I tried a 10uF 16V between the PWM pin and GND, made no difference. I tried a 470uF 25V between the PWM pin and GND and the flickering disapeared. Can anyone help me workout the correct way of smoothing out PWM voltage?