Go Down

### Topic: How to control the display's backlight in the sketch? (Read 10665 times)previous topic - next topic

#### Grumpy_Mike

#30
##### Oct 07, 2012, 08:29 pm
Quote
Then, I used a led resistor calculator (the parallel calculator, since I suppose the LEDs of my display are mounted parallel)... which tell me that I need a resistor of 1 Ohm (AKA: I don't even need a resistor), when the input voltage is the same as the forward voltage of the LED, and doesn't matter how much current I enter as the "desired LED current".

Because these calculators are very simple minded and do not take into account extremes like you have in that situation.
As well as considering the average current then you have to consider the peak current. This is the maximum instantaneous current that will flow in any given situation. With PWM this peak voltage is 5V no matter what the duty cycle gives you. Therefore you have what 5V will drive through the LED.
This will be limited by the impedance of your source, in this case the arduino pin. However remember that the data sheet says the absolute limit you should draw from a pin is 40mA. Anything at this level or over this level will damage your pin. You might not see that damage immediately or even in a month or two but the circuit around that pin will die sooner than it otherwise would.
In my tests with an arduino I have found that you can get 250mA peak current from an arduino pin, more than enough to damage it and possibly damage any LED connected to it.

Now you can totally ignore the data sheets and do what you want and your individual device may or may not fail immediately, maybe next month, next year or never. But if you take a large number of devices abused in this way some will fail quite soon. Damage is cumulative and the impedance of the output will gradually increase, maybe too slow for you to notice it without making measurements but it will occur.

On the other hand you might think we are all in a conspiracy to make you spend an extra \$0.01 on a resistor, funded by the resistor manufacturers. If so I want my cut now from all the unnecessary resistors I have encouraged beginners to use. On the other hand have you noticed that only beginners as this sort of question?

#### guix

#31
##### Oct 07, 2012, 08:49 pmLast Edit: Oct 07, 2012, 08:59 pm by guix Reason: 1
But you don't get it, it's not the problem of buying a resistor or not... I was just wondering "If PWM output is set to 66%, as if it was outputting 3.3v, why add a resistor, since it will drop voltage even more so the LEDs won't be at full brightness?"... But now (after re-reading entirely this topic) I think I understood

I will do what dhenry said in his last post, and use PWM's max value instead of trying to limit it.

Thank you

#### floresta

#32
##### Oct 08, 2012, 04:11 am
Quote
since it will drop voltage even more so the LEDs won't be at full brightness?

It just doesn't work that way.  The brightness of an LED depends on it's current.  Similarly, the voltage across an LED also depends on it's current, but not linearly as with a resistor.  You must start by considering the LED current, not the voltage.

Quote
I will do what dhenry said in his last post, and use PWM's max value instead of trying to limit it.

Think of it this way, this technique also protects things in case the PWM output goes to 100% because of an error in the programming.

Don

#### psteve

#33
##### Oct 17, 2012, 01:23 pm
I've used 2 diodes 1n4007 insthead the resistor ( series ) and it works great.

I can set pwm beetween tree values = 0 (off) 128 (it doesn't give much light but readable) 255 (max).

The current consumption respectively 86-105-118 mA.

I hope this help

Steve

#### dhenry

#34
##### Oct 17, 2012, 01:28 pm
Quote
the voltage across an LED also depends on it's current, but not linearly as with a resistor.

When you have some time, try to plot a LED's V-I curve.  You will be surprised. Particularly for high power LEDs.

#### floresta

#35
##### Oct 17, 2012, 03:59 pm
Quote
I've used 2 diodes 1n4007 insthead the resistor ( series ) and it works great.

You don't understand the problem.  This is a different way of reducing the maximum voltage applied to the backlight.  The problem is that it is the current rating of the diode that we don't want to exceed.

Once again:
if you to try to design a circuit to drive an LED with some specific voltage you are doomed to failure.

Don

#### psteve

#36
##### Oct 17, 2012, 04:48 pm
Hi Don,

I'dont try to design a circuit to drive an LED with some specific voltage, my problem was turn off light (and mA needed).

in sainsmart shield with 2 diodes is solved.

Steve

#### dhenry

#37
##### Oct 17, 2012, 04:59 pm
Quote
Once again: if you to try to design a circuit to drive an LED with some specific voltage you are doomed to failure.

The story is actually far more complicated than that.

Some data:

For 1n4001 (Vishay, diode), If = 20ma @ Vfwd = 0.65v; If = 50ma @ Vfwd = 0.7v (delta Vfwd = 50mv); dynamic Rd = 50mv / 30ma = 1.6ohm.
For CLA1B (Cree, LED), If = 20ma @ Vfwd = 3.05v; If = 22ma @ Vfwd = 3.10v (delta Vfwd = 50mv); dynamic Rd = 50mv / 2ma = 25ohm.

For the same change in Vfwd, the led's If increased much less than a diode's.

Contrary to conventional "wisdom", high power LEDs behave far more like a resistor than a diode.

#### guix

#38
##### Oct 17, 2012, 05:18 pmLast Edit: Oct 17, 2012, 05:30 pm by guix Reason: 1

The current consumption respectively 86-105-118 mA.

How is that possible, if the PWM pin should not "give" more than 25mA ? And with LEDs OFF, it still use 86mA current? What I don't understand here... can you explain?

Thanks

#### floresta

#39
##### Oct 17, 2012, 05:27 pm
Quote
Contrary to conventional "wisdom", high power LEDs behave far more like a resistor than a diode.

Is that what we are talking about here?  I associate 'high power' LEDs with those that are becoming available to replace household incandescent bulbs etc.  The LEDs being used in flat screen TVs could well fit into this category as well.

I would think that any LED backlight that is being driven by an output pin of the Arduino would be classified as low power, and it would behave much like any diode, not like a resistor.

Don

#### floresta

#40
##### Oct 17, 2012, 05:30 pm
Quote
I've used 2 diodes 1n4007 insthead the resistor ( series ) and it works great.

I see people regularly drive over 70 mph in 55 mph zones.  It seems to be working great for them as well (so far).

Don

#### dhenry

#41
##### Oct 17, 2012, 05:34 pm
Quote
Is that what we are talking about here?

I ran the data at 20ma If.

Quote
I would think that any LED backlight that is being driven by an output pin of the Arduino would be classified as low power, and it would behave much like any diode, not like a resistor.

Pick any such leds and show your data and we can have a chat.

#### dhenry

#42
##### Oct 17, 2012, 05:41 pm
Save you some time:

VLMx1300 (red, Vishay, LED), If = 20ma @ Vfwd = 1.95v; If = 30ma @ Vfwd = 2.0v (delta Vfwd = 50mv). delta Rd = 50mv / 10ma = 5ohm.

higher Rd for organge (50mv / 5ma) and lower for green.

None of this factors in the output resistance of the avr's (30 - 50ohm for example).

#### floresta

#43
##### Oct 17, 2012, 11:03 pm
I may be mistaken but it appears to me that you are giving support to those who think that the LEDs that they are using with their Arduinos have a voltage rating (like a light bulb), and if they apply this voltage to their LED it will work properly.

Myself and other contributors such as Grumpy Mike and Liudr have, for several years, been giving advice on why this reasoning is incorrect an why they always need current limiting, usually in the form of a series current limiting resistor, when driving an LED.

Keep in mind that the target audience for the Arduino is not someone with an Engineering background and frequently not even someone with the slightest interest in electronics or microcontrollers.  They are not concerned with the output resistance of an avr etc. and statements such as "For the same change in Vfwd, the led's If increased much less than a diode's" might just as well be written in Zorkonian.  They are, however, interested in getting their LED to light up without damaging either the LED or their Arduino.

The bottom line is one can mess around with PWM, diodes, or some combination, but one should still use a series current limiting resistor with their LED.

Don

#### dhenry

#44
##### Oct 17, 2012, 11:24 pm
Quote
Myself and other contributors such as Grumpy Mike and Liudr have, for several years, been giving advice on why this reasoning is incorrect an why they always need current limiting, usually in the form of a series current limiting resistor, when driving an LED.

The length an advice has been given should be in no way shape or form supporting evidence for such advice's validity. Or we would still be living in dark ages thinking that the sun evolves around the earth.

Quote
Keep in mind that the target audience for the Arduino is not someone with an Engineering background...

Just because you think someone is "incapable" of understanding the truth doesn't justify your feeding them falsehood. You  just need to figure out better ways to communicate the truth to them.

and I don't for a second buy the argument that the arduino community is 2nd rate when it comes to understanding electronics.

Quote
The bottom line is one can mess around with PWM, diodes, or some combination, but one should still use a series current limiting resistor with their LED.

The bottom line is that the laws of physics are the laws of physics, regardless of how long someone has been perpetuating anything to the contrary.

Go Up

Please enter a valid email to subscribe