LEDs - Light 'em, Without Smokein'em!
One of the most common questions I see on electronics based forums is how to properly power an LED. Well, let me just clear that up, once and for all.
Most of the confusion seems to come from an LED's forward voltage rating. People see that and think no problem, I'll just run it at that voltage and viola, sweet LED glow will light up my days. Well, truth is, it's a little more complicated than that. LED's are current driven not voltage driven! Let's a take a closer look at that.
An LED is, essentially, a diode. And if you know anything about semiconductor diodes, you know there's an exponential relationship between the flow of forward current through a diode and the forward voltage across the diode. What this means is, a small change in voltage, will cause a large change in current. In other words, an LED is a current driven device. It's brightness is directly proportional to the current flowing through it. Double the current and you double the brightness. Halve the current and dim the LED by half. If you did the same with the voltage across the LED -- i.e. doubled it -- the current would increase by some exponential amount, and likely it would issue a loud pop and release a wisp of acrid magic smoke1. Run the voltage down to half what it was, and the LED will simply go dark.
Take a look at figure 1 (lifted from the Kingbright_LED_WP424HDT data sheet). According to the graph, if 1.9 volts are applied across this LED, a current of around 3.5ma will flow through it. A mere one tenth of a volt increase more than doubles the current [~3.5ma to ~7.6ma]! In other words, a 5.3% increase in the voltage [0.1/1.9 = 0.053] causes a 117% increase in the current!
Add another tenth of a volt [or 2.1 volts across the LED] and the current jumps to ~12.4ma!
Lets say you want to run this LED at the current that Kingbright used to spec most of the ratings in the data sheet -- i.e. 20ma. According to the graph, if you apply 2.25 volts across the LED, it will run at 20ma. If this LED is a typical case, then doing so should work just fine--as long as this voltage is dead on. But if the voltage increases anymore than a couple of millivolts, the current will exceed the maximum rating of 25ma! If the voltage drops by 100mv to 2.15, the LED current will drop to around 15ma and the LED will glow significantly dimmer.
But, there are a couple of other, even more important reasons for not relying on voltage to drive an LED.
1 - Magic Smoke is a whimsical term for the smoke released when electronic parts fry.
One Is Not Like The Other
Most LED data sheets show a typical forward voltage and a maximum forward voltage. The data sheet for the Kingbright_LED_WP424HDT, indicates a typical forward voltage of 2.2V and a max of 2.8V. Now, in my experience, I've never run across a brand new LED with a forward voltage anywhere near the maximum specified in the data sheet, but I have seen the forward voltage vary a fair amount between batches of LEDs, and even among LEDs of the same batch. For instance, I have a bag of Kingbright_LED_WP424HDT LEDs, and after testing just ten of them (at 20ma), I saw a variation of 200mv [1.78 - 1.80]. If I were to bias them at 1.79 volts, the ones that are 1.78 would probably run at around 25ma and the one that tested at 1.80 volts would probably run at around 15ma.
But, you might be saying, based on the above graph, these LEDs would run at around 1ma! This illustrates another reason to not rely on the forward voltage specification when biasing LEDs. I used a constant current source to test my LEDs. That constant current source made sure that 20ma was flowing through those LEDs while I tested the voltage across them. Clearly the above graph can't be applied to the LEDs that I tested. The implication being that there can be a very large variance between the typical spec and reality ("typical" being 2.25V and "reality", in my case, being an average of 1.79V). If I were to bias the LEDs that I tested, at 2.25 volts, more than likely they would fry!
So, what good is the graph if the actual LEDs can be so different from what it depicts? The graph can show the relative relationship between forward voltage and current--but, beyond that, not much good. But, if you current regulate your LEDs, you don't really need the graph.
The Once and Not Forever Forward Voltage
The forward voltage can shift over time. So, even if you tested each LED you were going to use, and then adjusted the supply to just the right voltage to run it at the current you chose, after awhile, that same LED would either smoke, or grow noticeably dimmer, depending the direction of the forward voltage change. In all the LEDs that I've witnessed this happening to, the forward voltage increased. If you current regulate the LED, a shift in forward voltage will have no consequence, as long as the current regulator can supply the required voltage—which isn't likely to be a problem, since the voltage changes we're talking about, here, are quite small.
The forward voltage will also change with temperature. And the temperature will change, because, even in an LED, not all of the power is converted to light--some of it will become heat. When an LED junction rises in temperature, the forward impedance drops. If the LED junction is powered by a constant voltage, this will result in a current increase. With increased current comes more heat and with more heat, lower impedance resulting in more current and so on until the LED goes not so gently into that good night.
A typical low power LED designed to run at 20ma will, likely, find equilibrium before runaway occurs, mainly because, though it does generate heat, it isn't much. But, this is a real problem with higher powered LEDs and if no current limiting is applied, the LED will, more than likely, destroy itself. Also, if there is more than one low-power LED clumped together in a confined space where each LED's minuscule heat production is combined with the heat from all the other LEDs, and where there is poor ventilation and/or heat conduction, then thermal runaway may toast the lot of them.
The Answer is Current Regulation
For the small LED designed to run at 20ma, current regulation can be as simple as a series resistor. At 20ma, not much power is lost in a series resistor, even at voltages as high as 12V. In such a situation the power lost in a series resistor won't be much more than 1/4 watt. But, for, say, a 1 watt LED (and above), quite a bit of power can be lost in a series resistor--especially since, for decent current regulation, a higher voltage is required across the resistor (more on that, below)--and as I pointed out earlier, good current regulation becomes more important where thermal runaway is an issue (as it is in higher powered LEDs).
When using a resistor to limit current, the larger it's resistance, the better. Here's why:
Consider that I = V/R [where 'I' is the current being regulated, 'V' is the voltage across the resistor, and 'R' is the resistance of that resistor]. If R is fairly large, then V will need to be large as well in order to cause the desired current to flow through an LED connected in series with R. With large R and V, any variations in the LED's impedance will have less effect on the current flowing through it. If R is such that V is closer to the voltage across the LED [i.e. a smaller resistance], then variations in the LEDs forward voltage will be more pronounced.
To illustrate this, check out Figure 3 and Table 1. Figure 3 is a schematic of an LED with a current limiting resistor in series with it. Table 1 shows four scenarios, with ever decreasing current regulation due to reduced values of R1 and V1.
I @ L1=3.0V
I @ L1=3.2V
I @ L1=3.4V
The first case [100kV/5M] is outrageous on purpose and it's inclusion will become clear in the next section. Notice, though, that at two decimal points of accuracy there is no change in the current -- at 3.0V across L1, the current is 20.00ma, as it is at 3.2V and at 3.4V. At 1.44k (which requires 32V to achieve a current in the neighborhood of 20ma), we start to see a variation in the current between our three L1 voltages. At 12 volts, there is yet more variation, at 5 volts the variations become significant and at 4 volts the variations border on scary. Thus, higher values of resistance in a series current limiting resistor, achieve greater levels of current regulation.
The drawback is the need for a higher voltage. Also, with higher voltage comes greater power loss in the form of heat. A higher wattage resistor is required which is more expensive and all that waste heat must be managed, also, typically, at a higher cost. This is solved by applying active elements to essentially amplify the resistance and thus get good current regulation but without the need for higher voltages.
But, for low power LEDs run at 20ma, it's not always necessary to tightly control the current, and in those cases [and truly in most cases] a resistor, along with a slightly elevated voltage, will do the job nicely.
Determining the value of a current limiting resistor (R1 in the example in Figure 3) is quite simple. Use the following formula:
R1 = (V1 - VL1)/ILED
Where V1 is the voltage source, VL1 is the typical forward voltage [or measured forward voltage] of the LED, and ILED is the nominal current level that you want to run the LED at. For example: say you have a Red LED that you want to run at 15ma and it typically runs at a forward voltage of 1.9V at that current and lets say this will be used in a car. Then figure on a voltage source of around 14V when the car is running. A good choice for R1 would be:
R1 = (14V - 1.9V)/15ma = 807Ω
Or a standard value of 820Ω, which will set the current to:
ILED = (14V - 1.9V)/820Ω = 14.8ma
When the ignition is off (and if LED is still powered from the battery), the current will drop to around:
ILED = (13.2V - 1.9V)/820Ω = 13.7ma
The current difference is not that great, but clearly, using a resistor to limit the current is not perfect. For cases where instability in the current is not acceptable, consider an active current regulator circuit [covered later].
And what about series strings of low power LEDs? Stringing LEDs in series requires less circuitry than powering each LED separately. Because the current is the same for all series elements, they all can be controlled by one current regulator. So, what is the maximum number of LED that can be strung in series? Lets, once again, use the example of a car. Say the lights will only be on when the car is running. The voltage on a car's electrical system can vary from 13.8 to 14.4V. Lets say we want a string of blue LEDs. A typical super bright Blue LED data sheet lists the maximum Forward Voltage as 4V, so that is what we should design to.
13.8V/4.0V = 3.45, so the minimum number of LEDs that will actually light at 13.8 volts, is 3. 3*4.0V = 12V, so that leaves a minimum of 1.8 volts for current limiting. First, lets look at how effective a series resistor will be. Since the highest current will flow at the highest supply voltage and lowest LED voltage, lets use those voltages to compute our resistor value. At 14.4 volts, our limiting resistor will have 14.4V - 3*3.0V= 5.4 volts across it:
Rs = 5.4V/20ma = 270Ω
Table 2 shows the effect of different Forward Voltage values on the current through our string of Blue LEDs with a 270Ω resistor to limit the current, at different car voltages (I added 12.6 volts so the case of lighting the string when the ignition is off, is included even though that isn't part of the original specification):
|Car Voltage||I @ 3.0V||I @ 3.2V||I @ 3.4V||I @ 4.0V|
Clearly active current regulation would be a better solution, even if you only include the "real world" results of Forward Voltages 3.0V to 3.4V. It may seem silly to include the oddly high value of 4.0 volts. I've been working with LEDs for decades, now, and I have never seen a fresh Blue or White LED with such a high forward voltage, and if you're doing a "one off" project just for yourself, then go ahead and ignore the 4.0V spec and squeeze that 4th LED into the string. You will have only yourself to answer to. But if you're designing something to sell to others, then I would play it safe and follow the manufacturer's recommendations.
A little story. This occurred decades ago. I was an Engineering Tech working for a Robot Vision company and was tasked with testing a new video memory card. The first batch worked great, and the engineer I was working with, a fresh young "super star" from a prestigious school, had done what no one before him had achieved -- a dynamic RAM video memory that could keep up with the video rates required for their vision systems. Previous to that, they used Static RAM, which is much faster, but a lot more expensive. Everything was fine until about a month later, when little white specks and flickering white lines started showing up on the video screen. When I brought this to the attention of the slick young engineer, he revealed that he had discovered that these memory chips performed faster than indicated on the data sheet and, thus, had ignored the minimum specification. He did call the manufacturer to ask if this would ever change -- if future memory chips would maintain this ultra-spec performance. And the memory chip manufacturer rep did assure him it was unlikely there was anything to worry about. A month later, in order to trim their manufacturing costs the chip manufacturer reduced a dimension on some part of the chip die which made the memory slower, but still within the parameters guaranteed on the data sheet. It was a bit of a financial disaster for the robot vision company, and a black eye for the young engineer's reputation.
Moral of the story? If you're designing for production, respect the data sheet!
Figure 4 is a Current Source circuit (as opposed to a "current sink" circuit). It, essentially, simulates a huge resistance, like in the first row of Table 1, but without the need for an outrageously large voltage. It does this by amplifying the resistance, turning a several-ohm resistor, R1, into a several-megohm resistor.
In the circuit, D1 and R1 set the current level
I = VD1/R1
where VD1 is the voltage across the Zener D1. The Op-Amp uses the PNP transistor [Q1] to do it's best to keep the voltage across R1 equal to VD1. For the values shown, the current through L1 will be regulated to 1V/50Ω = 20ma. For the best regulation, use a precision voltage reference for D1 and precision resistor for R1.
BTW: the minimum value of B1 is influenced by the voltage across R1 + about 2 tenths of a volt minimum for Q1 + the highest L1 forward voltage that can occur [Maximum forward voltage on the datasheet].
Here's a link to a Circuit Lab simulation of this circuit: www.circuitlab.com/circuit/5r425a/constantcurentleddriver_op-amp_01 Read the Description for more depth on how this circuit works.
Figure 5 is a simple little two transistor current regulator that works quite well. The regulation current is dependent on the Q1 Emitter-Base junction forward voltage. Vbe/R3 sets the current level. The 33Ω value for R2 should produce close to 20ma. This circuit is a bit temperature sensitive because the Q1 Vbe will change with temperature (around 2mv drop for every 1°C rise in temperature).
Here's a link to a Circuit Lab simulation of this circuit: www.circuitlab.com/circuit/kq5g88/constantcurrentleddriver_twotransistor01
Figure 6 is another variation. The value of R2 is a little harder to predict. Figure on around 0.55V across D1 and D2 and around 0.78V for the Q1 Vbe:
(2 x 0.55 - 0.78)/ILED) = R2
then hone it in via experimentation (or make R2 a 10Ω resistor in series with a 50Ω trim-pot). This circuit is also vulnerable to temperature changes, like the one in Figure 5.
Here's a link to a Circuit Lab simulation of this circuit: www.circuitlab.com/circuit/w59ucg/diode_transistor_ccurrent_led_driver
The ubiquitous LM317L adjustable regulator can be used to current regulate LEDs. In fact, that is what I used to test the Red LEDs I spoke of, above. Figure 7 shows how to do this. The current level is adjusted using the following formula:
I = 1.25/R1
Figure 7 also shows an example of current regulating a series string of LEDs. This can be done with any current regulator, as long as there is enough voltage headroom to maintain current regulation. The voltage required is a combination of the sum of each LED [maximum] forward drop, and the dropout voltage of the regulator. For example, in the case of the LM317L configured to current regulate three white LEDs, B1 would need to be at least:
Vb1-min = 3 * VLED + 1.30 + Vdo
Where VLED is the max forward voltage of the LED in the string, 1.30 is the max LM317L reference voltage and Vdo is the dropout voltage of an LM317L. Most data sheets that I have perused for 20ma White LEDs, specify around 4V as the max forward voltage, and the dropout voltage of an LM317L is around 2.3V (that's not in the data sheet, so I measured it). Thus, the minimum B1 voltage is: 3 * 4 + 1.3 + 2.3 = 15.6. Which explains the use of 16V for B1 in the schematic.
Here's a link to a Circuit Lab simulation of this circuit: www.circuitlab.com/circuit/6t2ebb/constantcurrentleddriver_usinglm317_01
Or, there is a cool little IC [it looks like a transistor, but technically it is an IC] that does it all, and can tolerate voltages as high as 90V and it's only 50¢ [30¢ in quantities of 25]! It's great for stringing a bunch of LEDs in series. It's hardwired to regulate at 20ma and since the current is the same for every component in a series circuit, it will keep the current at 20ma for every single LED in the string! You can find information on the CL520 (and others), here:
- Mouser: www.mouser.com/ProductDetail/Microchip-Technology/CL520N3-G
- Info: www.microchip.com/wwwproducts/en/CL520
- CL525 for 25ma: www.microchip.com/wwwproducts/en/CL525
If you want to control a number of LEDs with a Microcontroller, I suggest the CAT4008. You can serial control 8 programmable current sinks, for all kinds of cool lighting effects:
- Mouser: www.mouser.com/ProductDetail/ON-Semiconductor/CAT4008Y-T2
- Datasheet: www.onsemi.com/pub_link/Collateral/CAT4008-D.PDF
Switch Mode Current Regulation
In most cases these current regulator circuits are overkill for an LED that will be driven at 20ma. Even the CL520, at around a dollar at Mouser, doesn't always make sense over a 1¢ resistor. Active current regulation for low power LEDs really only makes sense for cases where the intensity of the LED needs to be carefully controlled or where the supply voltage might vary a lot or where a number of LEDs are strung together in series. But for higher power LEDs, a switching regulator will perform much better than a resistor in all cases. As with all linear regulation solutions, the waste heat dissipated in the series pass transistor becomes prohibitive at higher currents, like found in LEDs that run at 1 watt or above. At a point, a switch-mode solution makes more sense. More on that in a future blog!
There is another case, though, where a switch mode current regulator is the better choice for even small current LEDs--when driving them from a battery. There rarely is a good match between the battery, and the forward voltage of the LED (or LEDs) that will be powered by the battery. A typical low power white LED runs anywhere from 3V to 3.6V at 20ma. Two alkaline AA batteries in series have a nominal voltage of 3V (though I have measured voltages as high as 1.6V across a fresh AA battery). That might sound like just the right voltage to drive a 3.0V white LED, but another LED with the same part number, but from a different lot, might run at 3.2V or even higher. That LED wouldn't light up if placed across a 3V battery. And, what about when the battery runs down. When the cells drop by a mere one hundredth of a volt, their combined voltage will be only 2.8V, causing that LED to extinguish long before those batteries are drained.
That's where a switching regulator comes in. It will maintain the current through the LED at the same level even as the batteries drain. And, because it basically converts power, it will cause the power supplied by the battery to be nearly equal to the power used by the LED, even as the battery drains [minus loses in the regulator and surrounding components]. Thus, a far more efficient use of the energy supplied by the battery(ies). Here's an example. Say we want to run a white LED at 20ma from a 1.5V battery. 1.5V isn't enough voltage to light our white LED, which requires, say, 3.1V at 20ma. So, we use a Boost regulator to up the voltage to the 3.1V required. The regulator monitors the current and keeps it at 20ma, which in our case means the regulator's output will run at 3.1V. But, suppose that white LED fails and we need to replace it, and the only one we have in our parts bin runs at 3.4V when 20ma is drawn through it. No problem. Our Boost Regulator is capable of boosting the 1.5V from our battery much higher than even 3.4V. But, because our new LED only needed 3.4V to light up at 20ma, the regulator stop at 3.4V because it is a current regulator and when it sensed that 20ma is flowing through the LED, it stops raising the voltage.
Now, let's say our battery drops down to 1.4V. No problem. The current regulator can also boost 1.4V up to and beyond the 3.4V our new LED needs. In fact, the voltage on that battery can go as low as 0.5V and the regulator can still boost it up to 3.4V. This is a hypothetical case using a mythical regulator, but following are a couple of real-world cases. The Joule Thief, for instance, can boost as little 0.5V up to 3.4V and more [though it, technically, isn't really a regulator, in that there is no feedback loop to regulate the output voltage or current. As such, it isn't quite as efficient as an actual regulator, but it's simple and for non-critical cases, it works just fine.Here are some links to information about the Joule Thief circuit [also known as a "Blocking Oscillator"]:
- http://en.wikipedia.org/wiki/Joule_thief -- A Wikipedia article
- www.evilmadscientist.com/2007/weekend-projects-with-bre-pettis-make-a-joule-thief -- Nice article on building a Joule Thief
- www.bigclive.com/joule.htm -- Another article on building a Joule Thief
- http://youtu.be/0GVLnyTdqkg -- YouTube video on how to Make a Joule Thief
- http://youtu.be/B61DU7yEsPM -- YouTube video on how a Joule Thief works
- www.circuitlab.com/circuit/v2de5u/joule-thief -- A Circuit Lab simulation
- www.instructables.com/id/Joule-Thief-LED-circuits -- Another built-it article with interesting elaborations
- www.instructables.com/id/Joule-Thief-Circuits-crude-to-modern/?ALLSTEPS -- A variation
The CAT4137 isn't available at Mouser [unless you want to buy 3000 or more ;) ], but Digi-Key has it [P/N:CAT4137TD-GT3CT-ND]. Digi-Key also has one of the inductors recommended in the datasheet: [P/N:490-4061-1-ND] and the diode [CMDSH2-3 CT-ND]. The resistor [R1 15Ω] sets the current to 20ma. For other currents check the datasheet or use table 3, below. There is also a Club Jameco project that uses this part and a PCB is included -- but only for 1 LED: Mini-Maglite 2AA conversion to white LED
|LED Current (ma)||R1 (Ω)|