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
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.
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 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.