LED current explained - Page 1
Forum section: electronics / beginners

author: tehtehteh
author_rank: Regular Contributor
timestamp: January 05, 2017, 04:08:27 pm
content: helloI 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 searchsay 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 20mAso 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

author: MK14
author_rank: Super Contributor
timestamp: January 05, 2017, 04:16:08 pm
content: The LED has a voltage drop across it. E.g. it could be 2 volts across the LED.It isnotan 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.

author: Len
author_rank: Frequent Contributor
timestamp: January 05, 2017, 05:31:12 pm
content: Quote from: tehtehteh on January 05, 2017, 04:08:27 pmThe 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.

author: shteii01
author_rank: Frequent Contributor
timestamp: January 06, 2017, 02:05:29 am
content: Quote from: tehtehteh on January 05, 2017, 04:08:27 pmNot true.

author: Brumby
author_rank: Unknown
timestamp: January 06, 2017, 02:15:12 am
content: Quote from: tehtehteh on January 05, 2017, 04:08:27 pmI have to ask - How did you get the value of 100 ohms?

author: pitagoras
author_rank: Regular Contributor
timestamp: January 06, 2017, 02:26:50 am
content: 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 3VWhich 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

author: ebclr
author_rank: Super Contributor
timestamp: January 06, 2017, 02:27:48 am
content: That is the basic equation to useI = ( Vdd - Vled ) / R

author: Brumby
author_rank: Unknown
timestamp: January 06, 2017, 02:34:58 am
content: Quote from: tehtehteh on January 05, 2017, 04:08:27 pmThis is the best response so far:Quote from: Len on January 05, 2017, 05:31:12 pmQuoteIt can get a little more complicated if you start getting into Vfverses 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:QuoteYou 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 thinkAHA! 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 thosespecificvalues. If youchangesomething, then they each respond differently. The resistor will do so in a linear fashion - the LED will not.

author: danadak
author_rank: Super Contributor
timestamp: January 06, 2017, 02:50:39 am
content: There is a further complication, are you turning on LED by drivingthe output pin low or high ? The Output is quite different in its drivecharacteristics sourcing or sinking in the output (PMOS vs NMOStransistors in output).Then you have the very sloppy device to device Vf variation, as well asthe processor drive device to device variation.This might help -http://www.nxp.com/documents/application_note/AN11496.pdfRegards, Dana.

author: mariush
author_rank: Super Contributor
timestamp: January 06, 2017, 03:02:32 am
content: 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

author: tehtehteh
author_rank: Regular Contributor
timestamp: January 06, 2017, 11:59:57 am
content: Quote from: shteii01 on January 06, 2017, 02:05:29 amit would be more helpful if you could tell me what I'm doing wrong, wise master

author: tehtehteh
author_rank: Regular Contributor
timestamp: January 06, 2017, 12:02:31 pm
content: Quote from: Brumby on January 06, 2017, 02:15:12 amI was just using an LED with a 3v voltage drop as an example

author: tehtehteh
author_rank: Regular Contributor
timestamp: January 06, 2017, 12:12:34 pm
content: thank you for all your repliesI 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 questionimagine 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?

author: pitagoras
author_rank: Regular Contributor
timestamp: January 06, 2017, 12:29:02 pm
content: 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.

author: tehtehteh
author_rank: Regular Contributor
timestamp: January 06, 2017, 12:34:57 pm
content: Quote from: pitagoras on January 06, 2017, 12:29:02 pmso I can't think of it in the way I have been so farthis 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 beenthanks for all the help

author: Brumby
author_rank: Unknown
timestamp: January 06, 2017, 02:01:36 pm
content: Quote from: tehtehteh on January 06, 2017, 12:34:57 pmIf you were to do a single measurement, then your observation would be misleading.This was the reason I added the following to my post:Quote from: Brumby on January 06, 2017, 02:34:58 ampitagorasspelled it out with the example given. To accurately assess what is in the "black box" you need to do multiple measurements under different conditions.