Go Down

Topic: Set LCD brightness from code? (Read 53826 times) previous topic - next topic

Paul__B


It's been working fine for several days but on reading this I'm now worried I'm going to fry something unless I use a transistor. What would happen if the LCD drew too much current?


So, get your multimeter and connect just the LED - pins 15 and 16 - to 5V with the meter in series set on 10 amp scale (200 mA may not work) to 5V and find out!

ArduinJoe

@raschemmel

Thanks for the code - that's almost exactly what I'm doing already; reading the value from a photo resistor, dividing by four, and controlling the brightness of the back light on a scale of 0 to 255.

I haven't compensated for sudden changes in ambient light levels, which does seem like a good idea. But think I might tackle that with code rather than electronics (you lost me somewhere between 'resistor pullup' and 'decoupling cap'!). I'm doing a similar thing with two temperature sensors on the same project - sampling a value from each every second then displaying an average of those ten values. Of course that means it takes ten seconds after boot up to give a correct reading, but the readings seem quite accurate and stable thereafter.

@Paul__B

I just put my multimeter in series with the power to the LCD backlight and it's reading 8ma at full brightness, 4ma at half. So I guess if 20ma is the upper limit I'll be totally fine without adding a transistor. I have a 330ohm resistor protecting the backlight - sounds like I could drop that value a little and get a bit more brightness?

Paul__B


I just put my multimeter in series with the power to the LCD backlight and it's reading 8ma at full brightness, 4ma at half. So I guess if 20ma is the upper limit I'll be totally fine without adding a transistor. I have a 330ohm resistor protecting the backlight - sounds like I could drop that value a little and get a bit more brightness?


I am somewhat troubled by your reference to "half brightness".  If you are gong to test this, you need to do it without your control circuit (or connection to Arduino pin), because even the meter itself introduces extra resistance into the circuit and you want to know the maximum that might be drawn.  For the same reason you need to try it on the 10 amp meter setting (in addition to the 200 mA) just to see that the meter resistance is not giving you an erroneous estimate.

Most displays already have a current limiting resistor, so you need to inspect yours to see what it is.  On a 2016 it is generally "R8" but I do not have a 2004 here.  Once you verify that there is such a resistor, generally 100 ohms ("101" marking), you make the test without any other current limit and make your conclusions from there.  A 330 ohm resistor will by definition limit the current  to less than 15 mA and you certainly can use that method (down to 120 ohm) to make it safe to control directly from an Arduino pin, but you are clearly sacrificing brightness by doing so.

ArduinJoe

Thanks, Paul - this is all very useful learning.

So if I understand you correctly, to get a true sense of max. current drawn by the backlight I should connect it directly to 5v without my 330ohm resistor and set my meter to measure a 10A range?

Go Up