LM317, what did I wire wrong?
Dec 4, 2005 at 8:00 AM Thread Starter Post #1 of 16

jerb

Headphoneus Supremus
Joined
Jan 2, 2005
Posts
1,771
Likes
10
yeah, I just breadboarded this but Im not sure what I did wrong, Perhaps someone could chime in?

attachment.php
 
Dec 4, 2005 at 8:11 AM Post #2 of 16
Got the pinout right? Adj - Vout - Vin, from left to right
for that i get ~3.41V

Is this just to run an led? A resistor or a constant current source is much better
 
Dec 4, 2005 at 9:33 AM Post #3 of 16
Jerb, an LED needs to be current-limited. The way you have it wired up, you are regulating the voltage but not the current. The LM317 resistor values you chose will give you about 3.4V as Daki][er sez, but an LED doesn't want a constant voltage source (unless it's the type that has a built-in current-limiting resistor).

The simplest way is to ditch the LM317 and the two resistors, and just use a current-limiting resistor in series with the LED. The proper value depends on how much current you want to run through the LED. Let's say you want 2mA, then you need:

(9V - 3.5V) / 0.002A = 2.75KΩ

See the LED datasheet about what its rated current is. You can generally run at quite a bit less than the rated current and still get acceptable brightness. Some LEDs are far too bright when running at full rated current.

Alternatively, you can wire up a LM317 as a constant current source by skipping the resistor that goes from the adj pin to ground. See the datasheet for info about how to calculate the proper resistor value to set the current. This is of course more complex, but has the benefit of constant LED brightness regardless of the input DC voltage.
 
Dec 4, 2005 at 10:17 AM Post #4 of 16
Quote:

Originally Posted by amb
Alternatively, you can wire up a LM317 as a constant current source by skipping the resistor that goes from the adj pin to ground. See the datasheet for info about how to calculate the proper resistor value to set the current. This is of course more complex, but has the benefit of constant LED brightness regardless of the input DC voltage.


Yea, this would be the ideal way to go if you have a varying voltage supply, the formula is just I = 1.25V / R with the resistor from Vout to Adj pin and you take it from the Adj side of the resistor
 
Dec 4, 2005 at 7:28 PM Post #5 of 16
Wow, thanks for the info amb! the point of this was to make a light box for my fathers photography, he's photographing small pumps and needs lots of lights and to beable to control their brightness. the thing is it could be running off a 9v battery when hes roaming around or off a 12v wallwart when he's at his desk

Ill try to draw the circuit you mentioned
icon10.gif
 
Dec 4, 2005 at 7:58 PM Post #6 of 16
OK, here's my stab at it:

attachment.php


The data sheet can be found here: http://www.st.com/stonline/books/pdf/docs/2577.pdf

I am having a little trouble with the math though (as far as wattage goes) If the load will be as high as 120mA @ 3.4 V then Watts= Volts [3.4] x Amps [.12] so my load will be a maxed at .408 watts and there for a 1/2 watt resistor should be used?

I only have 127 Ohm, 220 Ohm, and 1 Ohm resistors in 1/2 watt handy; everything else is 1/8. So if I was to use my 1 Ohm resistor in the circuit (for R1) I would have .3 A = (1.25/14.125)+1. For R2 which would be 14.125 V I could use a 1/8 Watt resistor because there would be 1.25V going across it and a max load of .12A so it would be a max of .15 Watt.

Now assuming my calculations are correct (which they most likely are not) then I can connect [in parallel] a maximum of four LED's at 30mA and 3.4V per regulator but it will still work if I only have one or two LED's on the output.

Lastly to make the intensity of the led variable I can add a potentiometer [log?] in series before the LED's?
 
Dec 4, 2005 at 10:56 PM Post #8 of 16
ok I think I have it, The first part of this circuit takes any voltage up to 33.4 V because the LM317 can withstand a V difference of +/- 30V. The top part outputs a clean 3.4 V to the next segment.

The bottom part of this circuit is the current limiting part, It is fed 3.4V and in turn feeds that back to the LED but it gives the LED 30mA of current. However I dont believe I can connect more than one LED's to this circuit because then they'd all be sharing the same 3.4V 30mA depending on how I wired them correct?

If the above is true then maybe I should instead assume hes going to be using 9V or a 12V wallwart and make the two sources switched?

attachment.php
 
Dec 5, 2005 at 1:45 AM Post #9 of 16
I don’t think you got the concept of constant current, that is no matter what the input voltage is, it will regulate the output so that a constant value of current will flow as long as you have enough voltage input to begin with

The lm317 has around a 2V drop from input to output so whatever you want out, you need to at least have 2V more in so having 6V is about the minimum

Then the lm317 cannot have anymore than 37V difference between its input and output, so just stick with 37V max in here as well

Then the only other thing to worry about, which you probably wont in this case is thermal issues, the heat out of the lm317 will be P = (Vin-Vout)*Iout, with no heatsink multiply this value by 50 and you will get the temperature it will get to above room temperature (in ºCelsius)

You don’t want a dual stage with voltage regulations then current source after it, just stick with what I posted above and that is it, feed it with any voltage within the limits and you will have a constant current flowing through the led
 
Dec 5, 2005 at 1:52 AM Post #10 of 16
Just to clear up something that wasnt stated explicatly: When dealing with an LED running off a constant voltage a resister alone will work fine as a current-limiting device.

Rob.
 
Dec 5, 2005 at 4:09 AM Post #11 of 16
sorry DaKi][er I thought there was more to the concept.

the only thing I worry about is the fact that there may be more than one LED connected to its output, up to three.

Now if I understand this constant current thing correctly then the LM317 will only provide enough current (in this case 30mA) for one LED so if I put two there they would not light. How can I overcome this (Or should I instead just stick with one per channel)?

also, If a constant current is being fed to it, can I add a variable resistor inline with the Diode to control its brightness?
 
Dec 5, 2005 at 4:41 AM Post #12 of 16
Quote:

Originally Posted by jerb
the only thing I worry about is the fact that there may be more than one LED connected to its output, up to three.

Now if I understand this constant current thing correctly then the LM317 will only provide enough current (in this case 30mA) for one LED so if I put two there they would not light. How can I overcome this (Or should I instead just stick with one per channel)?



The lm317 will provide a constant current for as many leds as you want to put in series, the same current will flow through all of them in the chain
So long as you input enough voltage to overcome the forward voltage of the led's, so with 5 leds in series that have a forward voltage of 3V each you need 15V for them, plus 2v for the lm317 itself making a minimum input voltage of 17v here

Quote:

Originally Posted by jerb
also, If a constant current is being fed to it, can I add a variable resistor inline with the Diode to control its brightness?


the best way to do this i see is to put the varible resistor in series with the current resistor that is with the lm317, pick the fixed value one for your maximum current and the varible resistor to adjust the current down from there, with the more resistance the less current out
attachment.php
 
Dec 5, 2005 at 5:40 AM Post #13 of 16
Last question I promise
biggrin.gif


If Vin = 9V and the LED in question has a forward Voltage of 3V then I have a 5V draw, correct? what happens to the other 4V from the battery?
 
Dec 5, 2005 at 6:07 AM Post #14 of 16
Quote:

Originally Posted by jerb
If Vin = 9V and the LED in question has a forward Voltage of 3V then I have a 5V draw, correct? what happens to the other 4V from the battery?


"Draw" is the wrong word here as it doesn't apply to voltage.

If Vin is 9V, and the LED forward voltage is 3V, then the LM317 + resistor is dropping the difference, which is 6V.

If your LM317-based CCS is programmed to supply 20mA (as in the schematic from Daki][er in post #7), then the combined power dissipation of the LM317 and the resistor is 0.02A * 6V = 0.12W. Of which (0.02A)^2 * 62 ohms = 0.025W is on the resistor, the rest is on the regulator.

Note that 20mA is too much current for most LEDs. A more reasonable current is around 1mA to 5mA.
 
Dec 5, 2005 at 8:29 AM Post #15 of 16
Something that's been hinted at above, but which might help if it were stated explicitly: the voltage and current numbers in an LED datasheet are not requirements, they are limits and characteristics.

When it says Vf is 3.5V, it means that the voltage drop across the LED will be 3.5V, not that you must give it exactly 3.5V. If you provide more voltage, you simply have to arrange your circuit so that the remaining voltage is dropped across some other part of the circuit. In the case of a simple LED with a series current-limiting resistor, the extra voltage is dropped across the resistor. Say you have a 10V suppy and your 3.5V LED. The current across the resistor -- and therefore through the LED, since the two are in series -- is I=V/R (Ohm's Law), where V is 6.5V (10 - 3.5V) and R is your series resistor value. If you use a constant current source (CCS) instead of the resistor, the extra voltage is still dropped across the CCS, but the current does not vary with supply voltage. That's what makes it a constant current source.

The current number, again, is not a requirement, but rather a limit. When it says it's a 20 mA LED, that means it blows up if you give it more than 20 mA. Brightness varies as current varies, and it usually takes 1 or 2 mA for a typical small LED to reach a useful level of brightness. But in your case, you might well want to go all the way to 20 mA, to get enough brightness. Just don't go over.
 

Users who are viewing this thread

Back
Top