LM317 LDO design excercise

Thread Starter

andrew74

Joined Jul 25, 2022
204
Hello, everyone.

1) Is there any reason to insert a 3.3k resistor between the blue and purple branches?
In the example on the datasheet, there isn't one.

2) From the formula, in the drawing Vout = 1.25*(1+40k/30)+Iadj(R2) = 1.667,91+Iadj(R2) .. where Iadj(R2) is typically 50µA and negligible in most applications. So Vout = 1.25*(1+40k/30) = 1333.33

ldo.png
 
Last edited:

MrAl

Joined Jun 17, 2014
13,667
Hello, everyone.

1) Is there any reason to insert a 3.3k resistor between the blue and purple branches?
In the example on the datasheet, there isn't one.

2) From the formula, in the drawing Vout = 1.25*(1+40k/30)+Iadj(R2) = 1.667,91+Iadj(R2) .. how much is Iadj(R2)?

View attachment 359158
That circuit does not look right. The upper does not match the lower circuit for one thing.
Where did you get this drawing?

Also, what are you intending to build here?
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
That circuit does not look right. The upper does not match the lower circuit for one thing.
Where did you get this drawing?

Also, what are you intending to build here?
Nothing to build, the professor asked if it was okay.

I don't think so, in fact, in the drawing I highlighted the discrepancy between his drawing (it could be wrong on purpose) and the schematic in the datasheet.
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
As noted by the answers to the same question in another forum, the top circuit is for constant-current.
The bottom circuit is constant-voltage, which is what those equations are for.

And the LM317 is not an LDO device.
Why is it a constant current?
 

crutschow

Joined Mar 14, 2008
38,324
Why is it a constant current?
The LM317 in normal regulator operation, is designed to maintain the Out pin voltage at a value of Vref (1.25V) greater than the ADJ pin voltage, no matter the external configuration.

Thus for the 1st circuit, this means 1.25V is maintained across the 30Ω resistor, R1, within the limits of the input voltage, the output load, and the minimum voltage drop across the LM317 required for operation (typically some greater than 2V).
Within those limits the output current is thus always 1.25V / 30Ω = 41.7mA, giving a constant current independent of the load resistance.

In contrast, the second circuit must have a constant output voltage independent of the load resistance, to maintain a constant Vref voltage between the ADJ and OUT pins.

All that make sense?
 

Thread Starter

andrew74

Joined Jul 25, 2022
204
The LM317 in normal regulator operation, is designed to maintain the Out pin voltage at a value of Vref (1.25V) greater than the ADJ pin voltage, no matter the external configuration.

Thus for the 1st circuit, this means 1.25V is maintained across the 30Ω resistor, R1, within the limits of the input voltage, the output load, and the minimum voltage drop across the LM317 required for operation (typically some greater than 2V).
Within those limits the output current is thus always 1.25V / 30Ω = 41.7mA, giving a constant current independent of the load resistance.

In contrast, the second circuit must have a constant output voltage independent of the load resistance, to maintain a constant Vref voltage between the ADJ and OUT pins.

All that make sense?
Thanks for your reply, very clear

However, I don't understand the 3.3k resistor on the adj pin
 

panic mode

Joined Oct 10, 2011
4,867
only Iadj flows through 3k3 and the voltage across that resistor is 50uA*3.3k = 165mV

so adding 3k3 in adj branch adds an offset of 0.165V. thus voltage across 30 Ohm resistor is reduced by that amount.
as a result, and assuming Vref=1.25V, we get

Iout = (Vref-0.165V)/30 Ohm = (1.25V-0.165V)/30Ohm = 0.0361666 A
Iload = Iout + Iref = 0.0361666 A +0.000050A = 0.03621666 A
since Iref is so much smaller than Iload, it can be ignored. you can see that both Iout and Iload are slightly different but both of them are practically 36.2mA. but its effect on Vref is significant (Vref is a small value) and there it should not be ignored. as a result expected output current is lower than when 3k3 is absent. 36mA < 41.7mA.

why would one add that resistor is something to think about... so...

what else is stated in the question? for example, what is the type of 3k3 resistor? where and how it is installed? perhaps the temp coefficient of resistor can compensate for LM317 thermal drift... that would be some 0.058mV/degC for carbon type resistor, and LM317 is within +/-2.5mV/degC
 
Last edited:

MrAl

Joined Jun 17, 2014
13,667
Nothing to build, the professor asked if it was okay.

I don't think so, in fact, in the drawing I highlighted the discrepancy between his drawing (it could be wrong on purpose) and the schematic in the datasheet.
Ok so there are two distinctly different drawings, so which one are you asking about then?
Or is it you just want to know about the 3.3k resistor?
 

WBahn

Joined Mar 31, 2012
32,706
Hello, everyone.

1) Is there any reason to insert a 3.3k resistor between the blue and purple branches?
In the example on the datasheet, there isn't one.

2) From the formula, in the drawing Vout = 1.25*(1+40k/30)+Iadj(R2) = 1.667,91+Iadj(R2) .. where Iadj(R2) is typically 50µA and negligible in most applications. So Vout = 1.25*(1+40k/30) = 1333.33

View attachment 359158
Become friends with the datasheets for the parts you use.

https://www.ti.com/lit/ds/symlink/l...rl=https%3A%2F%2Fwww.ti.com%2Fproduct%2FLM317

The formula in the datasheet example is for the circuit in the datasheet. It has NO meaning whatsoever for your circuit.

But, ignoring that, where are you coming up with R2 = 40 kΩ. Your drawing shows 1.0 kΩ At least that sure looks like "1.0k", but I guess it could be seen as being a really poorly written "40k".

The LM317 will attempt to maintain a voltage of about 1.25 V between "Vout" and "ADJ", but that can vary between 1.2 V and 1.3 V.

For most variants, the key points are as follows:

To work, the internal circuit is such that a current of approximately 50 µA must flow out of the "ADJ" pin. However, it could be less and could also be higher, though no more than 100 µA. But whatever it is for a particular device, it won't vary by more than 5 µA over the full operating range of voltage, current, and temperature.

Note that the voltage difference between Vin and Vout must be between 3 V and 40 V and also that Iout must be at least 10 mA for the device to regulate properly.

To analyze how the circuit would be expected to operate, apply the above information to it.

Let's assume that Iadj happens to be the typical 50 µA. Relative to the voltage at the ADJ pin, what will the voltage on the purple node be?

What is Vout relative to Vadj?

From those two things, you can figure out the current in R1.

Assuming none of the current goes through the diode to whatever is connected to Vo, you can determine the voltage on the purple node relative to the system ground. But it really doesn't matter what that voltage turns out to be (as far as the LM317 is concerned). Let's say that R2 is the 40 kΩ you took it to be. You would end up with Vout being right at 1890 V across it. But all the LM317 cares about is the differential voltage between Vin and Vout, so your Vin must be between about 1893 V and 1930 V and the LM317 won't care.
 

MrAl

Joined Jun 17, 2014
13,667
Hello, everyone.

1) Is there any reason to insert a 3.3k resistor between the blue and purple branches?
In the example on the datasheet, there isn't one.

2) From the formula, in the drawing Vout = 1.25*(1+40k/30)+Iadj(R2) = 1.667,91+Iadj(R2) .. where Iadj(R2) is typically 50µA and negligible in most applications. So Vout = 1.25*(1+40k/30) = 1333.33

View attachment 359158
Hello again,

I took a closer look at the top diagram. The bottom diagram is a completely different circuit and the calculations only give us a small hint about how the top diagram might be working.

As has been said, the output current is:
Iout=Vref/Rs

where Rs is the resistance connected directly to the output of the LM317.
With Vref=1.24v and Rs=30 Ohms that means the predicted output current is:
1.24/30=41.333ma

However, the reference voltage is not constant over temperature. This is where the 3.3k resistor might help.
Since the output current is highly dependent on the reference voltage, it is wise to try to maintain a constant reference voltage.

Now about that 3.3k resistor... The idea here could be a rough attempt to temperature compensate the change in reference voltage. The change in bias current is around 5ua over T=0 to T=100C roughly, so the change in reference voltage is 5ua (not 50ua) times 3300. That can be used to help keep the total reference voltage approximately constant which in turn helps to keep the output current constant.
I am going to use a 3k resistor as the example instead of 3.3k which makes the math a little cleaner. It's always an approximation anyway.

If we study this device a little closer we find that the voltage of the internal voltage reference (Vref) drops with an increase in temperature. In the same way, the bias current (iB) increases.
If we look at T=0C to T=100C we find the following approximations:
T=0, Vref=2.5v, iB=45ua
T=100C, Vref=2.235v, iB=50ua
These are not exact but are rough approximations that helps to keep the math simpler.

Now inserting a 3k resistor between the ADJ pin and the output, when iB becomes 5ua higher, the increase in total reference voltage is 0.015v. That, added to 2.325v gives us again 2.5v. This means the total reference voltage used to set the output current stays at about 2.5v over T=0 to T=100C.
Again, this is an approximate calculation you have to test your setup to make sure it works right. In theory this works to some degree so it's worth looking into.
This was a simplified view. The actual total reference voltage stays close to 1.385v because the 3k resistor is always in the circuit, which means that internal Vref is always boosted to some degree. The key is how much it changes, which will be less with the 3k resistor.
This idea is not new either. It has been used with older op amps in the past to help temperature compensate using the bias current.

One last thing...
Since the output with a 1k resistor and 30 Ohm resistor for the current setting will be around 41ma, that means the output would have to go up to at least 41 volts which is too high unless you can find a special version of the LM317 that works with a higher voltage.

There is actually one question that comes up though:
What is the diode on the output for? If it is a constant current circuit, then why show the output voltage after the diode?

[LATER]
Doing an analysis using differentials the result comes out simple (Rs is the resistor connected directly to the output of the LM317, and R3 is the 3.3k resistor in that top diagram which is the temperature compensation resistor here):
R3=-dVref/dI1-Rs
and keeping in mind that dVref will be negative, if we write it as positive we can write this as:
R3=dVref/dI1-Rs
and for the above values this comes out to:
R3=3000-30
which of course equals:
R3=2970 Ohms
That is an exact analysis but using the approximated deviations in Vref and iBias over T=0 to T=100C.
 
Last edited:

Thread Starter

andrew74

Joined Jul 25, 2022
204
Hello again,

I took a closer look at the top diagram. The bottom diagram is a completely different circuit and the calculations only give us a small hint about how the top diagram might be working.

As has been said, the output current is:
Iout=Vref/Rs

where Rs is the resistance connected directly to the output of the LM317.
With Vref=1.24v and Rs=30 Ohms that means the predicted output current is:
1.24/30=41.333ma

However, the reference voltage is not constant over temperature. This is where the 3.3k resistor might help.
Since the output current is highly dependent on the reference voltage, it is wise to try to maintain a constant reference voltage.

Now about that 3.3k resistor... The idea here could be a rough attempt to temperature compensate the change in reference voltage. The change in bias current is around 5ua over T=0 to T=100C roughly, so the change in reference voltage is 5ua (not 50ua) times 3300. That can be used to help keep the total reference voltage approximately constant which in turn helps to keep the output current constant.
I am going to use a 3k resistor as the example instead of 3.3k which makes the math a little cleaner. It's always an approximation anyway.

If we study this device a little closer we find that the voltage of the internal voltage reference (Vref) drops with an increase in temperature. In the same way, the bias current (iB) increases.
If we look at T=0C to T=100C we find the following approximations:
T=0, Vref=2.5v, iB=45ua
T=100C, Vref=2.235v, iB=50ua
These are not exact but are rough approximations that helps to keep the math simpler.

Now inserting a 3k resistor between the ADJ pin and the output, when iB becomes 5ua higher, the increase in total reference voltage is 0.015v. That, added to 2.325v gives us again 2.5v. This means the total reference voltage used to set the output current stays at about 2.5v over T=0 to T=100C.
Again, this is an approximate calculation you have to test your setup to make sure it works right. In theory this works to some degree so it's worth looking into.
This was a simplified view. The actual total reference voltage stays close to 1.385v because the 3k resistor is always in the circuit, which means that internal Vref is always boosted to some degree. The key is how much it changes, which will be less with the 3k resistor.
This idea is not new either. It has been used with older op amps in the past to help temperature compensate using the bias current.

One last thing...
Since the output with a 1k resistor and 30 Ohm resistor for the current setting will be around 41ma, that means the output would have to go up to at least 41 volts which is too high unless you can find a special version of the LM317 that works with a higher voltage.

There is actually one question that comes up though:
What is the diode on the output for? If it is a constant current circuit, then why show the output voltage after the diode?

[LATER]
Doing an analysis using differentials the result comes out simple (Rs is the resistor connected directly to the output of the LM317, and R3 is the 3.3k resistor in that top diagram which is the temperature compensation resistor here):
R3=-dVref/dI1-Rs
and keeping in mind that dVref will be negative, if we write it as positive we can write this as:
R3=dVref/dI1-Rs
and for the above values this comes out to:
R3=3000-30
which of course equals:
R3=2970 Ohms
That is an exact analysis but using the approximated deviations in Vref and iBias over T=0 to T=100C.
Become friends with the datasheets for the parts you use.

https://www.ti.com/lit/ds/symlink/lm317.pdf?ts=1763644692708&ref_url=https%3A%2F%2Fwww.ti.com%2Fproduct%2FLM317

The formula in the datasheet example is for the circuit in the datasheet. It has NO meaning whatsoever for your circuit.

But, ignoring that, where are you coming up with R2 = 40 kΩ. Your drawing shows 1.0 kΩ At least that sure looks like "1.0k", but I guess it could be seen as being a really poorly written "40k".

The LM317 will attempt to maintain a voltage of about 1.25 V between "Vout" and "ADJ", but that can vary between 1.2 V and 1.3 V.

For most variants, the key points are as follows:

To work, the internal circuit is such that a current of approximately 50 µA must flow out of the "ADJ" pin. However, it could be less and could also be higher, though no more than 100 µA. But whatever it is for a particular device, it won't vary by more than 5 µA over the full operating range of voltage, current, and temperature.

Note that the voltage difference between Vin and Vout must be between 3 V and 40 V and also that Iout must be at least 10 mA for the device to regulate properly.

To analyze how the circuit would be expected to operate, apply the above information to it.

Let's assume that Iadj happens to be the typical 50 µA. Relative to the voltage at the ADJ pin, what will the voltage on the purple node be?

What is Vout relative to Vadj?

From those two things, you can figure out the current in R1.

Assuming none of the current goes through the diode to whatever is connected to Vo, you can determine the voltage on the purple node relative to the system ground. But it really doesn't matter what that voltage turns out to be (as far as the LM317 is concerned). Let's say that R2 is the 40 kΩ you took it to be. You would end up with Vout being right at 1890 V across it. But all the LM317 cares about is the differential voltage between Vin and Vout, so your Vin must be between about 1893 V and 1930 V and the LM317 won't care.
I can see no good reason for that resistor.
Wow, guys, thank you so much for your analysis, it has been extremely helpfull!

Just out of curiosity, do you know of any devices that are "newer/better" than the LM317?
I ask because I would like to look at their datasheets as well.
I'll do some research.
 

MrAl

Joined Jun 17, 2014
13,667
Wow, guys, thank you so much for your analysis, it has been extremely helpfull!

Just out of curiosity, do you know of any devices that are "newer/better" than the LM317?
I ask because I would like to look at their datasheets as well.
I'll do some research.
Hi,

They do make versions that go up to 5 amps maybe more now. They have a different part number but you can search that.

I think I remember one with a current limit pin too so you can set the current limit. It's been a long time though it could have been a switching regulator with that ability. However, a switching regulator IC chip can be used in place of the LM317 to regulate voltage or current and that would be much more efficient for a general output voltage or current. You should look into that. One type is called the "Simple Switcher" line of IC chips originally made by National Semiconductor. Pretty sure they still make them and probably better ones too now.
 

crutschow

Joined Mar 14, 2008
38,324
The idea here could be a rough attempt to temperature compensate the change in reference voltage.
Is there any guarantee that the change in ADJ bias current with temperature is always in a direction such as to correct for the reference voltage change with temperature?
 

MrAl

Joined Jun 17, 2014
13,667
The likely use is to block any negative voltage applied to the output.
I think you meant it is to block any positive voltage applied to the output.
Since the output at the anode is always positive and the anode is connected to that output and we would take the diode output from the cathode, a negative voltage would always forward bias the diode.


Is there any guarantee that the change in ADJ bias current with temperature is always in a direction such as to correct for the reference voltage change with temperature?
According to the data sheet the adjust pin current starts out low at -50C and goes up monotonically to a max at +150C.
This is the way bias current usually works anyway though as illustrated by op amp designs that used this principle.
It's still good that you brought this up though because the span in the change in bias current from device to device can be quite wide, from 0.2ua to 5u which is more than a 20-fold change. That means that resistor we are calling 3.3k (or just 3k) probably has to be hand selected. For example, for a 0.5ua change we might have to use a 30k resistor. However, since we also have to consider the change in Vref and dVref/dT is not always negative, we'd have to check that too and make adjustments. That means this modification would probably only be good from 0C to 150C not for the full range of -50C to 150C. I stuck with 0 to 100C because that's a typical range in practice,

The bias current change is not the only noteworthy characteristic about this device either. The reference voltage variation with higher current outputs also has to be considered. The data sheet specifies 1 percent, but that's only true with light loads. Once we get into a more significant output current the on-chip voltage reference heats up, and that can cause up to a 2 percent change even at constant ambient of T=25C. They don't seem to indicate that behavior on the data sheet. It could even be more than that.

The variation in operating parameters here is why temperature critical applications have to be tested in a temperature chamber or just an oven. Older analog meters had to be tested one by one to make sure their operation fell within the specifications.
 
Top