# LM317T Voltage Regulator

#### rappa

Joined Nov 17, 2008
11
I'm working on a circuit to drive a 3W RGB LED that uses the LM317T in the constant current configuration. From what I've read, the LM317 provides constant current, even with varying input voltages (within limits).

Now for my question: given that LEDs have a varying forward voltage drop, depending on various conditions, such as temperature, does the LM317 account for this (i.e. will it be able to maintain 350mA while the forward voltage drop of the LED increases)? If the answer is no, then I'm not sure if it still makes sense for me to use the LM317 verses a simple resistor to limit current through the LED since my input power supply is regulated. It seems that intended purpose of this circuit is to provide a constant current when you have a varying voltage power supply, such as a battery.

Here's the spec: http://www.st.com/stonline/products/literature/ds/2154/lm217.pdf

and here's the circuit http://www.instructables.com/id/Super-simple-high-power-LED-driver/

#### steveb

Joined Jul 3, 2008
2,436
Now for my question: given that LEDs have a varying forward voltage drop, depending on various conditions, such as temperature, does the LM317 account for this (i.e. will it be able to maintain 350mA while the forward voltage drop of the LED increases)?
Yes. According to the spec sheet, the circuit you showed is wired in the constant current mode of operation. This will automatically compensate for temperature and load voltage changes to very high accuracy. As you mentioned there are limits, but these are very basic. The part must be adequately heat sinked so as not to overheat, and the supply voltage must be sufficient to have enough headroom over the load voltage. Also, circuit layout can be important too, in terms of adequate copper for current paths, and using filter caps etc.

Last edited:

#### bertus

Joined Apr 5, 2008
20,102
Hello,

Temperature has some little influence on the forward voltage of the led.
The LM317 as current source behaves like a dynamic resistor that compensates the change in voltage (of the powersupply and the forward voltage of the led).

Greetings,
Bertus

#### SgtWookie

Joined Jul 17, 2007
22,210
When used as a constant current source, the LM317 will have a 3V drop across itself. This drop will change a bit according with temperature.

Standard Vf of an LM317 at room temp when used as a voltage regulator is 1.7V.
Nominal Vref is 1.25, with a range of 1.2v to 1.3v.

Determine your LM317's Vref before selecting your R1. For starters, connect a 50 to 100 Ohm resistor between the OUT and ADJ terminals, ground the ADJ terminal, and apply 3V-5v to the IN terminal, then measure Vref (use a DMM/DVM on the 2000mV scale). Vref is the voltage between the ADJ and OUT terminals.

Once you have determined Vref, R1 = Vref / DesiredCurrent

Provide sufficient heat sinking for the LED. Be aware that running LEDs at high temperature will lead to a short life.

#### rappa

Joined Nov 17, 2008
11
I ordered a 5V/1.2A Power supply, not knowing about the 3V drop of the LM317 -- argh!! So now it seems I need something more like a 9V power supply. BTW, what should I look for in the spec to find the forward voltage drop?

This might be a dumb question, but if I have a 9V regulated power supply that is rated at 650mA, does that mean it is capable of supplying more current at a lower voltage? I need about 1A to drive all three LEDS at full power.

Thanks for the responses.

#### steveb

Joined Jul 3, 2008
2,436
I ordered a 5V/1.2A Power supply, not knowing about the 3V drop of the LM317 -- argh!! So now it seems I need something more like a 9V power supply. BTW, what should I look for in the spec to find the forward voltage drop?

This might be a dumb question, but if I have a 9V regulated power supply that is rated at 650mA, does that mean it is capable of supplying more current at a lower voltage? I need about 1A to drive all three LEDS at full power.

Thanks for the responses.
It is possible to find low-dropout regulators that do not require very much voltage headroom. This is better than using a 9V supply because you just waste power when you use more voltage. Also, heatsinking the regulator becomes more difficult.

Note that Fig. 4 in the spec sheet shows dropout voltage vs. temperature and current.

As for your second question, you do not get any current amplification in this type of linear voltage supply/regulator.

Last edited:

#### Wendy

Joined Mar 24, 2008
21,906
There are other ways besides a LM317...

The transistor/resistor will drop around a volt. Figure around .7 Volts on the resistors and calculate accordingly.

I'm not too fond of this one, but in theory...

It drops even less voltage. R programs the current. The transistors have to be matched, extremely so. It is also very temperature sensitive.

#### mindmapper

Joined Aug 17, 2008
34
Since you already have a stable 5V power supply, I would take the easy path. IMHO it will be good enough with current limiting resistors.

With a switch mode power supply you could take down the voltage from 9V and get a higher current. It would however be much "bucks for the bang".

#### Wendy

Joined Mar 24, 2008
21,906
Since you already have a stable 5V power supply, I would take the easy path. IMHO it will be good enough with current limiting resistors.

With a switch mode power supply you could take down the voltage from 9V and get a higher current. It would however be much "bucks for the bang".
Actually that makes sense. Sounds good to me.

#### SgtWookie

Joined Jul 17, 2007
22,210
I'd still go with a constant current circuit, particularly if you're going to be running near the peak rating of the LED. Running AT or over the peak current rating of the LED will lead to a short lifespan.

Check out this 8v 1A wall wart from MPJA.com:
http://www.mpja.com/prodinfo.asp?number=17419+PD
$3.25 each. That'll give you the "headroom" you need for an LM317. I'd prefer using the LM317 over discrete components. Don't forget, it'll need heat sinking. Use a 5W or higher resistor. Last edited: Thread Starter #### rappa Joined Nov 17, 2008 11 I'd still go with a constant current circuit, particularly if you're going to be running near the peak rating of the LED. Running AT or over the peak current rating of the LED will lead to a short lifespan. Check out this 8v 1A wall wart from MPJA.com: http://www.mpja.com/prodinfo.asp?number=17419+PD$3.25 each. That'll give you the "headroom" you need for an LM317. I'd prefer using the LM317 over discrete components. Don't forget, it'll need heat sinking. Use a 5W or higher resistor.
Thanks for the suggestion. This store has a \$15 min. order but I will order once I have enough items to get.

#### rappa

Joined Nov 17, 2008
11
I finally got my LM317 order but had no luck whatsoever with this circuit. I used a 3.9 Ohm resistor to get me ~300mA but when I hooked it up to my 5V supply I only got 170mA through the LED. I understand this could be a consequence of the 3V LM317 voltage drop, but then I connected my 9V supply and my multimeter displayed 1.4A! I quickly disconnected to avoid destroying the LED. Could my multimeter be off by that much or is there another explanation to why I'm not getting the expected constant current of about 300mA?

I followed the suggestion to calculate the LM317 vref and get 1.245V, so ok there.

I measured the actual voltage drops of the LED to be:

Red: 2.24
Green 3.54
Blue: 3.51

Currently I'm using plain old resistors to drive the LED but would like to get this circuit working. Any suggestions are appreciated.

#### Wendy

Joined Mar 24, 2008
21,906
Were the LEDs still in the circuit when you connected the ampmeter?

Did you connect it this way?

#### rappa

Joined Nov 17, 2008
11
Were the LEDs still in the circuit when you connected the ampmeter?

Did you connect it this way?

I reconnected everything, according to your circuit and I'm getting different results now. When I use the 9V supply I get 0.36A which seems just about correct.

I think there may be an issue with my multimeter since when I measure with the 5V supply, the current through the LED using the 300ma fused connector is 48mA but when I used the 10A connector it's 100mA??

Thanks for the help.

#### Wendy

Joined Mar 24, 2008
21,906
Likely there is a large variation in the shunt resistor. Most DVMs I've run into have a 200ma fuse on the fused side (yours sounds different), so you may have blown it.

No problem though, measure the voltage across R1, then use ohms law. R1 is a current sensing resistor, you will get 4X (actually 3.9X) the voltage of the current.

#### rappa

Joined Nov 17, 2008
11
I measured 0.341V at 5V and 1.24V at 9V. So about 318mA at 9V. The LM317 was getting hot real quick so I'll need to get some heat sinks.

How did you get the 3.9X figure? Thanks.

#### Wendy

Joined Mar 24, 2008
21,906
Basic ohms law. 1Ω with 1A drops 1V. 4Ω with 1A drops 4V.

You said you were using a 3.9Ω resistor for R1.

#### rappa

Joined Nov 17, 2008
11
Basic ohms law. 1Ω with 1A drops 1V. 4Ω with 1A drops 4V.

You said you were using a 3.9Ω resistor for R1.
Ah yes. I swapped out the 3.9 with a 3.6 for a little more pep. I still can't believe I asked this question

#### Wendy

Joined Mar 24, 2008
21,906
We all have the DOH! moments. Don'tcha just love em?

#### SgtWookie

Joined Jul 17, 2007
22,210
You must use a heat sink with the LM317 when dealing with that kind of power dissipation.

Keep in mind that the heat sink tab is connected to Vout, so it's "live" - you must either use an electrically insulating heat sink mount kit or must ensure that the sink itself doesn't contact anything.

LM317's are great for quick and simple solutions.

But if you want to get efficient, you'll need to start looking at synchronous buck converters. It's not a simple topic, but it's far more efficient than the linear regulator route.

PWM is a possibility, but not plain PWM when you're running close to peak currents. The PWM input to the LED(s) needs to be fed through an appropriately sized inductor (load current vs frequency, just to keep it simple) to keep the current relatively constant.