LED Calculations

LED Calculations | General Electronics LED_image

This article was written with contributions from Jon Chandler, Graham Mitchell and Davide Andrea.  Please review author's comment here.

LEDs require a resistor to limit current through the LED.  Calculating the required resistor can seem like a mystery but it's very simple, even with LEDs of unknown types.

A basic LED circuit is shown below. It might be powered by a battery or a microcontroller port pin.  The resistor controls the current flow through the LED; the current flow is the same through the entire circuit, as indicated by the red line.

LEDs serve a variety of roles from panel indicators to powerful arrays that light up the night.  This article covers small LEDs that might be used as indicators in a microcontroller circuit or flashing elements in fantastic art project.  Generally, LEDs in this range typically draw up to 25 mA.  For high-power LEDs specialized driver circuits are usually used.  LEDs come in a wonderous range of shapes and sizes - some common packages are shown here.

typical_LEDs

LEDs of this type are typically rated to draw 10 mA - 20 mA.  The required series resistance will depend on the supply voltage, the voltage drop across the LED and the desired current.  The voltage drop (Vforward) across the LED depends on the LED chemistry, the current through the LED and the temperature.  For standard red, yellow and green LEDs, Vf is usually around 2 volts which serves as a good starting point for these calculations.  To calculate the required resistance, basic circuit analysis results in the following relationship:

circuit_2

 





The source voltage is the voltage supplied by the battery or microcontroller port.

Using Ohm's Law, VR can be calculated:






Combining equations 1 and 2:


Rearranging equation 3 yields:



Suppose a standard red LED is to be operated from a microcontroller port pin operating at 5 volts and the rated LED current is 10 mA.  For a typical red LED, assuming Vf = 2 volts will be close enough.  From equation 4:


The closest standard resistance value can be selected from a resistor table.

Calculations for Undocumented LEDs

See LED Calculations - The Lab Section for real-world tests of the following techniques.

The above calculations are based on knowing Vf .  For standard brightness red, yellow and green LEDs, a Vf  of 2 volts is a safe assumption.  For high-brightness LEDs and other colors of LEDs, Vf can range from 1.8 volts to 3.5 volts or higher as shown in the table below.

Color Material Wavelength (nm) V-forward
Super Red GaAIAs 660 1.8
Green GaP 565 2
Red GaAsP 635 2
Red AlInGaP 636 2
Orange AlInGaP 610 2
Yellow AlInGaP 590 2
Amber GaAsP 605 2.1
Red GaP 700 2.1
Green GaP 555 2.1
Green AlInGaP 574 2.2
Blue SiC 430 3.5
Green InGaN 505 3.5
Blue InGaN 470 3.5
White InGaN   3.5
Green InGaN 525 3.7
Green InGaN 525 4
Blue SiC 430 4.5


If the LED is a known type, Vf can be determined from the data sheet for the desired operaing current and the needed series resistor calculated using the above equations.  Below is a typical I-V curve for a family of LED colors.

Typical I-V curve(click to enlarge)

If we want to operate the LED on 10 mA to get moderate brightness, the Vf for the various colors of this LED family can be read from the graph.

Color Red High Eff. Red Yellow Green Blue
Vf 1.8 1.9 2 2.25 3.6


When the LED specifics aren't known, such as when the LED comes from a grab bag, the situation is a bit more tricky.  As seen from the table above, color isn't a reliable indicator of Vf.  Since Vf is a function of current as shown in the graph above, calculating the needed series resistance to achieve a desired operating current can be tricky.  Three options for determining the LED characteristics are presented below, ranging from "close enough" to highly accurate.

Click on the following tabs to view each topc.

Practical Method

Practical Discovery

With the absence of a datasheet, how can you safely drive LEDs from an assortment grab bag? As shown in the chart, color isn't a very reliable indication. Using the basic circuit (a 470 ohm resistor is a safe start point), the current can be easily measured with a DVM in series with the LED.  Reduce the resistor value until 10mA is generally a safe level to drive LEDs, a potentiometerwould be handy for this.

potentiometer-led

OHMs Law + LEDs

OHMs Law + LEDs

At the beginning of the article we looked at transposing Ohms law for calculating the required resistor in an LED circuit. This works fine for LEDs operating at their rated specifications. If you were to bias the LED at half forward current (to save power), Ohms law can be used to create a near accurate result.

Equation 4 allows us to calculate a resistor based on lower currents.



Earlier the equation was used to calculate the resistor at 10mA. If you are willing to trade off brightness for low current (say 5mA), then plug in the values and recalculate for R.

The 'Right Way'


Given the desired current, what should the resistor value be?

As discussed by DavideAndrea, here's the method for calculating the resistor based on the desired current (you will need some additional information usually found the datasheet):

  • On the LED’s V-I curve, see the LED voltage at that current.
  • Subtract that voltage from the supply voltage
  • Divide that difference by the desired current: that’s the resistor value

calculate-resistor

Given the resistor value, what’s the current?

DavideAndrea also described how to proceed if the resistor value is already defined and you want to know the resulting current:

  • Divide the supply voltage by the resistor value, to get the max current
  • On the LED’s VI graph, extend the X-axis to the left to 0 V, and to the right to the supply voltage
  • On the Y-axis of the LED’s V-I graph, , mark the max current
  • On the X-axis of the LED’s V-I graph, , mark the supply voltage
  • Draw a line between those 2 points
  • Mark the intersection between this line, and the LED’s V-I curve: that’s the operating point
  • The current of that intersection, is the LED current

mt_ignore:calculate-current

Resistor Power Dissipation

The current-limiting resistor for an LED must be rated to handle the power dissipation across it, which depends on the voltage across the resistor and the current through the resistor.

Power is equal to volts x Amps:

Using Ohm's Law and substituting for the voltage across the resistor:

Considering the first example from above:

For the example, even a 1/16 watt resistor will handle the power dissipation.{/sliders}

LED Polarity

Nine tines out of ten, the following diagram will be accurate for determining LED polarity. There is the odd chance that a manufacturer does not comply.

LED_Polarity


Please feel free to leave comments and ask questions below.


Posted: 6 years 7 months ago by Jon Chandler #7344
Jon Chandler's Avatar
I've been thinking about this subject for several days - it seems like a topic that some people have trouble grasping. Today I was spurred into action after reading a 4 page forum thread on that forum which shall remain nameless where mis-information and confusion were the rule....

One point I didn't explicitly state in the article is that it doesn't matter how much current the voltage source is capable of providing - the current through an LED is limited by the resistor in the circuit. I really think this point should be self-evident but here it is just in case its not.
Posted: 6 years 7 months ago by Jon G #7343
 Jon G's Avatar
One point I didn't explicitly state in the article is that it doesn't matter how much current the voltage source is capable of providing - the current through an LED is limited by the resistor in the circuit. I really think this point should be self-evident but here it is just in case its not.

I'm ashamed to admit this, but until I read your power supply article... I did not understand this concept. Understanding the role of the capacitor in the power supply made it perfectly clear what was going on.

Still need to read your most recent article.
Posted: 6 years 7 months ago by Jon Chandler #7342
Jon Chandler's Avatar
There is a big misconception among people that a power supply somehow "forces" current on a circuit. That somehow a circuit that's ok with a 5V 100 mA supply will somehow burst into flames if a 5V 1000 mA supply is used. The circuit will only draw the current it needs and no more.

There is one caution that needs to be taken however. Suppose that you're powering you dev board from a PC power supply capable of supplying 5 volts at 25 amps. The circuit will be perfectly happy using the few mA that it wants...but if there's a short of any kind, that 25 amp capacity may vaporize the wires to the circuit board or result in exploding parts. In the power supply article, I showed how a cell phone supply will just output less voltage if there's a short - they play a little more nicely.
Posted: 6 years 7 months ago by Graham Mitchell #7346
Graham Mitchell's Avatar
Great article Jon. Well structured and awesome use of the equation editor.

A quick note on the LED polarity; check the datasheet! Nine times out of ten the flat edge on a LED package is the cathode, but not always. I've been bitten by this before
Posted: 6 years 7 months ago by jmessina #7347
jmessina's Avatar
The table even shows why certain LED's (InGaN-based ones like blue and white) won't work very well if all you have is a 3.3V circuit.
Posted: 6 years 7 months ago by Jon Chandler #7348
Jon Chandler's Avatar
Excellent point Jerry! I failed to mention that.

I recall seeing tables similar to this one of chemistry vs. forward voltage, but Google was not my friend yesterday. This table was boiled down from several specification pages on the Lumex web site, so I may have missed some options.
Posted: 6 years 7 months ago by DavideAndrea #7349
DavideAndrea's Avatar
Nice article... except there's room for improvement.

* You cannot calculate LED current using linear equations, because the LED's V-I curve is not linear
* You cannot determine LED polarity by looking at its guts

I have made some suggestions for your article in this page.

Thanks,
Davide
Posted: 6 years 7 months ago by Graham Mitchell #7350
Graham Mitchell's Avatar
Thank you for the quick feedback Davide - the article has been updated.
Posted: 6 years 7 months ago by DavideAndrea #7351
DavideAndrea's Avatar
Thank you for the quick feedback Davide - the article has been updated.

Thanks!

Davide
Posted: 6 years 7 months ago by Jon G #7352
 Jon G's Avatar
The info from Davide is great if you have the datasheet for a given led. However, part of the purpose of the article was to describe what to do if you don't. Are we to take away from this that, without the datasheet for a given led you cannot drive it properly?

If no -
Instead of simply proving a piece of the article incorrect, please help find a solution to the problem which still exists... What to do without the datasheet. I don't see where that has been done.

Thanks

Forum Activity

Member Access