LM317 Voltage Regulator, help

Discussion in 'General Electronics Chat' started by live4soccer7, Jun 7, 2008.

1. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
I am putting some LEDS in my car, I have ran into a problem throughout the car. The voltage when the car is off is 11.3 volts and when the car is running the voltage is anywhere from 13.5-14.5 volts. Now, unless there's a way i don't know of, this is difficult to work with when you are trying to wire up some leds for the dash and you want them to be as bright as possible and not fluxuate at all when you turn on the car or boost the rpms. With all that said, I am looking at building this circuit. I do know the LM317 is capable of providing 1.5A but needs a heatsink when it's at 500mA or more. I want to wire up 8 series of LEDS (4 in each series) 20mA for each LED at a Voltage drop of 2v for each LED also. They are red ones. I want to set the circuit to output 10v. I do not know how to calculate the current that I am demanding from the LM317 so that I do not exceed the amount it can supply. Can someone help me on this.

I have one more question. If I have a 5 leds in a series and each has a voltage rating of 2v and the supply voltage is 10V do I need a resistor for this? Thanks

http://www.circuitsonline.net/circuits/view/97

Here is the link to the circuit I'm wanna build. If anyone has any better ways of accomplishing this please feel free to speak up. Thanks.

Last edited: Jun 7, 2008
2. SgtWookie Expert

Jul 17, 2007
22,201
1,807
Here's a link to National Semiconductor's LM317L datasheet:
http://cache.national.com/ds/LM/LM317L.pdf

It's a 100mA version of the larger ones in a TO92 case.
Look at the 3rd schematic down on the left hand side of page 9.
See the formula: Iout = 1.2/R1
If R1 = 60, then Iout = 20mA.
It's hard to get exactly 60 Ohms in a fixed resistor, but you can get close.
Here's a search page on Mouser.com that'll get you within a couple of percent:
http://www.mouser.com/Search/Refine...448+4294621888+4294622017+1323038&Ns=P_SField

Here's a search on the same site for the LM317L regulators; you can get them as low as \$0.23/each.
http://www.mouser.com/Search/Refine...E1|0||P_SField&N=1323038&Ntk=Mouser_Wildcards

You use a single regulator with the resistor from the output to the ADJ pin for each string of LEDs. You can probably get 5 LED's per string with the voltages you've specified. If you try to use more than that, you'll see the LED's dim when the battery gets low.

Oh, and if your electrical system is dropping to 11.3v as soon as you turn off your ignition, either your battery is toast, or you have a problem somewhere. Check your ground strap from the engine block to the firewall, and from your battery to the body.

3. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
Thank you for the input. I am not taking directly from the battery, which is why the voltage is not 12-12.5v when the car is off. Directly from the battery that is the voltage I get. I am splicing in to a wire that is active when I turn on the parking lights or the headlights so that my dash lights turn on at the appropriate time. That is why the voltage is about 11.3 or so.

I am a little confused on what you were saying about using a single regulator with a resistor from the output to the adj pin for each string of leds. What do you mean by this. Sorry. I am trying to understand this and find out how I can wire up my LEDS to my car so they will be consistent and not dim or blow. Is this method here the best way to go or is there something more simple? Thanks again.

This is the LM317 that I had ordered:

http://www.mouser.com/Search/ProductDetail.aspx?qs=vtZZXYnwgJMRSH28O9W9FA==

Let me know what you think of this also

Last edited: Jun 7, 2008
4. Wendy Moderator

Mar 24, 2008
21,645
2,987
With LEDs you always need a resistor, or a current limiter (which I assume is how you are talking about using the LM317). I would go with the LM317 at nominal voltage (13.7V), if the LEDs dim a little when you're running off the battery only it really doesn't matter that much, does it? The current limiter only works for one string of LEDs, you'll need one for each string.

Question for Sarge, would a current mirror work OK for this application?

5. SgtWookie Expert

Jul 17, 2007
22,201
1,807
Please re-read my post. Download the datasheet. Look at the 3rd schematic down on the left hand side of the page. That is an LM317L set up as a current regulator, rather than a voltage regulator.

You can use a single LM317 as a voltage regulator if you wish. However, you will need a heat sink, you'll need to allow for a 1.7 voltage drop (minimum) across the regulator plus the voltage drop for each LED in the string. Then you'll also need a current limiting resistor for each parallel string, too.

Using a series current limiter uses more LM317L's, but you no longer have to worry about the brightness of the LED's, series current-limiting resistors, or any of that mess.

6. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
ok that makes sense and is actually pretty darn easy. Looks like I need to order up some more of these things.

I do have a couple of questions though. First off, if I set the current to 18mA or so, it won't matter what the voltage is for the series as long as it's high enough to actually lights the LEDS. For example if the lowest voltage the car went was 11v and the highest it went was 15v, and I had 4 2v LEDS in a series, it would not effect them if it were at fifteen volts (ie, burn them out)?

I can just use on of these setups for every series that I have?

What if i wanted to run 2 series of 5 lights each in parallel off of one and set the current to 40mA because that's how much the paralleled series would consume together?

Thanks again for the help. It helps a lot

Apr 5, 2008
19,516
3,975
Hello,

For a current source with a LM 317 you should take a voltage difference of 3 Volts for the LM317 and 1.2 Volt for the resistor.
So the power input should be at least 4,2 Volt higher than the output.
When you want to connect 2 or more strings of leds to the regulator, put a restitor of 10 Ohms in series with the leds for balancing.

Greetings,
Bertus

8. Wendy Moderator

Mar 24, 2008
21,645
2,987
You know, it might be better to use a regular resistor in the long run. Just a thought. Design for your usual voltage, and live with the slight dimming, might not even be noticable.

9. hgmjr Retired Moderator

Jan 28, 2005
9,029
218
It may be worth looking at an LDO (low drop-out) alternative to the LM317 such as the IRU1050 from International Rectifier. Digikey has several in stock. This three terminal regulator should only need a fraction of a volt drop between Vin and Vout for the low current needed by the LEDs. Add to that the 1.25V offset and you have around 2V total.

All that you would need to do is use one of these regulators for each of the individual 4 LED strings.

hgmjr

Apr 5, 2008
19,516
3,975
11. Wendy Moderator

Mar 24, 2008
21,645
2,987
What kind of current is it sourcing? Is there a way to program it for a specific value? I asked about a current mirror earlier, never having used one I have no idea if their practical for the application or not.

Apr 5, 2008
19,516
3,975
Hello,

I will tranlate the text:
This circuit makes use of the effect that a FET behaves a current-source when you connect gate to source.
The powersupply may vary between 4 and 30 Vols, the current will be about 15 mA.
The circuit may be fed with ac, but then the led will burn less bright.
http://www.circuitsonline.net/circuits/view/104

As you see in the datasheet, the current for the BF256C will be between 11 and 18 mA.

Greetings,
Bertus

• bf256a.pdf
File size:
24.4 KB
Views:
20
Last edited: Jun 7, 2008
13. Ron H AAC Fanatic!

Apr 14, 2005
7,012
681
Here's a current source that only requires about a volt of headroom, so it will put out 20mA when the battery voltage is above 9V.

File size:
16.2 KB
Views:
54
14. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
I like the idea that sgtwookie is talking about. Using the LM317 as a current limiter. It is a simple setup and only requires two components. Very simple. I just don't know if it will work the way I'm thinking.

Even thought the variable voltage will vary from 11-14 volts or so and I have my leds setup to consume 8-10 volts, will they blow out with the current limiter that sgtwookie is referring to?

Can I build the current limiter with this LM317 in this link, I only ask because I ordered them a couple of days ago.

http://www.mouser.com/Search/ProductDetail.aspx?qs=vtZZXYnwgJMRSH28O9W9FA==

15. hgmjr Retired Moderator

Jan 28, 2005
9,029
218
The LM317 you ordered should work just fine. Did you order the LM317T? That one comes in the TO-220 package which will be easier to handle than the surface mount version.

Sgtwookie's advice is right on the money.

You should not have to worry about blowing any LEDs if you use the constant current configuration that he has suggested.

A constant current source behaves so that the voltage across the series LEDs is constant even though the voltage may rise to many volts above that required to power the LEDs.

hgmjr

16. SgtWookie Expert

Jul 17, 2007
22,201
1,807
I suggested the LM317L solution because it is so simple, and the L-model is so small (TO-92 case) that you could easily enclose the whole thing in a piece of shrink tubing. No worries about heat dissipation either, since the LM317L is rated for 100mA, and you're putting just 20mA through it.

If you have 5 red LED's in a row, their average Vf should actually be somewhere between 1.7 to 1.9v - we'll just call it 1.8v for now. That's 9v, with 1.7v headroom for the LM317L, that's 10.7v

Now the last thing to consider is power dissipation.
P = EI (or, Power in Watts = Voltage x Current)
If the LED's drop 9v, and the worst case charging voltage is 15, we have:
P = (15v - 9v) x 20mA
P = 6 x 0.02
P = 120mW, or 0.12W
Power dissipation in the LM317L is limited internally - so even if the regulator DID somehow manage to get really warm (like a couple diodes got shorted somehow) it would simply shut the supply current off until it cooled down.

There are myriad ways to make current regulators. The LM317L is pretty old technology, and there are plenty of newer and more sophisticated regulators around. But for the functionality you get in a simple-to-build circuit at such a low cost and small size, it's pretty tough to beat in your application.
Roughly \$1 for the cost of four current limiting circuits, plus some shrink tubing. You were going to need to insulate whatever you used anyway.

Beware of the TO-220 cased LM317; Vout is connected to both the middle pin AND the tab! If you let it contact just about anything metal in your vehicle's interior, you'll rapidly fry it.

Last edited: Jun 7, 2008
17. hgmjr Retired Moderator

Jan 28, 2005
9,029
218
With the use of heatshrink tubing as recommended by sgtwookie, you should be ok with the LM317T that you ordered. Be sure to observe the cautions that sgtwookie has indicated regarding the metal tab on the TO-220 package. We don't want your project to terminate in a puff of smoke.

hgmjr

18. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
Thank you guys so much!!! I will be getting these in the mail very shortly and will try this out. I will let you know how it goes

19. hgmjr Retired Moderator

Jan 28, 2005
9,029
218
What would really be nice is if you could attach a couple of jpegs of your circuit.

Just a little vicarious engineering.

hgmjr

20. live4soccer7 Thread Starter Well-Known Member

Jun 7, 2008
88
0
I will.... Definitely. I have to run to walmart and napa to get a few things for my car and then I will post some pics. Although I am warning you, the lights are in a bundled mess. lol... They work. Just really compact. lol. Ok, if someone could help me with the circuit real quick to make sure I have this correct. Pin 1 on the lm317 is the Vin and the last pin is where I connect resistor r1 to set the current flow and I connect pin 2 right after the resistor that is connected to pin 3?

I'm pretty sure that is how the diagram reads. I just don't want to waste one of these things cause I need them all for my lights and I need the lights too. Thanks.

Since the current is set with this thing, I do not need a separate resistor for the lights anymore do I, just the one I used to set the output current?