Hi I have a 20x4 LCD hooked up to my Arduino and it is running perfect, however I find it annoying that I have to open my closed box in order to change the LCD brightness via the variable resistor. Is it possible to control the LCD brightness via a PWM signal rather than 5v + variable resistor.
Sure, just connect the PWM signal to the base of a transistor (BJT or MOSFET) and put that on the cathode terminal of the backlight. The duty cycle of your PWM signal will control the brightness. Use a 470 series resistor from the PWM signal to the base of the transistor (ballpark value), and be prepared to experiment ![]()
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons
Ahh sorry I was writing brightness - but I meant contrast..
I'm assuming your contrast potentiometer is going between 5V and 0V? In that case it's very similar: PWM filtered by an RC filter and connected to the contrast pin. The resistor should be between 1k-10k. I'd start with 10k and a 1uF capacitor to start experimenting.
--
The Arduino Drum Machine: 14-track MIDI drum machine sequencer / groove-box
Yes you're absolutely right. I'll try it out, would be really nice to be able to control the contrast from the arduino. ![]()
How did you manage to adjust the contrast with PWM?
Cheers,
Kari
Normally when contrast is set, it should stay set and not to be changed like you described. Maybe you don't need adjustment. So a little more details on what you are doing? PWM on my displays always creates some sort of flicker so I don't use PWM. Maybe it's just my eyes.
How about simple RC filter?
Kari
GaryP:
How about simple RC filter?Kari
How do you make an RC filter? (I am a novice). I'm also controlling contrast with PWN and get the flicker :~
brendanwilding:
GaryP:
How about simple RC filter?Kari
How do you make an RC filter? (I am a novice). I'm also controlling contrast with PWN and get the flicker :~
Simply put, you're doing something wrong. The contrast needs no adjustment once properly set. Why do you need to adjust it in the first place? What potentiometer value are you using or are you using no potentiometers?
you say your useing a pot now, how about use 2 buttons on the outside of the case and use a digital pot like this
Could the OP please change the topic to reflect what's going on, like "LCD contrast via PWM"? Thanks.
Can any supply the schematic for the filter if we were to use the PWM?
Look at this page:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html
Firstly thanks all for the help on this issue.
liudr:
brendanwilding:
GaryP:
How about simple RC filter?Kari
How do you make an RC filter? (I am a novice). I'm also controlling contrast with PWN and get the flicker :~
Simply put, you're doing something wrong. The contrast needs no adjustment once properly set. Why do you need to adjust it in the first place? What potentiometer value are you using or are you using no potentiometers?
Your probably right it does not need adjusting once correctly set so a resistor or pot would suffice. I intend on using the LCD is varied light environments and power sources so it would be convenient to change the contrast and brightness via PWM (a pot would also do but is less cool!).
Grumpy_Mike:
Look at this page:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html
Thank you for this! Along with this tool (http://sim.okawa-denshi.jp/en/CRtool.php) its easy to make an RC filter. I used your suggested 47uf capacitor and 1k resistor to make mine and the results are good:
No RC-Filter
+RC-Filter
And images
By brenwildaust at 2011-06-12
By brenwildaust at 2011-06-12
Thanks again
- Let's trim off the excess lead on the soldered pins. They look almost touching on another at places.
- Back light is really bright. What resistor did you use?
I find my blue display with white letters sluggish and impossible to read without back light I wonder if it's the same with yours. I typically go with green or yellow display with black letters now.
