I wanted to try and get my LCD contrast to automatically adjust based on ambient temperature.
I figured I could use one of the PWM pins to do this.
But my LCD, a Newhaven 128x64 LCD has a negative voltage for the contrast pin. (the datasheet says about -3v and in the example shows it driven by a potentiometer off a -5v pin labeled Vee.)
my LCD model is NHD-12864WG-FTGH-VZ
Could this be done with a small n-channel mosfet and a voltage divider between +5 and -5?
Or is there a better way to achieve what I'm after?
How do you turn the mosfet off?
Why not having a pot knob for the user to adjust?
The mosfet will be controlled by a PWM pin to adjust the voltage. pulsing the mosfet will pull the voltage closer to gnd. leaving the mosfet off, it will drift down to -5v. I mistakenly labeled it an N-channel.. but maybe it should be a P-channel since it's controlling the high side..
The reason to do it automatically, reduce the cost of a pot and all the mechanics to mount/wire it. it's less than a dollar in parts and can all be soldered in place. No panel holes required, no knob, etc.
also, how many professional product do you know has an LCD adjust knob? Most do it in software somehow..
My understanding is that if you wish to turn off a MOSFET, you reduce gate-to-source voltage below threshold. In your setup, setting gate to 0V will not likely reduce that voltage below threshold so will not turn off the MOSFET.
also, how many professional product do you know has an LCD adjust knob? Most do it in software somehow..
Depending on how old you are, you may or may not have seen the knobs. In case you haven't, you should look into older laptops, 486 or older. They all had at least one knob for contrast or two for brightness and contrast.
I'll concede in the old days, everything had knobs... and knobs to control knobs!. But in the last 10+ years, those knobs all but disappeared, and the products became more user friendly and 'smart'.. If it still had an adjustment, it was one of those "Fn" + "F5" to decrease or "Fn" + "F6" to increase, etc... Why put 10 buttons if most of the needed functions can be dealt with in short menus with only 4 buttons? Move the 3 highest priority items up to the main menu with just one button to get a menu the less-used items.
As for the mosfet, I thought with a high-side mosfet, you had to be close to the upper voltage to turn on, so that it should have worked.
what if I moved it to the middle of the voltage divider and then used a low-side mosfet?
I'll read up on "high-side MOSFET". I didn't know the term. Yes, software contrast control saves knobs. Just make sure the software is well written.
The avr pins can deliver substantial amount of current (20ma in spec and more if you go out of spec), far more than those contrast control pins typically draw so you don't need that mosfet. Just connect the resistor to a pwm pin and you are done.
Your solution presumes the existence of that -5v. If it doesn't exist, you can generate it via a few diodes + capacitors + a flipping pin.
If you need more current, you can use a high-side switch - a p-channel mosfet or a pnp.
dhenry:
The avr pins can deliver substantial amount of current (20ma in spec and more if you go out of spec)
40mA per pin, 200mA per chip for ATMEGA32-PU