# LM317 current source

I want to use an LM317 to make a current source circuit for driving high power LEDs (500-700mA.) The schematic in its datasheet has no capacitor, but in some schematics there are one or two capacitors like the one below:

Are they necessary? If I omit them, can the possible ripples damage the high power LED?

I quote from a forum:

"Don't use a capacitor on the output when you are using the LM317 as a constant current source. A theoretically ideal current source has an infinite output impedance, whereas a theoretically ideal voltage source has an output impedance of zero.

If you use a capacitor on the output of your current source, then your "real world" current source is further away from the theoretically ideal current source, which is not a good thing."

Is it correct?

True, but irrelevant in your case. An LED does not change forward voltage quickly- there is a slow (thermal) change, but nothing on the order of microseconds where the caps have some effect. The caps may effect better stability so I'd suggest using them.

Edit: In simulation, with 100uH inductance (long wires with some loop area) in series with an LED load (3 x 1N4004) the circuit is close to being unstable (or at least it rings- the current overshoots as well as the voltage). 10uF in C2 position completely eliminates the overshoot- as you might expect all you can see is the 25mA current charging the capacitor. Below trace is without C2 and short across load removed at t= 100usec.

Now, with 10uF in C2 position:

Same thing but with 4 ohms rather than 50 ohms and only 30uH inductance (no cap), showing current.

• there is no advantage of placing that capacitor, It only could cause oscillation so you're better without it. Commented Aug 29, 2015 at 15:32
• Why do you think it could cause oscillation? Commented Aug 29, 2015 at 15:38
• If it would be used for something else like or a more inductive load. Or maybe even the power cable's inductance. I think it hasn't any advantages if you place the capacitor? And when you take the load of you need to make sure the capacitor is rated for the max output voltage of the current source. At least that's what I think. Commented Aug 29, 2015 at 15:46
• @Bruce- if the wires to the LED are long then the cap near the regulator will help that inductance issue. Yes it has to be rated for supply voltage in case the LED becomes disconnected. Commented Aug 29, 2015 at 15:49
• How would it help that inductance issue? Don't you just get an LC circuit? Commented Aug 29, 2015 at 15:54

Despite the theoretical considerations above, the practical LM317 articles using it a LED driver or (more generally) as a current source usually don't use any capacitors. This mini-survey includes

and various hobbyist sources like

Actually the latter is only one that includes two 10uF capacitors (one on input and one on output) when driving a higher power led string. It doesn't make it terribly clear if that's really needed though.

Nor does the LM317 datasheet recommend any capacitors when used as a current source. So, unless your're building your LED drivers for NASA, I think it's safe to omit all capacitors in such an application of LM317, unless you have a proven practical reason to include them in a particularly demanding case.

There are ample reasons for not putting a capacitor at the output of a regulator. But C2 is not there. R1 is in series with it, which completely negates the instability arguments. True, the cap tends to try to turn the current source back into a voltage source, but the LED's present so much load that C2 will have little effect. In fact, there's no effect if the power is unswitched (always on).

LED's don't care about ripple. Your eyes (or a video camera) might, if you can even see it. There shouldn't be any ripple unless the power supply can't keep up with the current.

A ceramic 0.1 uF on the input helps reduce noise from the power source, good practice. However, if you use a battery as power the circuit, this might not be an issue. In this case you might not want the capacitor because any leakage (such as an electrolytic) can slowly drain the battery if there is no power switch. A capacitor on the output can stabilize the operation and reduce ill effects from sudden connection or disconnection. I am using the LM317 as a 100 mA source for the purpose of milliohm measurements (4-wire, read voltage, multiply by 10) and the 47uF does not negatively affect multimeter reading. However, other uses of the circuit may increase or decrease the need for capacitance, so it's per application.

Below is the schematic for an adjustable laser diode regulator I built and have used for a few years now. It uses 18V from a laptop battery (reason for such wasted high voltage). It does use an op-amp instead of the LM317.

As you can see the step response is very clean with no overshoot that might damage the laser diode.

• This is a reasonably good answer to the question, "Design an op-amp based constant current source." It is not an answer to the OP's question which is whether capacitors are required on an LM317. Commented Apr 6, 2016 at 20:57
• Fair enough. I included this because I went down the same road as him; initially looking to use the LM317 to do the job and finally settling on the op-amp solution. Rather than withhold the information I figured I'd share another current-source implementation that actually works to drive a laser diode. Commented Apr 6, 2016 at 21:37