Calculating an LED resistor: a technical test
Setting up this website, I have certain requirements. Superscript, subscript, equation display, logical picture display, charts, formatting that I like and presents information in a manner I think works1. This is the useful test post to evaluate all of these capabilities. The subject below is covered in several other places on the wide wide webz.
Calculating current-limiting resistor for an LED
An LED is a great thing. It makes a great deal of light with relatively little heat and over a long life. However, LEDs are also a bit more sensitive to power requirements and more easily damaged than other indicators and/or illuminators6. LEDs require a minimum amount of voltage before they will turn on, producing any illumination, and have a maximum amount of current they can tolerate before their lifespan is degraded (or they fry; I consider this a notable degradation of the expected life of the product).
Refer to the diagram to the right. An LED is a diode; as such there is a voltage threshold below which no current will flow and above which current will. This forward voltage drop of the diode, defined as Vf, varies depending on the type of LED used2. Once voltage exceeding the forward voltage is applied across the LED, current will flow. The LED has a maximum forward current (and/or typical, and minimum, too) given by If, where the LED will emit light of the specified intensity and frequency for the given lifetime. If the datasheet or part spec does not indicate if this is a typical or maximum value, assume it is maximum.
Note: exceeding the maximum current level of an LED will not necessarily fry it immediately. Too, it will be brighter. However, exceeding it will decrease the lifespan and luminous efficiency3.
A current limiting device must be used to protect the LED. The simplest way to limit current is to add a resistor, R, in series with the LED.
Calculating the resistor
To get the equation to calculate the resistor, we require a bit of algebra and the application of Ohm’s Law and the power law:
Ohm’s Law: , Power law:
Resistors develop a voltage drop across them based on the amount of current passing through them and their resistance. Given the voltage available to power the LED, Vcc, and the forward voltage Vf required by the LED to turn on, the resistor has to generate a voltage VR across it at the forward current If such that that
Solve for the voltage drop across the resistor, plug that into Ohm’s law for voltage, and solve for the resistor value needed.
Calculate the power dissipation of the resistor by solving Ohm’s law for voltage across the resistor, plugging it into the power law, and solving the power law for power (P).
Resistors are manufactured in a series of fixed values and power ratings (maximum dissipation before decreased life). Choose the value closest to the calculated resistor value (round up for less current / more longevity, round down for more current / more light). Choose a power rating equal to or greater than the calculated power dissipation.
Applied example: Blue LED running from a car battery
Below is an example of calculating the limiting resistor for a blue illumination LED installed in a car.
, nominal car battery voltage. Do note, though, that the battery can easily run up to 14.5V during charging and down to 8V during cranking.
, from the LED forward voltage chart (reference Wikipedia).
|Color||type||Vf (nom)||If (typ)|
|Red||indicator||1.6 V||2 mA|
|Yellow||indicator||2.1 V||2 mA|
|Green||indicator||1.9 V||2 mA|
|Blue||illumination (5mm)||3.6 V||20 mA|
|White||illumination (5mm)||3.6 V||20 mA|
|White||illumination (1 W)||3.6 V||300 mA|
|Ultraviolet||illumination (5mm)||3.8 V||20 mA|
, a typical value for a 5mm (T-1 3/4) illumination LED. As always, if the datasheet says differently, start with that value instead5.
According to the standard resistor value chart found here, 470Ω is the nearest 5% tolerance value4. Plugging that value into the power equation gives you the minimum power rating for the resistor
1 Including footnotes. Proper, self-counting footnotes. I like footnotes. RIP Terry Pratchett.
2 Type being both high-brightness (illumination) vs indication LED and type being color of light emitted. It also varies based on current through the device, temperature of the device (generated internally and influenced externally), ambient light condition (LEDs are light reactive devices), age of the device, by batch and process, and probably others that I have missed. Vf listed on datasheets usually qualifies and controls variables, and Vf listed on device briefs and summaries is usually typical at steady state and room temperature.
3 More information see this trade magazine article
4 Tolerance is how close a resistor (or part) is to the listed nominal value. A 5% 100Ω resistor may actually be anywhere between 95Ω and 105Ω. Generally parts with tighter (smaller) tolerances are more expensive, so the trade-off is how critical is it for your value to be as close to nominal as possible? For basic LED current limiting, the answer is usually not very critical.
5 I say start simply because datasheets sometimes do not tell the whole picture and are occasionally wrong (due to manufacturer error or incorrect association with a part). Too, you may decide that to use the part in a way that is not specified by the datasheet, and it will work in an acceptable manner. But, like a new recipe, start by following what is listed before messing around too much.
6 There is a great deal of difference between illuminating LEDs and indicating LEDs. If you have ever had a device with a blue LED that you have had to cover with a towel to sleep at night, you know why this distinction is important. FOR THE LOVE OF CORNEAS AND SLEEP USE THE APPROPRIATE LED.