Newbie trying to understand the lm317

Discussion in 'General Electronics Chat' started by AlmightyJu, Oct 14, 2011.

  1. AlmightyJu

    Thread Starter New Member

    Oct 14, 2011
    20
    0
    Hi All,

    I'm totally new and only just started getting into the electronic stuff, I can't work out this circuit, i know it works but I cant see how! http://www.lm317-circuits.com/3-3v-5v-regulated-power-supply.html

    To me it looks like the current will go from the source, through the diode, into the LM317 and straight out (to where it says 3.3v/5v) why would the current go through the resistor? I thought the current goes for the least resistance path it could?

    Say i connected a LED from the 3.3v/5v label to ground I cant see why the current would go through the resistor to get to LM317's ADJ, or am I missing something fundamental?

    Thanks!
     
  2. capnray

    Member

    Jul 3, 2010
    59
    2
    Current will flow in any leg leading to ground. Legs with more resistance will have lower current flow. I suggest you get a copy of the LM317 datasheet and read it thoroughly. This a very cool device.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    There is an error in that schematic; in order to get 5v out, Vin will need to be at least 1.7v higher than that; and the diode will drop ~0.7v or more.

    So, to get 5v out, you'll need 5v+1.7v+0.7v = 7.4v minimum, even for a light load.
     
  4. #12

    Expert

    Nov 30, 2010
    16,343
    6,828
    "To me it looks like the current will go from the source, through the diode, into the LM317 and straight out (to where it says 3.3v/5v)"

    Actually, it does, right after the 317 tells it, "how much".

    "why would the current go through the resistor? I thought the current goes for the least resistance path it could?"

    If current ONLY went through the path of least resistance, you car engine would stop when you turned on the headlights.
     
    Last edited: Oct 15, 2011
  5. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    Ordinary LEDs require series resistors (etc.) to moderate their currents. If you connected an ordinary LED straight to ground from a 5V output there might be an accident, because the LED would draw too much current. It might even short out, collapsing the output voltage, and then it really would take all the current!:eek:

    With any reasonable load though, the regulator is not overloaded and its output voltage does not collapse. Current does flow in the resistor chain. A very little of this comes from the REF terminal, but the resistor values are chosen so that the total chain current is much bigger than the current from REF.

    Mainly it is a question of something very fundamental: Ohm's Law, from which we know Current = Voltage / Resistance.

    With 5V output voltage, and a chain of series resistors of total resistance R = R1+R2+R3 = 240Ω+390Ω+330Ω = 960Ω.

    The chain current will be 5V/960Ω = 5.2mA.

    That will still be true if the output is feeding quite a low resistance, provided that it is not so low that there is an overload.
    More of the total current follows the lower resistance path, but not all of it.

    Like many popular sayings: "The current always takes the path of least resistance." is only a half-truth. It may be fairly accurate when comparing the very low resistance of a lightning rod to the high one of a brick wall, but this is an extreme case.
     
  6. AlmightyJu

    Thread Starter New Member

    Oct 14, 2011
    20
    0
    An incredibly good point!

    So when you first power the circuit, and say at the Vin on the LM317 we have 7V, does the Vout have 5.75V and ADJ have 1.25V?

    I suppose whats really confusing me is surely there will be an initial surge of voltage that matches the input source? or does it output a very low voltage to start?

    After re reading the datasheet, the ADJ looks like it outputs a small current, but how can the LM work out the output voltage if it has no input?

    Sorry if i seem a bit thick :rolleyes:
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    You are thinking too much about current flow. Think voltage instead.
    When the power is turned on, the input voltage will ramp up from 0V to 10V.
    R1, R2 and R3 constitute a voltage divider which is to monitor the output voltage, independent of the load. If they are set for 5V output, the output of the regulator will follow the input voltage (minus the "drop-out voltage" across the regulator). When the input voltage exceeds the 5V plus the drop-out voltage, regulation will kick in and the output will be regulated at 5V.
     
  8. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The way I think about the LM317 is that it continuously adjusts its output to force the voltage across the resistor between its Vo and ADJ pin to be 1.25V.

    hgmjr
     
  9. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    Well-designed voltage regulators avoid delivering a large voltage surge on start up. In some cases (often with switching regulators, which the Lm317 is not) a dedicated "soft-start" arrangement may be used.

    Otherwise it is a question of the feedback system being sufficiently fast and well damped to prevent significant overshoot - a minimum load resistance or load capacitance may also be required to ensure this with some designs.

    As for what happens with no input (not turned on) there is of course no output, but I do not think that's what you meant to ask. When power first is applied to the input, we can assume that the output starts low, so the required 1.25V condition between the output and ADJ is not satisfied.

    The regulator's pass device is therefore turned on, so that the output voltage rises until the 1.25V is met, when the control system turns down the pass device so that this value is not exceeded. With good design, the control system reacts to the rising voltage fast enough so that the output voltage does not significantly overshoot the wanted value.
     
  10. #12

    Expert

    Nov 30, 2010
    16,343
    6,828
    I'm happy that my analogy was effective.

    As 4 startup...it all happens very quickly.
    The voltage at the input pin rises as fast as the first sine wave charges C1.
    The 317 chip allows current to flow until the output voltage is 1.25 volts higher than the voltage at the ref pin. (That's the definition of a 317 chip!)
    If the ref pin was grounded, the 317 would stop at 1.25 volts on the output pin.
    Meanwhile, the voltage at the output pin is sending current through R1 (and less than 50ua comes out of the ref pin).
    Those currents flow through R2 and R3.
    As the current causes a voltage across R2 and R3, the voltage on the ref pin rises and the 317 chip keeps allowing more current out until the output voltage is high enough to feed the resistor string and achieve an output voltage that is 1.25 volts higher than the voltage across R2 and R3.

    According to the datasheet, there can be an overshoot of a couple of tenths of a volt for 3 to 5 microseconds.

    Does that work for you?

    Edit: Three people answered while I was typing that!
    I guess a lot of us get up at 8:30 on Saturday.
     
  11. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    I slept in very late this morning, but I live in England.
     
  12. AlmightyJu

    Thread Starter New Member

    Oct 14, 2011
    20
    0
    ahh ok! so if at the ref/adj pin the voltage is < (OUT - 1.25) it increases the output and if its > (OUT - 1.25) it lowers the output. and the voltage across R1+R2+R3 must total the output voltage you want. it finally just clicked!

    that explains why everywhere i look R1 is almost always 240 or 220 but R2 changes.

    Real big thanks to everyone!
     
  13. AlmightyJu

    Thread Starter New Member

    Oct 14, 2011
    20
    0
    Didn't watch the Wales vs France game then? I'm over in Wales myself :)
     
  14. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Cheers to you! You said it better than any of us did.
    Sorry about the match.
     
  15. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    You appear to have grasped the LM317's operation very well.

    hgmjr
     
  16. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    From what I heard on the news report, it's just as well that I missed it. I'm Scots by birth, but you have my commiserations on this one. I'd rather see any UK side beat the Continentals.
     
  17. AlmightyJu

    Thread Starter New Member

    Oct 14, 2011
    20
    0
    It was shocking! a good game tho, Warburton shouldn't of done that tackle but a red was harsh :eek:, ahh well, no use crying over spilt milk
     
  18. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    This thread has drifted off topic.

    If you want to discuss sports please open a thread in the "Off topic" forum.

    hgmjr
     
  19. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    The more expensive LM117 can use a 240 ohm resistor because its max idle current is half as much as the cheaper LM317. Therfore the LM317 should use a 120 ohm resistor or have a load that is always 5mA or more so that its output voltage does not rise with less load current than 5mA. All schematics in the datasheet show the LM117 with 240 ohms.

    1.25V/240 ohms= 5.2mA which is a little higher than the max idle current for an LM117. 1.25V/120 ohms= 10.4mA which is a little higher than the max idle current for an LM317.

    The idle current is less when its input voltage is less.
     
  20. #12

    Expert

    Nov 30, 2010
    16,343
    6,828
    Referring to post #12 and repeating AG in different words:

    The 117/217/317 chips have a minimum load current of 5 to 10 ma.
    If they can't get rid of that current, they will overshoot.
    The 240 ohm resistor is repeated in many circuits because that is the highest standard resistance value that will drain off the 5ma idle current for the 117 chip. The 317 chip requires 120 ohms to drain off its 10 ma of idle current.

    That explains why everywhere you look, R1 is almost always 240 ohms.
    Unfortunately, most of us use the cheaper 317 chip, and it needs a 120 ohm load resistor in its feedback loop.
     
Loading...