EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: tehtehteh on January 05, 2017, 04:08:27 pm

Title: LED current explained
Post by: tehtehteh on January 05, 2017, 04:08:27 pm
hello

I understand ohms law, and I understand how to calculate the resistor for an LED, but there is something I can't find an explanation for no matter how hard I search

say I have a 5v microcontroller that supports 20mA output, I would put a 250ohm resistor on the output pin to control a mosfet or something, but say I want an LED directly on that pin, that would only require 100ohms to limit it to 20mA

so like where is the rest of the resistance coming from? does the LED make up the rest? I thought they were supposed to have virtually no resistance hence them needing a series resistor in the first place
Title: Re: LED current explained
Post by: MK14 on January 05, 2017, 04:16:08 pm
The LED has a voltage drop across it. E.g. it could be 2 volts across the LED.
It is not an exact value, because it varies between different LEDs of identical types.
It also varies a bit with colour, current level and specific LED.

So 5 volts minus the 2 volts (varies), only leaves 3 volts across the current limiting resistor.

It is similar to a normal diode, so the voltage does not vary too much with differing currents.

Best to refer to the datasheet of the part(s) you are using, to get more information about the forward voltage drop of LEDs.
Title: Re: LED current explained
Post by: Len on January 05, 2017, 05:31:12 pm
so like where is the rest of the resistance coming from?

The thing is, a diode does not act like a resistor. Below its forward voltage it passes virtually no current. Above its forward voltage it conducts almost like a short circuit, but it always has that forward voltage drop.

So you don’t use Ohm's law with a diode (or LED). For an approximation, you take the LED's "typical" forward voltage and just say that is the voltage across it. It's almost constant.

Example of an LED with a current-limiting resistor in series: If you have 5V supply and the LED's forward voltage is 1.8V, that leaves 3.2V across the resistor. If you want 20mA of current, Ohm's law says the resistor should be 160 ohms.
Title: Re: LED current explained
Post by: shteii01 on January 06, 2017, 02:05:29 am
I understand how to calculate the resistor for an LED
Not true.
Title: Re: LED current explained
Post by: Brumby on January 06, 2017, 02:15:12 am
say I have a 5v microcontroller that supports 20mA output ...... but say I want an LED directly on that pin, that would only require 100ohms to limit it to 20mA

I have to ask - How did you get the value of 100 ohms?
Title: Re: LED current explained
Post by: pitagoras on January 06, 2017, 02:26:50 am

You need to calculate the led drop voltage.
Vout - Vled = 5V-2V = 3V.
So what is the voltage if you measure on the resistor terminals? (do it) should be near 3V
Which resistor you need for 20ma current over 3V?
150R.

100R would not make 20ma unless diode drop is 3V.
I know no led of 3V drop voltage. White/blue are ~3.5V, the rest are ~2V
 
Title: Re: LED current explained
Post by: ebclr on January 06, 2017, 02:27:48 am
That is the basic equation to use

I = ( Vdd - Vled ) / R


(http://talkingelectronics.com/projects/30%20LED%20Projects/images/LED-Colour.gif)
Title: Re: LED current explained
Post by: Brumby on January 06, 2017, 02:34:58 am
so like where is the rest of the resistance coming from? does the LED make up the rest? I thought they were supposed to have virtually no resistance hence them needing a series resistor in the first place

This is the best response so far:
1. The thing is, a diode does not act like a resistor.
2. Below its forward voltage it passes virtually no current.
3. Above its forward voltage it conducts almost like a short circuit, but it always has that forward voltage drop.

So you don’t use Ohm's law with a diode (or LED).
:-+

Quote
For an approximation, you take the LED's "typical" forward voltage and just say that is the voltage across it. It's almost constant.
It can get a little more complicated if you start getting into Vf verses current - but for the sake of basic calculations, this is quite good enough.


This is a textbook example of the basic calculation for a current limiting resistor:
Quote

Example of an LED with a current-limiting resistor in series: If you have 5V supply and the LED's forward voltage is 1.8V, that leaves 3.2V across the resistor. If you want 20mA of current, Ohm's law says the resistor should be 160 ohms.


You can also calculate the power dissipated through the LED, by using the voltage drop across the LED and the current flowing through it.  While you might think AHA! This is looking like a resistor! - don't be fooled.  Yes, the power dissipation from the LED will be the same as a resistor with the same voltage and current, but that is for those specific values.  If you change something, then they each respond differently.  The resistor will do so in a linear fashion - the LED will not.
Title: Re: LED current explained
Post by: danadak on January 06, 2017, 02:50:39 am
There is a further complication, are you turning on LED by driving
the output pin low or high ? The Output is quite different in its drive
characteristics sourcing or sinking in the output (PMOS vs NMOS
transistors in output).

Then you have the very sloppy device to device Vf variation, as well as
the processor drive device to device variation.

This might help - http://www.nxp.com/documents/application_note/AN11496.pdf (http://www.nxp.com/documents/application_note/AN11496.pdf)


Regards, Dana.

Title: Re: LED current explained
Post by: mariush on January 06, 2017, 03:02:32 am
The forward voltage depends on what chemistry is used to create the LED.  Not all LEDs of same color are made from same chemicals.
Also keep in mind that some colors can be created indirectly using phosphorus layer over the actual led die...

Also note that the forward voltage varies with the temperature of the dide ... another reason why you can't really use just a resistor to limit the led to a very exact/accurate current value .. as the led heats up, the forward voltage will change, and the amount of current flowing through the led will also change.

From wikipedia : https://en.wikipedia.org/wiki/Light-emitting_diode#Colors_and_materials (https://en.wikipedia.org/wiki/Light-emitting_diode#Colors_and_materials)

(https://www.eevblog.com/forum/beginners/led-current-explained/?action=dlattach;attach=283307;image)
Title: Re: LED current explained
Post by: tehtehteh on January 06, 2017, 11:59:57 am
I understand how to calculate the resistor for an LED
Not true.
it would be more helpful if you could tell me what I'm doing wrong, wise master
Title: Re: LED current explained
Post by: tehtehteh on January 06, 2017, 12:02:31 pm
say I have a 5v microcontroller that supports 20mA output ...... but say I want an LED directly on that pin, that would only require 100ohms to limit it to 20mA

I have to ask - How did you get the value of 100 ohms?
I was just using an LED with a 3v voltage drop as an example
Title: Re: LED current explained
Post by: tehtehteh on January 06, 2017, 12:12:34 pm
thank you for all your replies

I know LEDs have different voltage drops and all that, and I know you can take the voltage drop into account to calculate an approximate value for the resistor, so maybe I should rephrase my question

imagine the LED and series resistor hidden in a box with the 5v and ground wires coming out, if I was to connect it up and measure the current going through it at 20ma, ohms law would tell me the resistance of that box is 250ohms yes? but yet the resistor in that box is actually 160 ohms for example, so what's the deal? does the LED make up the other 90 ohms?

or am I getting the wrong end of the stick completely?
Title: Re: LED current explained
Post by: pitagoras on January 06, 2017, 12:29:02 pm
If the led had a "resistance" you would have the same V/I ratio for any voltage you feed to your box. But it does not happen.
if you were to feed 10V you would expect 40ma (assuming the led does not blow). But you get (10-2)/160= 50 ma.
Thus the diode does not act as a resistance. It has a forward voltage drop.
Title: Re: LED current explained
Post by: tehtehteh on January 06, 2017, 12:34:57 pm
If the led had a "resistance" you would have the same V/I ratio for any voltage you feed to your box. But it does not happen.
if you were to feed 10V you would expect 40ma (assuming the led does not blow). But you get (10-2)/160= 50 ma.
Thus the diode does not act as a resistance. It has a forward voltage drop.
so I can't think of it in the way I have been so far

this is fine, I just wanted to gain a better understanding of what was happening, rather than just using a formula and blindly accepting it like I had been

thanks for all the help
Title: Re: LED current explained
Post by: Brumby on January 06, 2017, 02:01:36 pm
If the led had a "resistance" you would have the same V/I ratio for any voltage you feed to your box. But it does not happen.
if you were to feed 10V you would expect 40ma (assuming the led does not blow). But you get (10-2)/160= 50 ma.
Thus the diode does not act as a resistance. It has a forward voltage drop.
so I can't think of it in the way I have been so far

this is fine, I just wanted to gain a better understanding of what was happening, rather than just using a formula and blindly accepting it like I had been

thanks for all the help
If you were to do a single measurement, then your observation would be misleading.

This was the reason I added the following to my post:
You can also calculate the power dissipated through the LED, by using the voltage drop across the LED and the current flowing through it.  While you might think AHA! This is looking like a resistor! - don't be fooled.  Yes, the power dissipation from the LED will be the same as a resistor with the same voltage and current, but that is for those specific values.  If you change something, then they each respond differently.  The resistor will do so in a linear fashion - the LED will not.

pitagoras spelled it out with the example given.  To accurately assess what is in the "black box" you need to do multiple measurements under different conditions.