Picking Resistors for LEDs - Reblog from evilmadscientist.com
Basics: Picking Resistors for LEDs
So… you just want to light up an LED. What resistor should you use?
Maybe you know the answer, or maybe everyone already assumes that you should know how to get to the answer. And in any case, it’s a question that tends to generate more questions before you actually can get an answer: What kind of LED are you using? What power supply? Battery? Plug-in? Part of a larger circuit? Series? Parallel?
Playing with LEDs is supposed to be fun, and figuring out the answers to these questions is actually part of the fun. There’s a simple formula that you use for figuring it out, Ohm’s Law. That formula is V = I × R, where V is the voltage, I is the current, and R is the resistance. But how do you know what numbers to plug into that formula to get out the right resistor value?
To get the V in our formula, we need to know two things: the voltage of our power supply, and the voltage of our LEDs.
Lets start with a concrete example. Suppose that we are using a 2 × AA battery holder (like this one from our shop), which will provide us with a 3 V of power (with two 1.5 V AA cells in series; we add the voltages), and we’ll plan to hook up a yellow LED (like one of these).
LEDs have a characteristic called “forward voltage” which is often shown on the datasheets as Vf. This forward voltage is the amount of voltage “lost” in the LED when operated at a certain reference current, usually defined to be about 20 milliamps (mA), i.e., 0.020 amps (A). Vf depends primarily on the color of the LED, but actually varies a bit from LED to LED, sometimes even within the same bag of LEDs. Standard red, orange, yellow and yellow-green LEDs have a Vf of about 1.8 V, while pure-green, blue, white, and UV LEDs have a Vf of about 3.3 V. So, the voltage drop from our yellow LED will be about 1.8 V.
The V in our formula is found by subtracting the LED’s forward voltage from the voltage of the power supply.
3 V (power source) − 1.8 V (LED voltage drop) = 1.2 V
In this case, we’re left with 1.2 V which we’ll plug into our V = I × R formula.
The next thing we need to know is the I, which is current we want to drive the LED at. LEDs have a maximum continuous current rating (often listed as If, or Imax on datasheets). This is often around 25 or 30 mA. What this really means is that a typical current value to aim for with a standard LED is 20 mA to 25 mA—slightly under the maximum current.
Aside: You can always give an LED less current. Running an LED near its rated maximum current gives you maximum brightness, at the cost of power dissipation (heat) and battery life (if you’re running off of batteries, of course.) If you want your batteries to last ten times longer, you can usually just pick a current that is only one tenth of the rated maximum current.
So, 25 mA is the “desired” current— what we’re hoping to get when we pick a resistor, and also the I that we’ll plug into our V = I × R formula.
1.2 V = 25 mA × R
or rephrased:
1.2 V / 25 mA = R
and when we solve that we get:
1.2 V / 25 mA = 1.2 V / 0.025 A = 48 Ω
Where “48 Ω” is 48 ohms. (The units are such that 1 V/ 1 A = 1 Ω; one volt divided by one amp equals one ohm. If you are dealing with current in mA, convert to A by dividing by 1000.)
Our version of the formula now looks like this:
(Power supply voltage − LED voltage) / current (in amps) = desired resistor value (in ohms)
We end up with a resistor value of 48 Ω. And, that’s a fine starting resistor value for use with a yellow LED and a 3 V source.
Let’s look at resistor values for a moment. Resistors are usually available in values such as 10 Ω, 12 Ω, 15 Ω, 18 Ω, 22 Ω, 27 Ω, 33 Ω, 39 Ω, 47 Ω, 51 Ω, 56 Ω, 68 Ω, 75 Ω, and 82 Ω (and their multiples, 510 Ω, 5.1K Ω, 51K Ω, etc.), and (unless you specify higher precision while shopping) have a tolerance value of about ±5%.
If you do a lot of electronics projects, you’re likely to have a bunch of resistors lying around. If you’re just getting started, you might want to get an assortment so that you have some handy. Resistors also come rated to handle varying amounts of power— resistors rated for more power (more watts) are able to safely dissipate more heat generated within the resistor. 1/4 watt resistors are probably the most common, and are generally just fine for simple LED circuits like the ones we’re covering here. (We’ve discussed power dissipation previously—look into that when you start to move beyond these basics.)
Now, the resistor value we calculated above was 48 Ω, which isn’t one of our common values. But that’s okay, because we’ll be using a resistor with a ±5% tolerance, so it won’t necessarily be exactly that value anyway. To be on the safe side, we generally select the next higher value that we have on hand; 51 Ω in this example.
Lets hook this up:
3 V battery box, 51 Ω resistor, and yellow LED.
3 V battery box, 51 Ω resistor, and yellow LED.
Now, that’s a nice little LED circuit, but how can we do this with more LEDs? Can we just add another resistor and another LED? Well, yes, to a point. Each LED will want 25 mA, so we need to figure out how much current our batteries can source.
Aside: A little digging turns up a helpful technical handbook (pdf) on alkaline batteries from Energizer. It turns out that the harder you drive them, the faster you drain them. Part of this is obvious: If you continuously draw 1000 mA out of a battery, you would expect the battery to last 1/10 as long as if you draw 100 mA. But there’s actually a second effect, which is that the total energy output the battery (measured in watt-hours) decreases when you approach the limit of how much current the battery can source. In practice, with AA alkaline batteries, if you drain it at 1000 mA, it will only last about 1/20 as long as it would if you drained it at 100 mA.
For our single 25 mA LED, AA cells will last a heck of a long time. If we run four LEDs in parallel, requiring 100 mA, we should still get pretty decent battery life. For higher than 500 mA, we should think about plugging into the wall. So, we can add several of our yellow LEDs, each with its own 51 Ω resistor, and drive them happily with a 2xAA battery holder.
All right, how about a 9 V battery? Let’s stick with our yellow LEDs. If we want to run one LED off of a 9 V battery, that means we have to take up a whopping 7.2 V with our resistor, which would need to be 288 Ω (or the nearest convenient value: 330 Ω, in my workshop).
9 V (power supply) − 1.8 V (yellow LED) = 7.2 V
7.2 V / 25 mA = 288 Ω (round up to 330 Ω)
Using a resistor for a voltage drop of any size dissipates that energy in the form of heat. That means that we’re just wasting that energy on heat instead of getting more light out of our LED circuit. So can we use multiple LEDs strung together? Yes! Let’s put four of the 1.8 V LEDs in series, adding up to a total of 7.2 V. When we subtract that from our supply voltage of 9 V, we’re left with 1.8 V, requiring only a 72 Ω resistor (or nearest value: 75 Ω).
9 V − (1.8 V × 4) = 9 V − 7.2 V = 1.8 V
1.8 V / 25 mA = 72 Ω (and we then round up to 75 Ω)
Our generalized version of the formula with multiple LEDs in series is:
[Power supply voltage − (LED voltage × number of LEDs)] / current = resistor value
We can even put a couple of these strings of four LEDs plus a resistor in parallel to get more light output, but the more we add, the more we’ll shorten our battery life.
But can we do five in series with a 9 V battery? Well, maybe. The 1.8 V figure that we’ve been using is a “typical rule of thumb,” only. If you’re sure the forward voltage is exactly 1.8 V, it will work. But what if it isn’t exactly that? If the forward voltage is lower, you may overdrive them at a higher current, which can shorten their lifespan (or kill them outright). If the forward voltage is higher, the LEDs may be dim or may not even light. There are some cases where you can drive LEDs in series without a resistor, like in our LED Dining Table Circuit, but in most cases, it’s preferable and safer to use a resistor.
Let’s do one more example, this time with a white LED (you can find some here) and a 3xAA battery box (such as this one). Our power supply voltage is 4.5 V, and our LED Vf is 3.3 V. We’ll still aim for a current of 25 mA.
4.5 V − 3.3 V = 1.2 V
1.2 V / 25 mA = 48 Ω (round up to 51 Ω)
So, here are the examples we’ve looked at plus few more with some other common power supply types:
Power Supply Voltage | LED Color | LED Vf | LEDs in series | Desired Current | Resistor (calculated) | Resistor (rounded) |
3 V | Red, Yellow, or Yellow-Green | 1.8 | 1 | 25 mA | 48 Ω | 51 Ω |
4.5 V | Red, Yellow, or Yellow-Green | 1.8 | 2 | 25 mA | 36 Ω | 39 Ω |
4.5 V | Blue, Green, White, or UV | 3.3 | 1 | 25 mA | 48 Ω | 51 Ω |
5 V | Blue, Green, White, or UV | 3.3 | 1 | 25 mA | 68 Ω | 68 Ω |
5 V | Red, Yellow, or Yellow-Green | 1.8 | 1 | 25 mA | 128 Ω | 150 Ω |
5 V | Red, Yellow, or Yellow-Green | 1.8 | 2 | 25 mA | 56 Ω | 56 Ω |
9 V | Red, Yellow, or Yellow-Green | 1.8 | 4 | 25 mA | 72 Ω | 75 Ω |
9 V | Blue, Green, White, or UV | 3.3 | 2 | 25 mA | 96 Ω | 100 Ω |
All of these values are based on the same assumptions about forward voltages and desired current that we used in the early examples. You can work those through and check the math, or just use it as a handy table if you think that our assumptions are reasonable. ;)
Now, at some point someone may have told you, “Just use an online LED resistor calculator.” And indeed there are such things out there— even we have one (well, a printable papercraft version) —so why bother working through all this? For one thing, it’s much better to understand what and why that calculator is doing what it does. But it’s also near impossible to use those calculators if you don’t know what variables you’ll need to enter. Hopefully you should now be able to figure out the values you’ll need (power supply voltage, LED voltage and current) to use an LED calculator. But more importantly (1) you can don’t really need one: you can do it yourself and (2) if you do use one, you can question the underlying assumptions that it may make on your behalf.
Hopefully, you’ve also seen that there is much more than just one way to light an LED. And we haven’t even gotten to things like putting LEDs of different values in circuits together! Now, can you go back to sticking LEDs on CR2032 batteries to make LED throwies? Yes, you most definitely can. But you may want to go back and read about when you should add a resistor to even that little circuit!
Finally, let us note that in this article we’ve been talking about your basic through-hole, low-power (though possibly extremely bright) LED. Specialized types like high power LEDs may have somewhat different characteristics and requirements.
Update: corrected the common resistor value list to include more common values.
A) listed the info as we would read it from a data sheet.
B) used some creative and not always standard examples (ie using 3 AA batteries, LEDs in a series and parallel
C) went into some of the design considerations ie how the mA are part of the equation.
I had relight a plexiglass Lowenbrau beer light that was lit with a 6″ fluorescent bulb. I used a 4.5V power block to light 22 water clear 5mm LED’s all in parallel under the sign. This was a battery set of Christmas lights It worked fine for a couple of weeks but burned out all the LED’s. When I checked the power block its V was 8.25V. Is that because there was no load. I have two and they both read the same? Should i use the 8V in the calculator to revise this set up?
complete novice trying to learn,purchased a kit from bitsbox with breadboard, thought id start out really simple but stumped already, Set up the simplest circuit 9v battery 330 ohm resistor and red led, it was bright for a second or 2 then dimmed quickly, could smell the led burning. I used several online calculators to get the resistor value all said the same.Used the rule of red led 2v. anyone any idea’s what im doing wrong. So want to learn yet so frustrated already.
• Forward current: 20 mA continous, 50 mA peak
• Forward voltage: 3.0 to 3.4 VDC
• Viewing angle: 20° to 25°
• Luminous intensity: 4000 mcd
When imputing to calculate what kind of resistors I needed, I input 20 ma
for forward current and 3 for forward voltage I resulted in needing a 320ohm resistor. So my question are:
1. I noticed you mentioned that you upped the 20ma for forward current to hit a middle mark between 20ma and 30ma so would you in this case aim for a middle mark of 35 for mine being 20ma to 50ma peek?
2. I saw that you also loosely at one point mentioned that a 1/4w resistor would be fine in your example. Are the ohms on a resistor the most important thing to follow or is there a general wattage or voltage range that 1/4w resistors can handle?
3. In my predicament, using what I have, would you use the one 420ohm resistor or would you use 4 100ohm resistors in series to cut down on the amount of overhead making it closer to 320ohms = 400ohms insted of 420ohms?
4. Does it matter what size resistor you use as long as it is over the amount you need? Meaning if you only need say 320ohm resistor could I hypothetically use a 1000ohm resistor and not have a problem with lighting the leds or do you need to get a resistor that is as close as possible to what you need because the resistor would then start drawing all the power and the leds would be left with out power?
5. Last question (side question) I was also interested in putting in some RGB led tape that has a remote receiver into the same computer. The Led tape claims to only use 12v to run, now if I wanted to do away with the led tapes power block and somehow wire a molex plug (powering from the computer power block) to the remote receiver for the tape which has a female dc plug input only would you have any ideas on how one might do that?
Thank you in advance for any help you can give me.
2. A 1/4 W resistor is, by definition, one rated to handle up to 1/4 W of power. You need to use a resistor of the right resistance for your application, that is also rated for AT LEAST as much power as will be generated. There is not one or the other that is “more important.”
3. You can always use a resistor with HIGHER resistance than the value that you calculate. However, the higher it is above the minimum, the dimmer the LED will run.
4. See answer 3.
5. Not sure; check with the manufacturer.
Thank you again for any help.
http://www.evilmadscientist.com/2012/flicker-leds/
Any help will be highly appreciated.
http://www.evilmadscientist.com/2007/weekend-projects-with-bre-pettis-make-a-joule-thief/
1.8V
20mA
120mcd
I want to have 2 light bulbs in the front and then it traveling through the body of the car to the back. On the same battery. Is there a certain way I need to do it? Or is there a certain amount of resistors I need?
I have a 9v battery. And 4 leds pushing 1.8v.
9 – 7.2= 1.8 / 20 = 0.09 so how many resistors would I need? And they’re 90ohm. Correct?