May 6

# 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: $V=I*R$, Power law: $P=I*V$

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 $V_f+V_R=V_{cc}$

Solve for the voltage drop across the resistor, plug that into Ohm’s law for voltage, and solve for the resistor value needed. $V_R=V_{cc}-V_f$, $V_{cc}-V_f=I_f*R$ $R=\frac{V_{cc}-V_f}{I_f}$

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). $V_R=V_{cc}-V_f=I_f*R$, $P_R=V_R*I_f$, $P_R=I_f*R*I_f$ $P_R=I_f^2*R$

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. $V_{cc} = 12.6V$, 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. $V_f = 3.7V$, 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 $I_f = 20mA$, a typical value for a 5mm (T-1 3/4) illumination LED.  As always, if the datasheet says differently, start with that value instead5. $R_{calc} = \frac{12.6V - 3.7V}{20mA} = \frac{12.6 - 3.7}{20 x 10^-3} = 445 \Omega$

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 $P_R = 20mA^2*470\omega = (20 x 10^-3)^2*470 = 0.188 W = 188 mW$

The resistor chosen should be a 470Ω, 5%, 1/4W carbon film resistor, which you can find at Mouser, Digikey, or other parts vendors.

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.