By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Allendale Jan 24th

LED Constant Current Source Scheme

Theory of Operation ...

All Topics | Latest Posts

Search for:  in Thread Title in  
Michael Gilligan29/10/2020 23:16:31
16632 forum posts
724 photos

I managed to tidy-up some of my mis-filed documents today, and rediscovered this : **LINK**

It’s a clearly written page and a half , describing the optimised use of the LM317L as an LED driver.

... What’s not to like ?


Georgineer30/10/2020 01:11:20
410 forum posts
20 photos

That's a clever bit of kit! I've saved myself a copy. Thanks, Michael.

George B.

duncan webster30/10/2020 01:41:46
2846 forum posts
43 photos

Simpler to use a fixed voltage regulator and 3 dropper resistors to control current down each leg? If you want say 2v across each diode and 50ma per leg then 8v regulator and 40 ohm resistor

Joseph Noci 130/10/2020 05:38:50
778 forum posts
984 photos

Whats not to like is the time, ink and paper 'engineers' waste in thinking up this stuff...

Duncan has it for simplicity, and if you have a deep desire to use a constant current mechanism, the circuit of figure 2, sans LEDS, costs 11 US cents. The MPS2222 or similar, and three resistors costs 22 US cents, so just use three figure 2 circuits - less assembly, fuss, cost...So many of these 'neat' app notes by 'application engineers' 'is' just so much intellectual masturbation...My rant for the day...

Bring back the likes of Bob Pease, et al..


John Haine30/10/2020 07:03:32
3422 forum posts
184 photos

Now I was expecting something that controlled the current more efficiently, like using a series inductor as a "dropper" in a buck converter arrangement. If you had say a 12V supply and wanted to run a bright LED without making either a resistor or an LM317 rather hot, this would be useful.

Michael Gilligan30/10/2020 07:06:48
16632 forum posts
724 photos

I will get back under my stone sad

Glad to see that George appreciated it though.


Mike Poole30/10/2020 07:14:16
2808 forum posts
66 photos

Working for a German car manufacturer I became convinced they have a department of complication, should anyone come up with a simple solution to a problem it would be referred to the department to add complication so no simple person could quickly work out what was happening. Forty years ago spotwelding robots did two things, they either moved or moved and welded. You wouldn’t believe how complicated the programs have become, they still move and weld but the amount of baggage they carry to try and report helpful messages just burys the core task program. The same has happened with PLC programs, In 1980 a Modicon 384 PLC with 4K of memory was running a few paint shop conveyor systems with useful diagnostics, some programmers were fantastic at getting a quart into a pint pot.


Joseph Noci 130/10/2020 07:31:08
778 forum posts
984 photos
Posted by Michael Gilligan on 30/10/2020 07:06:48:

I will get back under my stone sad


On the contrary Michael!!!

I applaud anything that promotes thought and intellectual dissent!

Don't you dare hide away..!


depends what you are trying to do - If its save pennies in production, the LM317 is by far cheaper. If its to increase the general EMI noise levels in the world, the switch mode converter is an excellent solution. And reduces the MTBF, can be sold at greater prices 'cause its now a 'digital LED controller', etc, etc...KISS!!

The LM3127 @ 12V Vc, a 5mA hi-bright led, will dissipate 50mW - hardly heat. Add 4 leds in the string and you have 9 times the brightness for 3 times less heat in the LM317...

How many here have even considered any of these routes when you wanted a LED on/off indicator on your lathe/mill/clock/whatever??? Just stuck in a led, a resistor and found some source of non-lethal voltage, ignored the heat soaked resistor, and got on with it!

Now where's my stone..



Edited By Joseph Noci 1 on 30/10/2020 07:31:29

Michael Gilligan30/10/2020 08:23:06
16632 forum posts
724 photos

I could probably contrive a tenuous link to this story, Joe ... but I won’t bother

Suffice it to say that I think you might find this of interest : **LINK**

**LINK** :


Gene Pavlovsky09/11/2020 17:21:47
105 forum posts
77 photos

LM317 is quite a versatile device, you can make constant voltage or constant current regulators with it, among other things.

The application notes unfortunately don't tell you what is the maximum operating voltage and wattage this setup can handle. Datasheet suggests max Vout of 37V and current Iout of 1.5A. I am thinking that with a 36V supply, you could operate up to 11 (assuming Vf=3V) high-power white LEDs in series, <= 50W max. The datasheet suggests max dropout voltage is 3V (highest at the max current), so at worst it would dissipate 3V*1.5A=4.5W, and is going to need a heatsink. But not too bad.

To people suggesting dropper resistors - for low power stuff, resistors are fine. If we're talking about high-power LEDs (CREE XM-L etc, high-power COB LEDs), you need a constant current source. With my previous example, 36V supply, 11 LEDs in series (Vf=3V), we have 33V Vf on the LED chain, if we want 1A current, we can calculate that a 3Ohm 33W current limit resistor is needed. It will be huge, expensive, and dump 33W of energy as heat.

I am not sure I would go with LM317, as there are more efficient and modern devices specifically made for the purpose, and more importantly for me (not an expert in electronics), I would be able to find in their datasheets some info regarding how many volts/watts it would handle.

I'm currently playing with making a high-power ring lamp using an AMC7140 constant current chip and some CREE XT-E LEDs. AMC7140 can handle up to 50V at 700 mA, and has a low drop-out voltage. Current is set via a resistor, there is also an ENABLE input pin. This allows to use either a variable resistor (pot) or PWM for dimming. My plan is 8 XT-E LEDs and a 24V supply.



Robert Atkinson 209/11/2020 19:03:11
820 forum posts
17 photos

For a linear regulator the LM317 is hard to beat. Two components for a constant current source. Unlike a series resistor the current is constant regardless of the supply voltage. This would allow for instance a single design for 12 or 24 Volt systems. It also stops the light intensity varying with supply voltage e.g. in a car where voltage varies with engine off or running.

The LM317 circuit is floating and only sees the input /output differential which can be up to 40V for the standard device. This means you could run it on voltages higher than 40V if the difference between the supply and LED forward voltage is less than 40V.

Using a fixed Voltage regulator like a 7805 just increases the power dissipation in the current setting resistor an increases the voltage ovehead required.

Joseph Noci 1 I'm not sure what figure 2you are referring to, only Figure 4 has MPS2222 in it and they are not setting the current, just protecting from the failure of one string of LEDs. Pretty much any single transistor current source will need individual selection of components to set a specfic current as the current will deoend in the transistor gain, Vbe etc. With the LM 317 the tolerance is pretty tight.

Robert G8RPI.

Anthony Kendall10/11/2020 09:12:12
67 forum posts

I'm surprised there isn't a willie-waver suggesting an Arduino controlled LEDwink

Howi10/11/2020 09:26:51
286 forum posts
19 photos
Posted by Anthony Kendall on 10/11/2020 09:12:12:

I'm surprised there isn't a willie-waver suggesting an Arduino controlled LEDwink

my willie is waving to all and sundrey, what a marvelous suggestion, unfortunately I dont think it has enough ports or processing power for the job in hand (there;s a pun in there somewhere......)

perhaps a RasPi4 might be better. I love reinventing the wheel, as I have so much time on my hands.

Why over simplify things just because you can?

Gene Pavlovsky10/11/2020 12:40:56
105 forum posts
77 photos

I don't see anything wrong with using an Arduino for LED control? Depending on what you want to achieve, it might be overkill or a cheap and easy solution.

Each Arduino (I'm assuming we're talking about 5V ATmega based ones; since they also have some models based on different MCUs, some of them 3.3V) output has an absolute max power rating of 40 mA, with 20 mA being the recommended continuous current (if I remember correctly). You can directly drive just the typical 3mm/5mm LEDs at 20mA. For anything more powerful, e.g. a 12/24V LED strip, one would use a power MOSFET with it's gate driven directly by Arduino's pin, or by an extra BJT or even a gate driver if really fast switching (high PWM frequency) is needed.

One could also hook up an Arduino output pin to switch on/off the constant current LM317 regulator that this post started with. The way to do it would be via a signal MOSFET which would ground the LM317's ADJUST terminal to ground (reducing the Vout to 1.2V and effectively switching off the LEDs). The Arduino can be used to PWM the LEDs for dimming and/or fading.

One benefit of LM317, compared to a large number of more modern regulators and LED drivers, is that it can be used for high-side driving (regulator is between Vcc and the LEDs), e.g. in an automotive situation the LED's negative pole can be grounded directly to the chassis ground. Most constant-current LED drivers (like the AMC7140 I mentioned) are designed as low-side drivers, so that LED's negative can't go to the common ground but must go to the driver.

Considering that Chinese Arduino clones are ridiculously cheap (2-3 euros per piece), it makes sense to use them in all sorts of projects even if it's a complete overkill. Some models are really quite small (Nano, Pro Mini). For many projects, a standalone MCU such as an 8-pin ATtiny25/45/85 is enough and can make for an even smaller board especially if using a SOIC-8 SMD chip. You won't save much money versus using a Nano or a Pro Mini, though. Most of the stuff on an Arduino board is just support circuitry - voltage regulator, USB-to-serial converter and associated caps and resistors. You don't really need that in the final project, it's just useful for fast prototyping, programming and debugging. One example - if you want a PWM controller for LEDs or a motor, you can use a simple NE555 timer-based circuit, or an ATtiny MCU. Circuits for both options are easy to find online. Compare how many more parts (diodes, resistors, capacitors) the NE555 circuit has, compared to ATtiny. At Mouser, ATTINY25-20PU is 0.915 €, NE555P is 0.39 €, so you're saving 50 cents on the IC, but pay a bit extra for all the extra parts, and extra time and board space for soldering it all together. With an MCU you can make adjustments (change the PWM frequency, add fade-in/fade-out for LEDs or soft start for a motor) with just a reprogramming, while with discrete components you have to rework the circuit. Note: I am not advocating to use an MCU in each and every case, for many projects it can also be fun and educational to implement things in the hardware. But with their low prices, reasonable capabilities and ease of prototyping, cheap MCUs are a very attractive choice. There are also nice and cheap boards with 32-bit micros - STM32 and ESP32 for example. With the latter you can even control your lamp with WiFi/Bluetooth, or maybe monitor power consumption and log it to the cloud. The possibilities are crazy and endless, no wonder people are putting these micros in every little thing.

Gene Pavlovsky10/11/2020 12:41:03
105 forum posts
77 photos

By the way, Texas Instruments have an improved replacement for LM317 - LM1086. It's low dropout voltage (1.5V max) means the regulator wastes less power as heat. Note: 1.5V is not that low of a dropout, e.g. a small low-current reg MCP1700 drops just 178 mV at 250 mA. LM1086 is a drop-in 1.5A replacement for LM317, while LM1085/1084 are similar units rated for 3A/5A respectively.

I don't quite understand the criticisms here, guys. Perhaps it comes because Michael posted the application note without mentioning a particular task to be solved.

For simple lights that turn on and off, you don't need advanced circuitry. LED strips, including high-powered ones, are widely used with constant voltage sources (current limiting resistors are built in). A more advanced circuitry won't help you drive them (and since the resistors are already there, they will still generate waste heat even with a CC driver). LED strips are dimmed with PWM, a pulse generator (e.g. a simple timer like NE555, or an MCU such as Arduino) switching a power MOSFET to turn the LEDs on and off faster than the eye can see (too low PWM frequencies may still be noticeable as flickering by especially sensitive people or video cameras).

Constant current sources are useful for driving high power LEDs, or where stable voltage is not available, e.g. in a car you may have 12-15V, a typical LED+resistor arrangement should have the resistor selected for the worst-case scenario (highest voltage), which means they would be more dim when the voltage is low. This may or may not matter in your particular application. If it doesn't matter, just use the resistor. I once made a custom motorbike taillight with Piranha Superflux LEDs and current limiting resistors on a perfboard, and it worked quite nicely for a few years until I sold the bike and moved out from Thailand.

But if you are making a custom flashlight, machine lamp or a desk lamp, using 1 or a few high-power (few hundreds milliamps or even more than an amp current) LEDs, I think a constant current supply of some sort is the only reasonable options, even if you don't plan any dimming/fading. Also if making a battery-powered LED flashlight/lamp, a CC supply should be able to achieve higher efficiency and so give longer runtime. Good flashlights have such cool features as PID thermal regulation, allowing to run the flashlight as hard (bright) as possible but then reducing the current once a set temperature is reached, to maintain the LED temperature at high but safe levels. This squeezes out max possible lumens from a LED while preserving it's rated lifetime. Good luck implementing this feature with a constant voltage supply + current limiting resistor.

To summarize: you should pick the simplest and most reliable design which achieves your particular goals. What it's going to be depends on the goals, and a more complicated designs might be required in some cases.


Martin Kyte10/11/2020 13:20:11
2121 forum posts
37 photos

For low current leds (up to 120mA) the simplest option has to be a contant current diode such as


anything in the high current range I use switching regulators.

regards Martin

Simon036210/11/2020 14:19:07
200 forum posts
73 photos
Posted by Joseph Noci 1 on 30/10/2020 07:31:08:

How many here have even considered any of these routes when you wanted a LED on/off indicator on your lathe/mill/clock/whatever??? Just stuck in a led, a resistor and found some source of non-lethal voltage, ignored the heat soaked resistor, and got on with it!


my solution every time....!

modeng200010/11/2020 15:17:06
236 forum posts
1 photos

Didn't know about the AL5808, thanks.


Gene Pavlovsky10/11/2020 16:05:09
105 forum posts
77 photos

For a simple indicator / pilot light, assuming Vf=2.0 (green LED) that we want to run at 20 mA, you'd need a >=500 Ohm 1/4W resistor on 12V and >=1100 Ohm 1/2W resistor. This can be reasonable.

It wouldn't work as easily with 220V. Calculation suggests a 5W resistor and I guess the AC would need to be rectified? I wonder what's inside one of these 220V (or even 380V) 22mm panel mount LED pilot lights. Surely not a big-ass resistor? For Schneider Electric XB4, the info page says: light block supply Via transformer 1.2 VA 24 V

I wonder what kind of transformer/rectifier they fit in such a small space.

Martin, the diodes you proposed look interesting (for <= 150 mA) but neither Mouser nor DigiKey sell them, they only sell evaluation boards (non stocked) for 60 EUR a pop. I think this is geared to auto makers and other OEMs. What use is it to us hobbyists if we can't buy it anywhere?

As for switching regulators. There are plenty of CC CV buck converters on eBay, many based on LM2596. The ones with 2 or 3 pots allow to set up either constant voltage or constant current. However, I think for nice user experience, every lamp ideally should be dimmable. How does one achieve dimming with such a supply (besides replacing the onboard pot with an externally mounted pot that the user can adjust, or using a digital pot)? LM2596 IC has a shutdown input (pull low to enable, pull high to disable), on these Chinese regulator modules it's grounded to permanently enable the regulator. The datasheet doesn't say anything about how long it takes the regulator to start-up, so it's not clear if this shutdown input can be used to control the regulator with PWM. What sort of switching regulators do you use, and is there a way to dim them?

Martin Kyte10/11/2020 17:07:57
2121 forum posts
37 photos

I have always Pulse width modulated my switching regulators for Biogenetics work for the basic reason that the wavelenth doesn't change if you use the same driver current. They are perfectly happy pulsing at 2 or 3 kHz.

The current limiting diodes I linked to was an illustration of principle really. There are other devices at least some of which are going to be purchaseable. That was an RS data sheet and they sell to joe public.

regards Martin

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Latest Forum Posts
Support Our Partners
Eccentric July 5 2018
Eccentric Engineering
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest