# LED forward voltage is a range, so how do you calculate resistor value?

In all LED examples that I find, they have the forward voltage set to a specific number (i.e. 2.1v) and calculate the resistor needed based on that number. But when I look up datasheets, the forward voltage comes in ranges (2.0v - 2.5v). This makes sense to me since not all LEDs are created equal. But it's making it hard for me to figure out what resistor to use.

So I decided to design a circuit. I have a 3v voltage source (2 AA batteries) that connects to a resistor that connects to an LED that connects back to the voltage source. The LED's max sustainable current is 20mA.

I decided to use Ohm's Law on the low and high end of the forward voltage range to calculate resistances.

$$(3.0v - 2.0v)/20mA = 50\Omega$$ $$(3.0v - 2.5v)/20mA = 25\Omega$$

The problem comes when I pick a resistor. Let's say I pick the 50 Ohm resistor but the LED that I get actually has a forward voltage of 2.5v. The actual amount of current that would go through the LED would be 10mA. That's not using the LED to it's full potential.

If I use the 25 Ohm resistor and the LED has a forward voltage of 2.0v, then the amount of current going through the LED would be 40mA. My LED would explode.

Using the "set value" of 2.1v to calculate resistance gives us 45 Ohms.

$$(3.0v - 2.1v)/20mA = 45\Omega$$

If my LED had a forward voltage of 2.0v, the current would be 22mA. That's over the rating for the LED. If the LED had a forward voltage of 2.5v, the current would be 11mA which isn't using the LED to it's full potential.

Note: I'm not too concerned about getting the full potential out of an LED. (If I understand correctly, 10mA should work fine to light up an LED.) I just want to know how real engineers handle this problem. Is having a 10mA current acceptable? Can you actually get away with 22mA even though the specs say 20mA? What do you do when you need your LEDs to operate at peak brightness?

• yes, you can drive a 20ma signal LED at 22ma. you can probably drive much more than that if heat is dealt with. it will reduce the life, but how often do you see LED's "burnt out" before the product is discarded? Nov 12, 2017 at 6:42
• If you are viewing the device from a few feet and not in direct sunlight, as little as 2mA could work. The effective light as seen by us is logarithmic. Nov 12, 2017 at 17:06
• I would never plan to drive a 20mA LED at 22mA, but since the battery voltage drops rapidly you would probably get away with it. I have found that simple indicator LED's usually only need a few mA unless they are lighting up a large diffuser or something. I would also point out that two alkaline batteries will produce a voltage ranging from around 3.1V down to around 2V when discharged. So driving a 2.5V LED would require a boost regulator. Also, LED Vf often is specified at max If. If you don't need max If, you may not need to hit max Vf either. Nov 12, 2017 at 17:46
• Don't forget that resistors have sample variations too. Depending on the tolerance you select, the actual resistance of your nominal 50 Ohm could be less than 45 Ohms or more than 55 Ohms. You design for nominal circuit performance at nominal component values, and ensure that at the tolerance limits, your device doesn't push anything beyond its capabilities or go into an unexpected state. Nov 12, 2017 at 18:39
• You're missing the point. It's not that they're manufactured unequally, it's that they're constant current and not constant voltage ... and also drift based on age and junction temp... and are non-linear and small voltage changes cause big current changes. Apply 2.2V constant-voltage to an LED, random result. Apply 20ma constant-current, predictable result. Think in current. Nov 12, 2017 at 20:31

That is a general issue with using a current limiting resistor with LEDs when the supply voltage is close to the forward voltage of the LED. You simply do not have enough overhead for the resistor to be large enough to soak up the diode to diode forward voltage differences.

You also have the issue that the batteries themselves will have a significant range and will likely be more than 3V when new.

Generally, it is better to drive LEDs with a current source rather than a voltage source. However, even then, you need some headroom for the current limiter to work and half a volt is really tight.

There are ways to do it accurately enough under all your constraints, but it gets complicated and has a cost involved and drains the battery faster. simulate this circuit – Schematic created using CircuitLab

Pretty amazing after all these years that nobody seems to have put that on a simple little SOIC.

But, ultimately, unless your requirements are tight on the forward current needed, you are better just to throw in another battery so you have 4.5V nominal and use a larger resistor.

• @andre agreed, See my comment under Jonk's answer. Nov 12, 2017 at 14:03
• This is the best circuit once you get passed what can be done with one transistor. I bet you could also omit the linear regulator and just use a zener or regular diode forward biased as a reference. Nov 13, 2017 at 1:18
• @mkeith ya the issue with a diode is the battery variance. Nov 13, 2017 at 1:55
• @ChrisH true, and with the old LEDs at 5V it did not matter. But with more and more low overhead 3.3V stuff they sure would be nice now. Nov 13, 2017 at 12:08
• That's the reason why cheap LED flashlights use unwieldy number of THREE 1.5V batteries. Nov 13, 2017 at 13:43

It sounds as though you are over-thinking the problem.

1. For example, a white LED may exhibit perhaps $\frac{1}{4}\:\textrm{V}$ change in its voltage for a factor of $\times\: 2$ in the current through it. But two different white LEDs from the same batch might exhibit as much variation, just one to another.
2. Also, LEDs are pretty tough and are often used in pulsed (multiplexed) modes where the peak current is much higher than the average. And they can usually handle it just fine.
3. Finally, human awareness of brightness is fortunately logarithmic. So a change in current in the LED by a factor of $\times\:2$ means a change in perception of brightness change that is barely perceptible (unless the LED is flickered intentionally with the two different currents to make it easier to perceive.)

So, all in all, the exact level of current usually isn't so important when an LED is used as an indicator light. And the voltage across an LED doesn't vary all that much, anyway.

The main thing is to make sure that there is sufficient voltage overhead to actually operate the LED consistently in a design and that the method of regulating the current is sufficient for the need (whatever that may mean) and doesn't cost too much (...) and doesn't take up too much space (...) and doesn't heat up surrounding things it shouldn't (...) and doesn't drain the battery more than necessary (...) and otherwise doesn't interfere with other design specifications (whatever those may be.)

In short, there are usually way too many other concerns to be worrying over.

[If the LED is used as one of three RGB LEDs, with the intent to use it as an LED pixel in a large external display, then it may be very important (or not so, depending on the requirements) that the currents are carefully calibrated in each of the individual LEDs in order to ensure actual design criteria such as "white balance" can be met. (Besides any LED "binning" that may have been done prior to assembly into an RGB pixel.)]

You present a problem, regarding LED current, where the problem uses a low-overhead voltage and exaggerates the problem by having LED voltages vary quite a bit (which, I suppose, might happen.) There is a modest solution to such cases, though I can't say anyone would care to bother putting three BJTs and a resistor to the problem. But let's say you actually have a design goal of "low overhead" control and consistent current control regardless of LED voltage variation. In such a case probably the cheapest method is to use a current mirror, as follows: simulate this circuit – Schematic created using CircuitLab

Even moving into saturation, $Q_1$ will still deliver a fairly consistent current (within 1% or so) to the LED and it will do so with only a few hundred millivolts of overhead. (Shorting $Q_3$ and removing its grounded collector would mean 10% variation moving into saturation, which still isn't horrible.)

With low overhead situations, a resistor makes a very poor current regulator. That's just how it is. So you either live with it, or not, depending on the circumstances.

Okay. So that was fun. I probably should not have added the above circuit due to the level of disconnect between my reasons for adding it and my ability to communicate that reason sufficiently well. So, with the added desire of some measure of independence of $V_{CC}$ as well as the ability to work with low overhead as well, I offer the following thought. It crossed my mind to add during the discussion, but at the time my shift was over and I had to head off to bed. So please enjoy the following so that we can have still more interesting discussion. simulate this circuit

So, you'll need three $V_{BE}$ (plus a little extra needed for $R_2$ and, if necessary, $R_3$ [which can be shorted]) to make this thing start to work. But it will have some independence of LED current vs $V_{CC}$, as well. Set $R_3$ to have a multiplier effect if you don't like wasting too much excess current (over the LED's current.) But be aware that this also increases the variation of current over variations of $V_{CC}$. Set $R_1$ so that it provides the appropriate amount of current on this side of the mirror. There's one $V_{BE}$ across it, so this is easy to do. Set $R_2$ so that there is always at least 10% of the current in $R_1$ in the collector of the NPN (at the minimum allowable $V_{CC}$ you decide on.)

Again, this is just me going off on a fun jag and responding to the discussion. Use matched BJTs as appropriate. There are still other approaches, such as the Wyatt which is dead flat over a wide temperature range and $V_{CC}$ range and if I worked on it might operate from almost as low as $2.5\:\textrm{V}$ and uses three BJTs (plus a mirror I might add then.) But then I'd have to explain why it achieves that and depends upon the 3300 ppm per degree change in resistance found in copper wire and metal film resistors as part of its temperature independence. There is an article on that from the 1990's, somewhere.

• Because it is a current mirror, this circuit wastes as much power as it delivers to the LED. Sometimes that can be a real problem. Nov 12, 2017 at 9:02
• @mkeith That can be adjusted with a resistor in the emitter leg of $Q_2$. But please don't imagine I'm suggesting this circuit. I'm just pointing out how one might approach a situation where the overhead control room is very low and one still wants for whatever reason some independence vs led variations. I also failed to discuss bjt variations here, too. Oh, well.
– jonk
Nov 12, 2017 at 9:10
• In simulation, it does maintain very good regulation. I think there is a mistake though. You surely intended for Q3 to be an NPN, right? With the emitter grounded, and the collector connected to the current mirror bases? That is how I simulated it. Nov 12, 2017 at 9:18
• @mkeith Don't trust simulations too much. Q1 and Q2 are never exactly identical, and are in general at different temperatures (above all the currents in Q1 and Q2 are different, the common situation if you don't want to waste power in Q2) Nov 12, 2017 at 9:21
• @ Trevor, with three alkaline batteries, the voltage varies from 4.5 down to 3V as the battery discharges. If Vf is 2.5V, that means the voltage across the current limiting resistor will vary from 2V down to 0.5V, a variation of 4x in LED current. This is why I would use the current source with two diodes as a reference. It will maintain much better regulation over battery voltage range. With only a few extra resistors. Nov 12, 2017 at 17:14

First, you specify a single LED manufacturer and part number. The range in Vf from part to part will not be as great as you suggest (not 0.5V).

Second, small variations in brightness are not readily detectable to the eye. So you don't have to worry about small variations from unit-to-unit.

Third, when possible, you power the LED's from a regulated voltage, not the battery, so that you remove one source of variation.

Fourth, when the only power source available is variable (such as a battery), you drive the LED with a current source instead of a voltage source with a current limiting resistor. If there is at least one regulated voltage available (even if it is a low voltage), it is pretty easy to make a satisfactory current source for driving an LED indicator using only one transistor and a few resistors. This is cheap but does take up room on highly space constrained designs.

If there is not even one single regulated voltage available, you can still make a decent current source using two diodes in series as a voltage reference.

I am not sure if I am a real engineer, but I have had to do all this stuff while designing consumer products, and that is how I dealt with it. One other thing that can really get you with LED indicators is when heavy loads cause the battery voltage to sag. For example, a vibration motor or speaker may cause battery voltage to droop on some products. That droop may cause a noticeable flicker or variation in the LED brightness when the LED is driven from the battery. This is another reason to use a current source instead.

Here is a current source for when the LED is powered from the battery, but you have a GPIO signal available which is derived from a regulated voltage: simulate this circuit – Schematic created using CircuitLab

In the above schematic, it doesn't matter if the LED is powered from 3.3V or VBATT or whatever, as long as the GPIO is powered from a regulated source. I copied this from another answer. You would want to tweak the emitter resistor to get the specific current you are looking for. When there is not much overhead available, you can also reduce R2 so that the base voltage is less than 1V.

Here is a circuit for when there is no regulated voltage available: simulate this circuit

In the above circuit, D1 and D2 act as a voltage reference. The voltage will vary, but not as much as the battery voltage. This constant voltage at the base of Q1 is then leveraged into a constant voltage across R3, and thus, constant collector current (the transistor will not be saturated unless VBATT is very low). I haven't actually done this in a production design, but I believe it would work OK.

Compared with a simple saturated switch, both circuits do a good job of maintaining the desired current even when there is barely enough voltage available to keep the LED illuminated.

Here are some simulation results comparing the simple saturated switch with current limiting resistor (D1), vs the voltage divider reference circuit (D2) vs the two-diode reference (D5). This is with a 3V LED. Note that the resistor values have been tweaked to get around 9mA at VBATT = 4.2V. As you can see, the current source with the voltage divider reference maintained good performance to, let's say 3.35V. So it only needs around 350mV of overhead.

The two diode reference circuit maintained good performance down to around 3.45V, which is around 450mV of overhead.

The standard circuit really doesn't maintain a regulated current at all. Current drops linearly with battery voltage.

Also note that the two-diode reference circuit and the voltage divider reference circuit both have higher current at all battery voltages compared to the standard circuit, except for at the max battery voltage.

• Also see my related answer in some other question: electronics.stackexchange.com/questions/281359/… Nov 12, 2017 at 5:26
• Those regulators wont work on 3V though, not nearly enough headroom with a 2.5V LED. Nov 12, 2017 at 5:55
• @trevor, That is what people always think. But they work way better at lower voltages than single NPN operating as a saturated switch with a current limiting resistor. Note how low the emitter resistor is. Nov 12, 2017 at 7:30
• The whole purpose of this circuit is that it needs much less headroom to achieve the required current. It can usually be used to drive blue or white LED's from 3.3V and below. You don't have to drive the base to 1V. It can be biased to lower voltages to gain headroom. The emitter resistor would also have to be changed. Nov 12, 2017 at 7:38
• Um 50 ohms would be 1.3V loss, 100 is over 2. No worky mate, not for a 2.5V led. 50R would work for your old style traditional LED though. Nov 12, 2017 at 13:58

This is a common issue with using a resistor as the current limiting device, and a voltage source that is only a small voltage distance above the LEDs operating voltage range, AND an LEDs forward voltage range being so broad.

Firstly to explain, the LEDs forward voltage "range" is not a range you can select to operate it at, its the range of voltages the LED will possibly operate at IF given the correct current (the forward current) (this voltage will vary from unit to unit, and from batch to batch).

Without changing any of your hardware, the correct resistor to design the circuit is to use lowest possible voltage in the vf range (2.0v) to do your calculations with, this means the units with an actual vf of 2.0v will run at the max forward current and hence brightness, and those with a higher vf (>2.0) will run at less current and less brightness than the max design of this type of LED, but at least any unit of this model LED will operate within safe limits.

So if you wanted to improve or correct the 3 reasons I gave, if for example your application cant tolerate lower brightness from the LED, you could do either of: 1) using a better current limit circuit than a simple resistor. there are some chips that do this. 2) using a higher voltage above the forward voltage. 3) using an LED with a narrower range of forward voltage specification.