Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LM317 Calculating =)

Status
Not open for further replies.

Corday

New Member
I have just made an adjustable voltage-regulator with a LM317, but i am still abit confused about the calculations...

This is the official formula provided by the manufacturers:
Vout = 1,25*(1+(R2/R1)) + Iadj*R2

However, since I must have missed the classes where breaking out variables was explained - i am real stuck.

Vague sources has led me to the following tho:

R2 = R1*((Vout/1,25)-1)
* Note that Iadj*R2 from the original formula is missing here

and

R1 = (R2*1,25)/(Vout-((50*10^-6)*R2))
* Iadj*R2 included

Trying these formulas in excel shows that the formulas for Vout and R1 renders matching results, whereas R2 differs by the amount that Iadj*R2 would give.. However, i am mathematically incapable of inserting that into the formula =(

I know that the TI-datasheet says "Because IAdj typically is 50 mA, it is negligible in most applications." However i find that ignoring it entirely (which all online calculators does), is pretty rough... Because lets say i use a 10k potentiometer for R2. That will result in: (50*10^-6)*10000 equals 0,5v. Which can be alot to some electronics...

Plus, i want all the formulas to match up =)
 
The LM317 uses a 120 ohm resistor from the output to the ADJ pin, the more expensive LM117 can use a 240 ohm resistor.

Then the other resistor is calculated using Ohm's Law since the ADJ current is extremely small (it is typically 50uA, not 50mA which is 1000 times higher).

You forgot to tell us the range of output voltages that you want.

If you use 120 ohms for R1 and a 10k pot for R2 then the max output will try to be 104V which is impossible. So the 10k pot value is much too high.
 
Yeah mA was a typo obviously... The correct "uA" is in the datasheet..

Hmm how do you mean "it uses"? I can use any resistor i'd like afaik.. I use 680+680 for R1 which equals 1360. Then i use a 10k pot for R2 which results in a max output of 10,94v. Tested and verified aswell.

But my question was not regarding what output voltage i want, but a correct formula for breaking out R2 from "Vout = 1,25*(1+(R2/R1)) + Iadj*R2".
 
Last edited:
The 317 must produce at least 10ma of current for it to work properly. That is why there is almost always a 120Ω resistor for R1 (with a constant 1.25v developed across the Vout pin and the ADJ pin the current will be E/R = 1.25/120 ≈ 10ma.) This means there will also be 10ma across R2. Using E = IR to figure the voltage developed across R2 this is the voltage from GND to the ADJ pin. Add that to the constant 1.25v from ADJ to Vout and you will have the output voltage from Vout to GND.

(1.25 + 0.01*R2 = Vout) with a 120 Ω R1.

You can make R1 smaller than 120Ω but not larger. If you do, rhe 317 will not produce the 10ma it needs to run.
 
Every IC has a range of currents for it to work properly. Some LM317 ICs need 120 ohms or less for R1 to prevent the output voltage from rising when the load current is not much but other LM317 ICs work fine with 240 ohms or more. The problem gets worse when the input voltage is high. The datasheet explains it.

You should design circuits so that all passing ICs work, not just some of them.
 
Oki, great information! I will consider it in the future. Although i have spent countless hours reading about the LM317, I am yet to find any information that says to use max 120Ω. Quite the contrary actually, as you can see in guides and tutorials for the LM317, people use resistors hugely different to 120Ω. But thanks for pointing it out nonetheless.

Edit: Ok i tested myself now and see the point of using <=120Ω for R1 now. Then the regulator shows the desired Vout even without any load on it.. :) But as soon as a regulator with R1 >120Ω gets load on it (tested with a 0,1A fan) it starts producing the desired Vout. I will use <=120Ω in the future. Thanks!

So, if we put all that aside now, I would be really happy for a solution to my original topic.

And to clarify, i will make a recap.

Vout can be calculated knowing the values of R1 and R2.

R1 can be calculated knowing the Vout i want and R2.

X R2 can be calculated the same way but knowing the Vout and value of R1, however, i need help with breaking out R1 from the original formula Vout= 1,25*(1+(R2/R1)) + Iadj*R2

To make it even clearer, lets put values for Vout and R1.

Vout = 12,5v
R1 = 120Ω
R2 = x

Which makes: 12,5=1,25*(1+(x/120))+((50*10^-6)*x)
Solve X
 
Last edited:
Forget about Iadj because it is negligible.

Resistor R1 has typically 1.25V across it and R2 has the remaining output voltage across it.
So for an output of 12.5V, R1 has 1.25V across it and its current is 1.25V/120 ohms= 10.42mA.
R2 also has 10.42mA and has a voltage of 12.5V - 1.25V= 11.25V across it.
Ohm's Law calculates the value of R2 to be 11.25V/10.42mA= 1080 ohms.
 
If you think that Iadj(R2) is a significant term then you may want to look at the data sheet for the 317 and see that the permissable value of Iadj can be anything up to 100ua.
Then you may also want to look at the permissable variation in Vref which can be as low as 1.2v and as high as 1.3v.
You will need to know these values to accurately predict Vout or ignore the above and calculate the worst case conditions and use a trimpot to give you exactly what you want. Set it and forget it.

R2 = (R1)(Vout - Vref)/(Vref + Iadj * R1)
 
Oki! Done with calculations =)

Hmm.. While testing i tried a fixed Vout of ~11 using 27Ω for R1 and 220Ω for R2...

Everything works Ok, im getting 10,94Vout but R2 is getting really warm, really quick :/ I tried both 24v and 14v for Vin, but effect is the same.. It takes around 15s for it to become too hot to touch, even without anything connected to Vout..

This cant be normal right? Could it be because i used so low values of R1 and R2? Any ideas?

Edit: Both R1 and R2 are 1/4w with 5% tolerance
Edit2: LM317 IC is not getting warm
 
Last edited:
With Vout at 11v, and Vref at 1.25v, there is 11 - 1.25 or 9.75v across R2. P = E^2/R = (9.75)(9.75)/220 = 0.43 watts dissipated. This is a lot higher than the 0.25 watt rating of your resistor. To operate with a reasonable margin, resistor wattage should always be derated by at least a factor of 2. I was taught 2.5 and I stick with that. The nearest whole value for a derated 0.433 watt dissipation is 1 watt.

Tweaking the input voltage to the regulator has no effect on R1/R2 because by definition, the regulator maintains a regulated (fixed) voltage at its output where the two resistors hang out. What does happen is the heat generated inside the 317 rises with increasing input voltage.
 
I cannot post a quick reply. It says "my reply is too short" but twice it was fairly long.

You need to learn that voltage times current equals heating.
 
... but R2 is getting really warm, really quick ...
Could it be because i used so low values of R1 and R2? Any ideas?
...

You got it.

Try changing R1 to about 120 ohms as AG suggested. Then R2 should be about the same ratio.
so 220 / 27 = 8.1

120 ohms * 8.1 = 977 ohms (use 1k?)

a good idea is to use a pot for R2 so you can adjust the voltage.

If you use a fixed resistor of 680 ohms and a 500 ohm pot in series, this makes an "R2" that is adjustable from 680 ohms to 1180 ohms.
 
Thanks all! Its getting clearer and clearer =)

Hmmm... I see why a potentiometer is strongly preferred... Am i right if i take it that the calculations is more of a "pointer" than the actual truth? Because I had to try a whole bunch of different resistors for R2 in order to get the final Vout that i wanted.. Ended up with 3 in serial connection.
 
The "1.25V" reference of an LM317 can be anywhere from 1.2V to 1.3V.
The resistors might be 5% low or 5% high.
Then the output voltage will not be what you want without using a trimpot.
 
Got the voltage regulator working as I wanted now and feel thoroughly enlightened by all information you have provided!

I would like to say thanks to audioguru, Jaguarjoe and mr RB for having patience and helping me understand the fundamentals of a LM317 =)

And although i have concluded i may not be able to use it for the intended purpose, it was great practice and will come to good use for other stuff.

If you have some time spare, please have a look at my new thread that will regard my actual project =)
 
Hi,

Here are a couple formulas that might help:

R2=((4*Vout-5)*R1)/(4*Iadj*R1+5)

R1=-(5*R2)/(4*Iadj*R2-4*Vout+5)

or if you want to adjust Vref then:

R1=(Vref*R2)/(Vout-Iadj*R2-Vref)

R2=((Vout-Vref)*R1)/(Iadj*R1+Vref)

Stated another way:
R2/R1+(Iadj*R2)/Vref=Vout/Vref-1

so if we take Iadj to be zero we get:
R2/R1=Vout/Vref-1

so we can see the ratio of resistor values is equal to the ratio of voltages minus 1.
 
Last edited:
Wow that is whoopin cool MrAl =) I love this kind of stuff! Admirable!

I have tested and they work!! Big creds to you!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top