Sunday 29 November 2009

LED Current Calculation

At first glance, the calculation of current to an LED seems simple – you need a resistor to limit the current flow to the LED so it doesn’t draw to much and burn out.

But what value of resistor do you need, and how do you work that out?

It turns out the answer gets quite complicated, mainly due to the forward voltage (Vf) property of an LED. Forward voltage, voltage drop, or Vf, indicates the voltage that the LED reduces the circuit voltage by when current is flowing through it. The value of Vf varies according to the current and the colour and quality of the LED. As a rough guide:

Red 1.7Vf
Green 2.2Vf
Yellow 2.1Vf
Blue 4.5Vf
White 3.4Vf

So what does that mean? Well basically it means that having an LED in your circuit will reduce the voltage in the circuit by the amounts shown above.

All of the voltages in the circuit are relative to the source voltage (Vs).

So if I have a 6V lantern battery (6Vs) and I hook up a green LED to it, suddenly there’s only 3.8V flowing through the rest of the components in the circuit.

To prevent the LED from burning out, you need to limit the amount of current that flows through it, usually to a maximum of between 20 and 30 milliamps (mA). The way you do that is by using a current-limiting resistor.

To calculate the required resistor value, you need a new voltage measurement: Vs –Vf, or Vresistor. Vs-Vf is the amount of voltage flowing through the ‘other components in the circuit’, namely the current-limiting resistor being used to restrict current flow through the LED and prevent damage occurring to it or the rest of the circuit.

LEDs are pretty flexible and they will happily light up with 5mA or even less. With smaller currents they will not be at their brightest and it will be much nicer to see them shining away with their maximum of 20mA or 30mA.

So as an example, lets say I have a red LED rated at a maximum 30mA and I want to light it up as brightly as possible with the full 30mA current supply. How would I calculate the resistor values required? To do that you need to go back to Ohm’s law and apply a bit of theory. Ohm’s law states that current is equal to voltage divided by resistance:

I = V/R

or in this case I = Vs-Vf / R

Lets take our 6V lantern battery and a red LED to start with. In the chart above the red LED’s Vf is shown as 1.7 volts. These values are all entirely hypothetical at this point - in reality the LED’s Vf will vary and the battery will not produce a stable 6V. We’re going to start needing some real numbers soon, but as a place to start let’s calculate the resistor you’d need using the chart values and the lantern battery’s theoretical 6V as a voltage source (Vs):

30mA = (6Vs – 1.7Vf) / R

so 0.03A = 4.3V / R

so R = 4.3 / 0.03

so R = 143.3333333333333

so R = 143 ohms

To get started calculating the actual resistor required, you first need to get a more accurate measure of the LEDs real forward voltage drop (Vf). The easiest way to do that is to take a battery and a resistor, hook up the LED and measure it with a multimeter.

The resistor value calculated with the theoretical values should be close enough that nothing will be damaged by using it to test the actual values. Different colour LEDs will vary their voltage characteristics based on the current passing through them so you’ll get inaccurate readings if you supply a different current in your tests. In this case I calculated 143 ohms, which I’ve added to the circuit using a 100 ohm and a 43 ohm resistor in series:

misc   LEDs 165

Gator clips are your friend when working with a lantern battery, so that’s how I’m hooking up my LED to test. If you had a 9V battery you’d be better off with a breadboard and a nine-volt battery connector.

Here are the measurements I’ve taken with the multimeter on this circuit:

143 ohm LED test 002 
Source voltage 6.34Vs
143 ohm LED test 008 
LED forward voltage 2.54Vf
143 ohm LED test 006 
Resistor voltage 3.79V

So the actual voltage of the source was wrong in theory and so was the forward voltage of the LED. If you’d used the theoretical calculated 143 ohms you would have been way off, supplying a mere 26.5mA to your LED and how dull that would be :). A much more accurate calculation can now be made with the real values:

R = Vs-Vf/I

so R = 6.34-2.54 / 0.03

so R = 3.8 / 0.03

so R = 126.6 ohms

so R = 127 ohms

That works out quite nicely because I happen to have a 100 ohm and a 27 ohm resistor in my kit here, so connected in series I can create a 127 ohm resistor. Here’s the LED now fulfilling its potential and shining away with a clear 30mA flowing through it:

127 ohm final LED config - filmstrip

I’m still blinking and seeing little LEDs from the image burned into my retina from looking it straight in the eye. A new moon has appeared on the ceiling, an angry red moon. In other words, the thing is on and it’s bright. It is also nice and cool and has remained cool for a few minutes. It should remain cool as it is within its operating parameters. I think I’ll leave it on all day and test that theory (and the staying power of the lantern battery).

For further reading I’d recommend taking a look at these links:

Technical Charts Showing LED Characteristics:

LED Resistor Calculator:

No comments: