# How does the LM317 regulate to a specific voltage regardless of its input?

#### uraniumhexoflorite

Joined Oct 23, 2016
216
I have been wondering how the LM317 is able to regulate to a voltage regardless of what voltage is its input (provided that it is higher than the output). Other chips such as the MC34063 require you to calculate the voltage output using the input voltage.

#### AlbertHall

Joined Jun 4, 2014
11,956
Both the LM317 and the MC34063 include a reference voltage generator. For both chips a fraction of the output voltage is fed back and the chip compares that fraction with the reference voltage and adjust the output voltage to maintain a constant output regardless of input voltage or load changes (within limits, of course).

#### MrAl

Joined Jun 17, 2014
8,868
I have been wondering how the LM317 is able to regulate to a voltage regardless of what voltage is its input (provided that it is higher than the output). Other chips such as the MC34063 require you to calculate the voltage output using the input voltage.
Hi,

The LM317 acts as a sort of constant current generator that has a power output and it keeps a certain current flowing in the two resistors and that is what holds the output voltage constant. There is a slight error current but it is small. This is very different than other regulators that actually use voltage feedback in a more conventional way which compares the output voltage to a reference voltage. If you look at the internal diagram of an LM317 you'll see the difference.

#### crutschow

Joined Mar 14, 2008
29,503
The LM317 has a built-in 1.25V voltage reference which is configured in a feedback loop such that it always attempts to keep the voltage between the OUT pin and the ADJ pin equal to 1.25V.
So, for example, if you placed a 200Ω resistor between OUT and ADJ pins, the current through the resistor would be forced by the LM317's internal feedback loop to be 1.25V /200Ω = 6.25mA.

Now if you wanted the output to be, say a regulated 5V, then you would need a resistor from the adjust pin to ground that would drop 5V-1.25V = 3.75V with a current of 6.25mA.
This resistor value for this would be 3.75V/6.25mA = 600Ω.

Since the ADJ input takes very little current, the LM317 output thus has to be 5V so that 6.25mA is flowing through both the 200Ω and the 600Ω resistors (5V/800Ω = 6.25mA).

Edit: A function diagram of this is shown below -- Last edited:
• ArakelTheDragon

#### AlbertHall

Joined Jun 4, 2014
11,956
Hi,

The LM317 acts as a sort of constant current generator that has a power output and it keeps a certain current flowing in the two resistors and that is what holds the output voltage constant. There is a slight error current but it is small. This is very different than other regulators that actually use voltage feedback in a more conventional way which compares the output voltage to a reference voltage. If you look at the internal diagram of an LM317 you'll see the difference.
The LM317 maintains the voltage between the output and adjust pins at 1.25V. The current is set by the resistor between those pins. You can use any of the three pin regulators in the same way as the LM317.
Here's a circuit from the datasheet: #### MrAl

Joined Jun 17, 2014
8,868
The LM317 maintains the voltage between the output and adjust pins at 1.25V. The current is set by the resistor between those pins. You can use any of the three pin regulators in the same way as the LM317.
Here's a circuit from the datasheet:
View attachment 133421
Hi,

Yes, and you can see why this is different than a more typical feedback system.
A more typical feedback system has an error amplifier that monitors the actual output voltage not some particular voltage which then in turn regulates a current. The LM317 monitors a set voltage level that appears across a resistor and thus sets the current, and that difference is what allows it to work without a ground reference the way a more typical regulator works. So it works as a 'floating' regulator but coincidentally also regulates the current to ground through the lower resistor which then helps to set the output voltage. So the key point is that the reference is floating whereas in a more typical regulator the reference is grounded.

#### AlbertHall

Joined Jun 4, 2014
11,956
Hi,

Yes, and you can see why this is different than a more typical feedback system.
A more typical feedback system has an error amplifier that monitors the actual output voltage not some particular voltage which then in turn regulates a current. The LM317 monitors a set voltage level that appears across a resistor and thus sets the current, and that difference is what allows it to work without a ground reference the way a more typical regulator works. So it works as a 'floating' regulator but coincidentally also regulates the current to ground through the lower resistor which then helps to set the output voltage. So the key point is that the reference is floating whereas in a more typical regulator the reference is grounded.
The diagram I attached shows a standard (e.g. LM7805) regulator being used without a direct ground connection and in exactly the same circuit configuration as the LM317 is generally used.

#### MrAl

Joined Jun 17, 2014
8,868
The diagram I attached shows a standard (e.g. LM7805) regulator being used without a direct ground connection and in exactly the same circuit configuration as the LM317 is generally used.
Hello again,

I guess i dont understand what you are trying to say then. You seem to be saying that because we can use a regulator any way we want to, that they are all the same.

There are two configurations where one has a reference that is ALWAYS grounded and the other has a reference that is NORMALLY not grounded. The problem with the second type is the ground current. If i remember right the ground current in a 78xx series is even worse than with the LM317 so it's not as suitable as an above ground biased regulator.
If we ground the adjust pin of an LM317, we get a more typical feedback system but then the output is only around 1.25v which is not usually the design goal.

There are a lot of other regulators out there not just these two.

Maybe you could clarify what you were trying to say about the LM317 though.

#### jayanthd

Joined Jul 4, 2015
945
Hello again,

I guess i dont understand what you are trying to say then. You seem to be saying that because we can use a regulator any way we want to, that they are all the same.
LM7805 is a fixed output voltage regulator and LM317 is a adjustable output voltage regulator. He did not had model for LM317 I guess and hence he used LM7805 to show the LM317 circuit.

#### MrAl

Joined Jun 17, 2014
8,868
Hi,

Ok, well here is a diagram showing what it would take to turn an LM317 into a more typical regulator circuit. This is not to say that there are no other regulators like the LM317 of course as there are several that go to higher current that are configured like the LM317. I have one that in use myself that goes up to i think 5 amps in a small power supply i built for testing other things.

Another strange thing about the LM317 and similar is that the output voltage change with temperature is a lot more than we might initially think when we first read the data sheet.

Note in the diagram the breaks in the original LM317 circuit that had to be made to get it configured as a more standard feedback system.

#### AlbertHall

Joined Jun 4, 2014
11,956
The non-LM317 diagram seems to be of a 5 terminal regulator.
As I said, and as the diagram I posted earlier (from the LM78xx datasheet) showed, you can use the LM7805 in exactly the same way as the LM317 - no ground connection to the chip required.

#### MrAl

Joined Jun 17, 2014
8,868
The non-LM317 diagram seems to be of a 5 terminal regulator.
As I said, and as the diagram I posted earlier (from the LM78xx datasheet) showed, you can use the LM7805 in exactly the same way as the LM317 - no ground connection to the chip required.
Hi,

You just dont understand my point that's why you keep saying the same thing.
I know you can use the 7805 the same way, you can use the second diagram in my picture the same way too but that doesnt make it the same basic type of regulator.
What you seem to want to say is that all regulators are the same, but there are differences. Whether you choose to look for those differences or not is your decision, but that doesnt change the fact that there are differences. If you recognize that the second picture is different than the first, then you must already recognize this fact so i dont see your point.

Many voltage regulators can be turned into current regulators but some are much harder to do. Switching reg's can be harder to do because of noise and speed considerations.

#### RichardO

Joined May 4, 2013
2,271
@MrAl I am with @AlbertHall on this one.

The way I see it is that both the LM317 and LM78xx parts regulate the voltage between the output and "reference" pin. This is the ADJ pin of the LM317 and the ground of the LM78xx.

The only major difference is that the LM317 was optimized to minimize the reference pin current. This is done by dumping most of the operating current of the regulator through the load. This explains the minimum load current requirement of the LM317.

• Kjeldgaard

#### MrAl

Joined Jun 17, 2014
8,868
@MrAl I am with @AlbertHall on this one.

The way I see it is that both the LM317 and LM78xx parts regulate the voltage between the output and "reference" pin. This is the ADJ pin of the LM317 and the ground of the LM78xx.

The only major difference is that the LM317 was optimized to minimize the reference pin current. This is done by dumping most of the operating current of the regulator through the load. This explains the minimum load current requirement of the LM317.
Hi,

Then perhaps you can explain why i had to make that first X in my diagram in post #10 That cuts the line that went to the inverting input of the error amplifier. That in itself tells us right away that the topology is different.

I'll see if i can get around to writing up the control equations a little later today for both circuits so we can compare. One major difference we might see is output deviation with reference deviation where the LM317 is worse.

#### AlbertHall

Joined Jun 4, 2014
11,956
Which regulator is that 'non-LM317' supposed to be? It has five pins so it clearly doesn't represent the LM78xx family.

#### MrAl

Joined Jun 17, 2014
8,868
Which regulator is that 'non-LM317' supposed to be? It has five pins so it clearly doesn't represent the LM78xx family.
Hi,

I think you might be misinterpreting my intent here. My intent is not to show that the LM317 is different from every other regulator under the sun, it was to show that the LM317 is generally different than the typical feedback regulator. The more typical regulator does not regulate a current through a resistor in order to set the output voltage, it regulates the output more directly, Yes, a side effect is that it will end up regulating the current through two resistors (the set point resistors) but that is a consequence of regulating the output not regulating the current directly.
Are there other regulators that operate in a similar manner to the LM317? Sure. But if we want to know if the 7805 (or similar) is like the LM317 then we need to see an INTERNAL diagram of that regulator, not a circuit with the regulator in it. Recall that i already mentioned that we can use other regulators to make them look like they are doing what the LM317 is doing, but that does not mean they are the same basic type of regulator.

To show the difference i wrote up some equations for the LM317 and a more typical regulator. It does not matter how many pins it has it matters how it works, but if you do want to count the pins that's ok too as long as you dont classify it the same just because it has the same number of pins. The internal diagram tells what kind of regulator it is.

The first thing that stands out about the two equations is that if we call the upper resistor in both R1 and the lower resistor in both circuits R2, then the output equation, to get the same voltage, has R1 and R2 swapped.
This is actually pretty easy to notice because with a reference voltage of 1.000 volts (to keep it simpler than using 1.25v) then with the LM317 and R1=100 and R2=1000 we get 11 volts output, but with the second regulator in my previous diagram we get 1.1 volts output. It's only when we swap R1 and R2 in the second circuit that we get 11 volts output too. So to start, the two resistor functions are swapped.

The output time response is also different. It looks like the LM317 has faster response for the same internal component values such as for the error amplifier. We might look at this in more detail though.

The fact that the output voltage is very different for the same two values resistors says that something must be different, but the time response is also different which must say that these two types are different.

Another interesting difference is that the LM317 uses a two terminal variable resistance to set the output voltage when we set up the circuit to provide a variable output voltage, while the more typical regulator uses a potentiometer with all three terminals in use.
It's also interesting that the LM317 can not regulate down to zero volts output without a negative reference of some kind. For the more typical regulator, we just turn the pot down.

Basic output equation for typical regulator:
(A*(R2+R1))/(R1+R2+A*R2)

Basic output equation for LM317:
(A*(R2+R1))/(R1+R2+A*R1)

where A is the open loop gain of the internal error amplifier.
Note how in the denominator R1 and R2 are swapped for the two different types of regulators. There is clearly a topological difference here. Keep in mind that R1 is the resistor that connects to the output in BOTH types of regulators.

Last edited:

#### AlbertHall

Joined Jun 4, 2014
11,956
But if we want to know if the 7805 (or similar) is like the LM317 then we need to see an INTERNAL diagram of that regulator, not a circuit with the regulator in it.
So this is a difference that doesn't make a difference. They are used in the same ways, in the same circuits. The differences are in the details - 1.25V vs 5V, the quiescent current, the temperature coefficient, etc. which will need to be considered when designing a circuit using one of these devices - not how they actually work in practical circuits.

Take single-phase induction motors. There are four types which each use different methods of starting and maintaining a rotating field but they all start and run when power is applied. Again, there will no doubt be detail differences - power curve, starting torque and so on which will need to be allowed for in the design of the system using the motor - but they will all provide motive power.

#### MrAl

Joined Jun 17, 2014
8,868
Hi,

Yes i agree in part. If we just swap resistors in the 'typical' circuit we get the right output anyway The time response could be very different though,and that surprised me a little when i worked out the two equations. They are so different though that i fear i may have made a mistake in one of the assumptions so i want to go over them again before i post them.
On the other hand, buck circuits that monitor current can be much faster than the type that just monitor the output voltage, so maybe the time response really is a lot better for the LM317 given the same internal parts.
I hope to get to this later today.

Take care,
Al

#### ArakelTheDragon

Joined Nov 18, 2016
1,353
The LM317 has a built-in 1.25V voltage reference which is configured in a feedback loop such that it always attempts to keep the voltage between the OUT pin and the ADJ pin equal to 1.25V.
So, for example, if you placed a 200Ω resistor between OUT and ADJ pins, the current through the resistor would be forced by the LM317's internal feedback loop to be 1.25V /200Ω = 6.25mA.

Now if you wanted the output to be, say a regulated 5V, then you would need a resistor from the adjust pin to ground that would drop 5V-1.25V = 3.75V with a current of 6.25mA.
This resistor value for this would be 3.75V/6.25mA = 600Ω.

Since the ADJ input takes very little current, the LM317 output thus has to be 5V so that 6.25mA is flowing through both the 200Ω and the 600Ω resistors (5V/800Ω = 6.25mA).
Yep, this is it, and the "2.5V" needed over the "LM317" go for the internal transistors and components to be able to work, because they need power as well.

#### MrAl

Joined Jun 17, 2014
8,868
Yep, this is it, and the "2.5V" needed over the "LM317" go for the internal transistors and components to be able to work, because they need power as well.

Hi,

Yes that's true, and that means if we really wanted an output of 1.25v we'd need to have an input voltage of at least 2.50+1.25=3.75 volts.

However, that is also typical of a lot of other regulators too that use (an) NPN pass transistor(s). Regulators that use PNP transistors can have lower drop out voltage but they usually also need certain outout caps to keep them stable.

So i dont really count that as one of the major differences myself. The difference i see has more to do with the way the feedback is arranged.

The difference i am talking about shows up when we go to use the thing for something. We cant do certain things with one regulator that easily while with the other regulator type it is easier to accomplish.
For example, if we want to use a low power potentiometer for output adjustment with the LM317 we have to limit the output voltage or else the pot will burn out. With the more typical regulator we usually can set the pot's operating current to some very low value so we can easily use a 1/4 watt pot. With the recommended value for R1 of 120 ohms we get about 10ma current which means we need the pot set at 3000 ohms if we want to adjust up to 31 volts. Problem is 30^2/3000=0.3 watts which is too much above 0.25 watts. Of course we can go to a 1/2 watt pot though, if that's ok.for the app.

I've used the LM317 for many purposes though. It's great for a quick regulator. The spin offs are good too like the 5 ampere ones. The output varies with temperature quite a bit though so we have to be careful about that.
I might classify it as one of my favorite parts though because it's so easy to use.

Last edited: