SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.
Limiting current into an LED is very important. An LED behaves very differently to a resistor in circuit. Resistors behave linearly according to Ohm's law: V = IR. For example, increase the voltage across a resistor, the current will increase proportionally, as long as the resistor's value stays the same. Simple enough. LEDs do not behave in this way. They behave as a diode with a characteristic I-V curve that is different than a resistor.
For example, there is a specification for diodes called the characteristic (or recommended) forward voltage (usually between 1.5-4V for LEDs). You must reach the characteristic forward voltage to turn 'on' the diode or LED, but as you exceed the characteristic forward voltage, the LED's resistance quickly drops off. Therefore, the LED will begin to draw a bunch of current and in some cases, burn out. A resistor is used in series with the LED to keep the current at a specific level called the characteristic (or recommended) forward current.
Using the circuit above, you will need to know three values in order to determine the current limiting resistor value.
i = LED forward current in Amps (found in the LED datasheet)
Vf = LED forward voltage drop in Volts (found in the LED datasheet)
Vs = supply voltage
Once you have obtained these three values, plug them into this equation to determine the current limiting resistor:
Also, keep in mind these two concepts when referring to the circuit above.
What current limiting resistor value should you use if you have one LED and want to power it with a supply voltage of Vs = 3.8V?
To calculate the current limiting resistor, you first need to look in the datasheet (always RTFM first!) for the LED's recommended forward voltage and forward current specifications. In this example, they are 3.1V and 30mA respectively. Don't forget to convert all of your units to Volts, Amps, or Ohms! e.g. 1mA = 0.001Amps
If you plug the values into the above equation, you get:
23.3 Ohms might be an odd value to find, so round up to the next highest common value.
What if you wanted to power a high power LED? What should the power rating for the resistor be?
The resistor's purpose is to limit current and thus uses some amount of power. You need to be sure the wattage (power) rating for your resistor is sufficient for the power being used. The equation for power is:
Let's say you are using the LED above with a supply voltage of 12V, an LED forward voltage of 3.9V, and a total forward current of 1400mA. What power rating should you choose for your resistor?
The resistor has a voltage drop and so does the LED. So, according to Kirchoff's Voltage Law:
If you solve for the voltage drop of the resistor, you get 8.1V. Now we have enough information to plug the numbers into the power equation (be sure to convert all units to Amps and Volts, e.g. 1400mA = 1.4A):
The calculated value is approximately 12 Watts. Generally, you should get a resistor wattage rating close to twice the calculated value. So a resistor in the neighborhood of 20-25 Watts would be sufficient. Also, keep in mind, a 20-25 Watt resistor will be pretty darn big!
First-year electrical engineering courses should be replaced by sparkfun tutorials. Cheaper tuition.
as a 1st yr EE student, I can confirm, this is still very relevant 9yrs later.
It is very easy dudy, Follow the simple steps here ... How to calculate the value of resistor for LED’s (with different types of LED’s circuits)
or simply use this online calculator: Required Value of Resistor for LED’s Circuit Calculator
Boy does that bring back memories! Popping capacitors, letting out the blue smoke and older EE students(the age of my parents) not being able to understand how a RS NAND gate flip flop worked. I would not trade that for all the gold in the world.
What happens if your vcc is lower than your Vf? I have a 3.7 V LED but im only driving it with 3.3V is it necessary to use a current limiting resistor?
That depends a bit on the LED and the power source, but in general it will either light up dimly, or not light up at all. Datasheet should have that information.. I do say 'should' because most actually don't since you're expected to use them at their typical values.
You wouldn't need to use a current limiting resistor if the LED is expected to behave (e.g. doesn't have an unfortunate incident where its characteristics change or even ends up being a short circuit - in which case the resistor would be more about protecting what you're driving it with) and your voltage source is pretty constant (i.e. doesn't have some funky transient periods where it's actually outputting 4V).
Can I use enough led in series to eliminate the limiting resister? If so how many does it take?
Thank you for this! The only part I don't quite understand is a the end where, "If you solve for the voltage drop of the resistor, you get 8.1V". I understand that 12V - 3.9V = 8.1V, but what about accounting for the voltage drop from the resistor? It's been a while for me, pardon my ignorance!
8.1V is the voltage drop across the resistor.
I have a LED rated at 50W @ 85V-265v AC I wanted to use a series resistor (56 Ohms) to create enough 12V to run a fan. The LED is OK but the resistor burns out (!?) P = (0.2)sq X 56 = 2.24W (!?) It should only be carrying 200mA (250V X 0.2 = 50W) and 12V = 0.2 X 56 Ohms Is something happening in the reverse direction?
Hello, I am using five strings of nine LED each (6.4V, 150mA). The input power supply is 57.6V, 750mA. Please let me understand the calculations done for the resistors so that the voltage across each LED is more or less the same. Thanks in Advance
Hello, I am using five strings of nine LED each (6.4V, 150mA). The input power supply is 57.6V, 750mA. Please let me understand the calculations done for the resistors so that the voltage across each LED is more or less the same. Thanks in Advance
I have a science demonstration where I connect 4 equally-spaced two-lead bi-color LEDS (one red, one green inside the same LED) in parallel on a piece of regular lamp cord. When you connect these to an AC source they blink red and green alternately and appear yellow if you don't move the bulb. I have always connected them in parallel on a piece of lamp cord and directly connected one end of the cord to a low voltage AC power supply and gradually increased the voltage until the bulbs light. When you swing the cord in a circle (holding the end near the power supply) the bulbs trace out little arcs during their on times and the colors are alternately red and green. My question: I have never used any limiting resistor and have done this dozens of times with set-ups that I have had workshop members construct. Does someone have a comment on why I have NEVER burned out a single LED? Luck (in which case I'd need 4 R's)?? Thanks.
Maybe there is sufficient resistance in the lamp cord?
if i wants to use make a development board for atmega16 and i wants to put a power led in it. then how will i calculate the value of current limiting resistor because there will be a extra resistance(effective resistance of other components) in parallel to the led resistance. and the value of parallel resistance will not also be fixed how to do that??????
I have to admit I had trouble interpreting your comment - but in general, the typical way you would drive a power LED with a microcontroller would be through a MOSFET. At that point there are no parallel resistances to worry about, only a (minor) series one between source and drain.
Example 2 shows how applications with high current need high power resistors, but I think it should be noted in this tutorial or another that smaller resistors can still be used to the same effect so that a smaller circuit board or device can be created.
Since R1 is 12 Watts, this could be accomplished by 2 - 10W resistors of twice the resistance, or 4 - 5W resistors of 4x the resistance...e.c. in parallel since resistance divides evenly. Enough resistors in parallel and you could get down to smaller sizes, although there must be some equilibrium point...
Hi, I am using the LilyPad Led's and the spec sheet has a Typical Forward Volatage and a Max Forward Voltage. Which one do I use for Vf?
Thanks
To be saf, use the smallest forward voltage you find listed on the sheet. This will the low end of the range listed until "Typical Forward Voltage". The smaller the forward voltage, the higher the current (work the math above to convince yourself of that) and you want to ensure that there's no way you're going to exceed the maximum recommended current for the device.
(Forward voltages are given as ranges or min/max values because technically they do vary a bit with current, although usually not enough to matter.)
I dont know if Radio Shack still makes the Getting Started in Electronics by Forrest M. Mims III, but it has a section on Light Emitting diodes. There is a table that talks about Forward Voltage and how its tied to Wavelength (nm) :
Wavelength (nm) | Voltage
565 (Green) | 2.2-3.0
590 (Yellow) | 2.2-3.0
615 (Orange) | 1.8-2.7
640 (Red) | 1.6-2.0
690 (Red) | 2.2-3.0
880 (infrared) | 2.0-2.5
900 (infrared) | 1.2-1.6
940 (infrared) | 1.3-1.7
As a general rule I found that when using 5 volts and a red LED, a 330 ohm resistor normally will work in series with the red LED.
I still like spelling things out:
Rs= ( Supply Voltage minus LED forward Voltage drop ) / ( LED Current)
Rs meaning a resistor in series.
Yes, usually all LEDs of a specific color will have the same chemistry, and so will have very similar forward voltages. So if in doubt just look at the datasheet of an LED of the same color as the unknown one. One wrinkle here is that "high intensity" (aka "super bright") LEDs should really be considered a separate "color" since they will often have a different chemistry than the garden variety LED.
Of course, you can also measure the forward voltage very easily: stick the LED in a breadboard with the cathode connected to ground, and a "safe" valued of current limiting resistor on the anode/positive side. Turn on the power, and measure the voltage between ground and the anode of the LED. To determine a "safe" value for the resistor, start with something big, say 4.7k, and work your way down until the LED visibly turns on.
I've repeatedly seen the advice to obtain the forward voltage by referring to the manufacture's data sheet, but I suspect that many of us beginners start out buying a grab bag of unlabeled LEDs of unknown manufacture.
So the question is, if you are equipped with a multimeter and the ability to do basic algebra, is there a reasonably straightforward way to measure/calculate the optimal forward voltage and thereby determine the resistor required?
Lacking that, in lieu of actually doing the calculation, I have drifted toward using 330 ohm resistors as being more than adequate, but I feel like this is sloppy practice.
Yup. Excellent points and a good question. Let's see how it works out...
You pointed out that many folks will have leds with no data sheets. So how much current/voltage should the circuit be designed for? Well, 20+ years ago, you got only modest light from an led when running with 20mA. Now days, 20mA will damn near blind you. I have been loading boards for leds that only indicate if a power supply is on or not, for example, with around 1mA.
Plenty bright.
And I used to use 20mA typical, no problem with 30mA. But the vendors have been playing numbers games with brightness lately. The upshot is that honest vendors often rate Imax = 20mA and Iabs-max = 30mA or so. And I have found that exceeding this often leads to a short life span. Beat 'em as hard as you want but beware that the life time may not be long.
Now to answer your question.
a) Operating lights: leds to indicate power is on, etc. 1 - 5 mA should do fine.
b) "Hey You!": leds to light up brightly: 10 to 20 mA
Well, the above is about 1/3 of what I posted... shite!
I understand why you shouldn't use one resistor with multiple parallel LEDs, i.e.:
-----\/\/\/-------->|---
----->|---
But is there any reason not to use one resistor for several series LEDs for lighting purposes?
---\/\/\/---->|---->|---->|---
One resistor for series LEDs is fine: the current though elements in series will always be the same. But make sure you get the forward voltage right, since it does depend slightly on current. For a single LED it doesn't vary enough to matter, but if you're putting lots of them in series small variations in Vf can add up. Usually the datasheet will give a range of Vf for a given current; run the numbers with both ends of the range to ensure that your current is still at a safe level.
Would an LED's reverse voltage be the same thing as the forward voltage drop? I'm looking at the datasheet for a 7-segment display I have to try and figure out what type of resistor I should use for each segment, since I have a bad habit of just plugging things straight into my Arduino, especially if they light up all pretty.
Also, to clarify, since the display would be wired in parallel, I would need to use a separate resistor for each segment's pin, right? I couldn't just place on resistor on the common cathode pin?
Reverse voltage is not the same thing as forward voltage drop. Reverse voltage specifies the point at which your LED goes "poof" if you hook it up backwards.
Yes, you'll need a separate resistor for each segment. A resistor array may come in handy.
You can place just one resistor on the common cathode if you guarantee in software that only one segment is on at a time. That's an advanced hack for the lazy.
I am confused a little about this. In the beginning electronics tutorial (http://www.sparkfun.com/tutorials/57) they use V=IR to decide what resistor to use for the LED but here a more complex equation.
What am I missing?
KVL says the voltages around a loop net to zero. If you use a positive voltage for supplies and negative voltages for loads (and call the voltage drop across the resistor Vr), then Vs-Vr-Vf = 0, or Vr=Vs-Vf. KCL says (paraphrasing) 'The current around a loop is the same', so the current flowing through the resistor will be the same as that flowing through the LED. Take the basic V=IR equation (E=IR if you're old enough) and rearrange it to be R=V/I. Note this equation is for the resistor only, which is Vr. Substituting the equation for Vr into this one yields R = (Vs-Vf)/I.
Its the same thing, R = V/I
I've always been taught (and, thus, always placed) the current-limiting resistor on the positive/anode side of the LED, as shown here.
But I recently saw a couple examples where it was from the cathode to the ground: Wikipedia and this calculator.
Obviously from an Ohm/Kirchhoff standpoint, it doesn't really matter (for a simple circuit with a resister and a single LED).
But is one way "better" or more proper than the other?
Does the alternate method stem from some learning the electron-flow style of electronics (where the circuit model accurately has electrons flowing from the negative end of the source?
Here's a longish answer:
1) first: generally speaking, you'll find that experienced EEs usually put the LED going to ground -- ie, the microcontroller output (or transistor output, etc) will go to the LED's positive/anode side and the negative/cathode side will be connected to ground, with a current limiting resistor inserted on one side or the other. This at first seems backwards -- it means a logic "zero" turns the LED "on" and a logic "one" turns it "off" -- but it turns out that most logic outputs can sink a lot more current to ground than they can source to Vcc, for electrochemical reasons having to do with the relative "strength" of N-doped versus P-doped silicon. Check your datasheet to see if your microcontroller has this property; some have been engineered to have symmetric outputs, so this isn't as important as it once was.
2) If you have a bank of LEDs (or other devices requiring current-limiting) and they are all going the same way (ie, all sinking or all sourcing current), then you can use a bussed resistor array and same yourself some part count and wiring trouble. Bussed resistor arrays will have, for example, 6 pins for 5 current-limiting resistors, using just one pin for a common "bus" (which would be connected to GND, if you're sinking current). These are also less important than they once were: surface-mount devices are so small and so cheap to place that resistor arrays seem to be going slowly extinct.
So, the answer to your question is: yes! It's "better" to have the current-limiting resistors all on the negative/cathode side of your LED, connecting the positive/anode side to your microcontroller and connecting one side of the current-limiting resistors to ground. This lets you use the larger sink current capacity and lets you use a resistor array to bus the grounds of the resistors.
However, the reasons to do so are slowly disappearing. If your microcontroller can source as much current as it can sink, you may well want to flip the above to have a more "natural" programming model ("1" means "on"). And if you're using surface mount parts, there's no much call for using resistor arrays, so where you put the current limiting resistors ceases to matter much.
As far as I know, it doesn't matter.
UPDATE FOR EXAMPLE 2: Thanks for everyone's comments! Although I did originally state the LEDs in parallel were identical, the previous Example 2 was not practical. Therefore, to avoid confusion, I changed the example 2 to a circuit that would more closely resemble a real life situation.
I thought it changed, thanks for letting us know.
maybe you guys should reread the TUTORIAL, they explain all of that clearly...
I agree example 2 is not a good real-world solution. Another reason to give each LED (or other load) it's own resistor is in case of failure. If one LED were to fail as a short circuit, all of the LEDs would go out and you'd have no clue which was faulty.
Agreed, although most of the time LEDs don't fail as a short.
Of course if they fail open, you may burn out the remainder of your LEDs immediately thereafter...
I recall being taught to always give each LED it's own current limiting resistor because otherwise, the LED with the smallest voltage drop would take the lion's share of current. If you hook five in parallel, and each can only take 20 mA and if you sized the current limiting resistor to provide 100 mA, then you'll wind up with one LED taking more than 20 mA, which might exceed the current rating.<br />
That's right, since the LEDs usually won't be really "identical". Even if a LED current rating isn�t exceeded, the brightness of the LEDs won�t be the same. Another alternative would be to put the LEDs in series instead of in parallel, which would mean that each LED gets the same amount of current (and would also reduce the current that needs to pass through the resistor).