# Arduino Forum

## Using Arduino => General Electronics => Topic started by: kurtselva on Apr 20, 2013, 12:17 pm

Title: Confusion with Formula for LM317 circuit
Post by: kurtselva on Apr 20, 2013, 12:17 pm
Hi guys,

The formula is given as Vout = 1.25 x (1 +R2/R1)

May I know how is this formula obtained??

If using voltage divider equation: Vadj = Vout x (R2/(R1+R2)) right? (the symbols used are wrt the circuit on the link, and Vadj is 1.25)
So if I rearrange, shouldn't I get Vout = 1.25 x (1 + R1/R2)??

Am I missing something?

Title: Re: Confusion with Formula for LM317 circuit
Post by: Erdin on Apr 20, 2013, 02:17 pm
The LM317 itself it not connected to ground.
The Vout is regulated to 1.25V higher than Vadj.
The output voltage is set higher than 1.25V by lifting the Vadj above ground level.

The voltage over R1 is always 1.25V. The current through R1 is 1.25/R1.
That same current has to go through R2. Also the current of the LM317 itself is going through R2, but that is only 50uA, so that is not in the formula.

If R1 = 100 ohm, and R2 = 200 ohm. The voltage over R1 is 1.25V and over R2 is 2.50V. The output will be 1.25+2.50 = 3.75V
Title: Re: Confusion with Formula for LM317 circuit
Post by: kurtselva on Apr 20, 2013, 02:44 pm

The LM317 itself it not connected to ground.
The Vout is regulated to 1.25V higher than Vadj.
The output voltage is set higher than 1.25V by lifting the Vadj above ground level.

The voltage over R1 is always 1.25V. The current through R1 is 1.25/R1.
That same current has to go through R2. Also the current of the LM317 itself is going through R2, but that is only 50uA, so that is not in the formula.

If R1 = 100 ohm, and R2 = 200 ohm. The voltage over R1 is 1.25V and over R2 is 2.50V. The output will be 1.25+2.50 = 3.75V

So it does not use the voltage divider rule in this case?

And the inside of the LM317 is a non- inverting op amp right?
Similar to this: http://yano.wasteonline.net/electronics/opamp/index.php?mode=1
Where Rg is R2, Rf is R1 and Vin is the reference voltage of 1.25V.
Then what is the Voltage at V-? Is it 1.25V also? If so, why?

And from which law is the formula obtained?

Thanks
Title: Re: Confusion with Formula for LM317 circuit
Post by: floresta on Apr 20, 2013, 04:07 pm
Quote
Am I missing something?

Yes.

Quote
So it does not use the voltage divider rule in this case?

It does not use the 'voltage divider rule'.

Ohm's law only applies to linear devices such as resistors, not to active devices such as Op-Amps which is essentially what an LM317 is.

The "voltage divider rule" is nothing more than Ohm's law applied twice.

If Vin is the voltage applied to the series combination of Ra and Rb and Vout is taken from across Rb then:

The first application of Ohm's law applied to the entire circuit tells us that the current I = Vin / (Ra + Rb)

The second application, applied to Rb alone, tells us that Vout = Vrb = I x Rb

Put these together and you get Vout = (Vin / (Ra + Rb)) x Rb

Rework these mathematically to get the version you are used to seeing

Vout = Vin x Rb/(Ra + Rb)

In my opinion you are better off forgetting the rule and learning how and when to apply Ohm's law.

Don

Title: Re: Confusion with Formula for LM317 circuit
Post by: MarkT on Apr 20, 2013, 04:12 pm
Your guess would have been right if the LM317 referenced the 1.25V to the ground terminal - but it doesn't
it references it to the output terminal (the technical reason for this is to provide a known closed-loop gain
throughout its range of operation).   You apply the voltage divider rule upside-down, that's all.
Title: Re: Confusion with Formula for LM317 circuit
Post by: kurtselva on Apr 20, 2013, 07:02 pm
I found this more detailed diagram: http://www.globalspec.com/reference/81979/203279/chapter-4-linear-power-supplies

And got abit more confused  =(

Can some kind soul explain to me how this circuit works?
As in how are the voltages at the inverting and non-inverting input determined and stuff

Title: Re: Confusion with Formula for LM317 circuit
Post by: cjcj1949 on Apr 21, 2013, 01:51 am
You may want to look up operational amplifier gain. The gain in the simplest case is the ratio of two resistors. The assumption is only that the open loop gain (ie without resistors) is very large.
Title: Re: Confusion with Formula for LM317 circuit
Post by: afremont on Apr 21, 2013, 12:13 pm

I found this more detailed diagram: http://www.globalspec.com/reference/81979/203279/chapter-4-linear-power-supplies

And got abit more confused  =(

Can some kind soul explain to me how this circuit works?
As in how are the voltages at the inverting and non-inverting input determined and stuff

Well you should be confused since they got the formula wrong on the page for starters.

As for the schematic, when you tie the output of an op-amp directly back to the inverting (-) input, you create a "voltage follower".  The op-amp will strive to the keep the output voltage at a level the same as the voltage at the non-inverting (+) input of the op-amp.  The transistor that the op-amp output is going thru increases the current output greatly over what the op-amp itself can supply.  The non-inverting (+) input of the op-amp is biased at 1.25V because of the Zener diode.  The bias increases as R2 goes up.  This drives the output higher in voltage.

The output of the op-amp will actually be .6V higher than the voltage being fed back which is the same as the output voltage of the transistor.

@don, Vin is not part of the math for calculating Vout.
Title: Re: Confusion with Formula for LM317 circuit
Post by: floresta on Apr 21, 2013, 03:25 pm
Quote
@don, Vin is not part of the math for calculating Vout.

It most certainly is.  We aren't talking about perpetual motion here.  You can't get any voltage out unless you put some voltage in.

I think you missed where I defined Vin, it isn't the same as the Vin that cropped up in the link in reply #2.

Don
Title: Re: Confusion with Formula for LM317 circuit
Post by: rvasque on Apr 21, 2013, 03:36 pm
Here's the datasheet for the 317.

That's the only thing you need. Read it.
Title: Re: Confusion with Formula for LM317 circuit
Post by: afremont on Apr 21, 2013, 03:45 pm

Quote
@don, Vin is not part of the math for calculating Vout.

It most certainly is.  We aren't talking about perpetual motion here.  You can't get any voltage out unless you put some voltage in.

I think you missed where I defined Vin, it isn't the same as the Vin that cropped up in the link in reply #2.

Don

Ok, I see what you mean.  As long as you don't mean Vin as shown in the datasheet.  ;)