‘Resistance’ of an LED

LEDs do not have a linear relationship between current and voltage so they cannot be modeled as simply as a resistor using Ohm’s Law, \( V = IR \). We can, however, make a simplification and model them over a range of currents as a combination of a resistor and a voltage source.

LED IV slope
Figure 1. An LED can be approximated as a resistor with a fixed voltage source.

If we look at a typical LED IV curve we can see that it is approximately linear over much of its useful range. This allows us to model the LED as a resistor and voltage source.

LED equivalent circuit model.
Figure 2. LED equivalent circuit model.

In Figure 1 the grey line is reasonably close to the LED curve from 20 mA to 100 mA. We can work out the resistance that this represents from Ohm’s law \( V = IR \) but in this case we will look at the change in voltage and current in the area of interes.

\( R = \frac{\Delta V}{\Delta I} = \frac{3.5 – 2.0}{100m – 0} = \frac{1.5}{100m} = 15 \mathrm\Omega \).

We can also see that the line crosses the X-axis at Vf = 2.0 V. Our equivalent circuit for this region of interest is (referring to Figure 2) R1 = 15 Ω and V1 = 2.0 V.

Low current approximation.
Figure 3. For the lower end of the IV curve we can create another approximation.

If we are interested in the lower current range of the LED, 1 to 20 mA, for example, we can calculate again. In this case the ends of the grey line have differences of 1.5 V and 40 mA giving a slope of 37.5 Ω. The voltage source becomes 1.5 V.

High-side versus low-side switching

Simplified logic output.
Figure 1. Simplified logic output stage showing the high-side and low-side switches.

Most micro-controllers and logic families have output stages which can connect the output to the positive supply or to ground. This allows the micro to put a definite ‘high’ (+5 V in this example) onto the output or a definite ‘low’ (ground) rather than let it float which could cause problems if the output is feeding into another device. Naturally, only one of the switches should be closed at any time. In this article we look at high-side versus low-side switching.

GPIO sourcing current for LED.
Figure 2. To power an LED connected to ground the micro simply connects the output to positive supply. In this configuration we use the upper transistor in the output stage to supply current to the output – much in the same way as S1 in the equivalent circuit.

Most micros can now source 10 to 20 mA safely on their GPIO1 pins. This is ample current to light an LED brightly. All that is require is to decide whether to source current for the LED or sink current.

Micro sinking current from LED.
Figure 3. To power an LED connected to positive supply the micro simply connects the output to ground. In this configuration we use the lower transistor in the output stage to sink current from the LED to ground – much in the same way as S1 in the equivalent circuit.

 

Some more detail

The switches in real devices will be constructed with transistors. These are imperfect and have various limits that we have to be aware of, such as maximum current and source resistance. For example, the ATmega328P used in the Arduino Uno states that the IO pins can handle up to 40 mA subject to a maximum total of 200 mA for the whole chip.

ATmega328 maximum current ratings.
Figure 4. The absolute maximum current handling capability of the ATmega328 and 328P micro.
At 20 mA the ATmega328P output is pulled up to 0.9 V above zero when low and about 0.8 V below positive supply when high.
Figure 5. At 20 mA the ATmega328P output is pulled up to 0.9 V above zero when low and about 0.8 V below positive supply when high.

Note on Figure 5 the \(V_{OL}\) voltage – the actual voltage measurable on the output pin (red) – when switched low and sinking 20 mA that the voltage won’t be zero as might be expected but could be as much as 0.9 V above ground. This is due to the voltage drop across the low-side transistor switch in the output.

Similarly, when the output is switched high and sourcing 20 mA the output won’t be +5 V (the test condition power supply voltage) but could be as much as 0.8 V below that.

It’s worth being aware of this as it could be significant in some low-voltage applications where there isn’t much “headroom” between the voltage required by the LED and that of the power supply.

Example 1 – 5 V supply

LED IV curve and calculation.
Figure 3. Using the LED IV curves to find the required R value for a green LED at 20 mA.

Figure 6 shows that the LED at 20 mA will have a forward voltage drop of about 2.2 V. If the supply voltage is 5 V then the resistor has to drop \(5 – 2.2 = 2.8\,\mathrm V \). The required value is \( R = \frac {V}{I} = \frac {2.8}{0.02} = 140\,\Omega \). The nearest standard value of 150 Ω will do fine.

The resistance calculation will be the same for the current sinking option of Figure 2.

Example 2 – 3.3 V supply

When running from a 3.3 V supply the headroom becomes substantially limited.

As the supply voltage is decreased to 3.3 V the "headroom" for driving an LED is reduced and, when output droop is taken into consideration, the device may not be able to provide enough current.
As the supply voltage is decreased to 3.3 V the “headroom” for driving an LED is reduced and, when output droop is taken into consideration, the device may not be able to provide enough current.

Here we can see that the LED is still requiring 2.2 V leaving 3.3 – 2.2 = 1.1  V for the resistor. If this 3.3 V chip’s output were to droop by, say, 0.5 V then that leaves us with only 0.6 V for the resistor: \( R = \frac {V}{I} = \frac {0.6}{0.02} = 30\,\Omega \).

The problem with this is that a low-value resistor is not a very good constant current source. If the forward voltage, \( V_F \) of the LED decreased by 0.1 V due to temperature or batch to batch variation then the voltage would go to 0.7 V and I would increase from 20 mA to \( I = \frac {V}{R} = \frac {0.7}{30} = 23\,\mathrm mA \). This might push the device a little closer to the absolute maximum ratings.

See all GPIO tricks.

Power calculations

Power calculations are required to ensure that devices operate within the manufacturers specified limits. In most cases these only require a single multiplication or division.

Power is measured in watts (W) or milliwatts (mW).


Given V and I …

Power in an electrical circuit is given by

\(P = VI\)

where P is power (watts or W), V is voltage (volts or V) and I is current (amps or A).

Example 1

I have a 12 V LED strip which requires 170 mA. How many watts is that?

\(P = VI = 12 \times 0.17 = 2.04 \, \mathrm W\)

Answer: 2 W.

Burnt resistor. Too much power and the smoke gets out.
A burnt resistor – the result of attempting to dissipate too much power in an under-rated component. A 1/4 W resistor would not last long at 2 W.

 


Given I and R …

From Ohm’s law we know that \( V = IR \) so

\(P = VI = IRI = I^2R\)

Example 2

There is 120 mA flowing through a 22 Ω resistor in my circuit. Will a 0.5 W resistor be able to dissipate the heat?

\(P =  I^2R = 0.12^2 \times 22 = 0.32 \, \mathrm W\)

Answer: This is comfortably inside the 0.5 W rating.


Given V and R …

From Ohm’s law again we know that \( I = \frac {V}{R} \) so

\(P = VI = V \frac {V}{R} = \frac {V^2}{R}\)

Example 3

I need to drop 10 V to feed an LED from a 12 V power supply. The resistor value is 490 Ω.

Q1. How much of my battery power will be wasted in the resistor?

\(P = \frac {V^2}{R} = \frac {10^2}{490} = 0.204\, \mathrm W \)

Answer: 0.2 W. A ¼ W resistor should be fine.

Q2. How much power will be dissipated in the LED? (Assume 2 V is dropped across the LED.)

Answer: First we need to calculate the current through the 490 Ω resistor.

\(I = \frac {V}{R} = \frac {10}{490} = 20.4\, \mathrm mA \)

Now we can calculate the power:

\(P = VI = 2 \cdot 20m = 40 \, \mathrm mW\)

5/6 or 83% of the power is “wasted” in the resistor.


Ohm’s law – LED resistor calculation

Ohm’s law states that the current through a resistive conductor (a resistor) between two points is directly proportional to the voltage across the two points.

\(I={\frac {V}{R}}\) where I is current (amps or A), V is voltage (volts or V) and R is resistance (ohms or \(\Omega\)).

Example 1 – resistor calculation

Resistor and LED.
Figure 1. Series connection of a resistor and LED. The voltmeters show the voltage drop across each element of the circuit.

I have a 5 V supply and I want to run a red LED at 8 mA.

We can see from the LED’s IV curve that at 8 mA the red LED will have a forward voltage of 1.8 V. That means there’s 5 – 1.8 = 3.2 V across the resistor. Using Ohm’s law we can calculate the resistance.

$$ I = \frac {V}{I} = \frac {3.2}{0.008} = 400~\Omega $$

390 \(\Omega\) is the closest standard value and that will be fine.

Don’t forget to check the power rating of the resistor! See Power calculations.

Notes

Note that the order of the components in this example doesn’t matter. The resistor can go between the +5 V supply and the LED or between the LED and ground. The same current will flow through the circuit and the same voltage drop will occur on the LED.