Author Topic: LM317 wrong output voltage  (Read 1667 times)

0 Members and 1 Guest are viewing this topic.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
LM317 wrong output voltage
« on: September 07, 2024, 08:32:25 pm »
Hello,

I have schematic + layout as in attached pictures.

the LM317 I got is this one: https://www.lcsc.com/product-detail/Linear-Voltage-Regulators-LDO_Texas-Instruments-LM317DCYR_C51466.html which is legit TI one.

input is 15v and it delivers output voltage of 14.35v unloaded.

I have a small switch to choose the output voltage between 12v or 9v, it switches feedback resistors. the same switch used elsewhere in the board and worked perfectly fine.


I verified all connections to be ok, and put a DC electronic load starting few milliamps til 1.5 amps and the output voltage is 12.1v when choosing 9v and it is 13.3v when choosing 12v option. while unloaded both stays 14.35v.

the feedback resistors as follows:

R1 = 10k

R2 = 62.2k or 86.6k for 9v and 12v respectively.


I know it requires small load to operate but i fed it different amounts of current but still no use.

what is the problem?


i need it for cheaply and effectively reduce 15v to either 12v or 9v, current required is very small so that any lm317 is enough. cheaply sourcing it via LCSC is a must too.

can't see why this didn't work despite being simple circuit, the irony is the complicated buck regulators worked perfectly.


for your kind help

Online wraper

  • Supporter
  • ****
  • Posts: 17713
  • Country: lv
Re: LM317 wrong output voltage
« Reply #1 on: September 07, 2024, 08:38:36 pm »
LM317 requires minimum load. >5-10mA depending on flavor. If resistive divider has low enough resistance, it will provide it with no additional load. And you should not use so high divider resistance regardless if you provide minimum load in other ways as ADJ pin has current in tens of uA.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #2 on: September 07, 2024, 08:49:48 pm »
LM317 requires minimum load. >5-10mA depending on flavor. If resistive divider has low enough resistance, it will provide it with no additional load. And you should not use so high divider resistance regardless if you provide minimum load in other ways as ADJ pin has current in tens of uA.

but i put external load as mentioned and it didn't help.

you mean my resistor divider values are so high that it won't regulate regardless of what load i put to it?? first time i know this about it.

please confirm.

Online IanB

  • Super Contributor
  • ***
  • Posts: 12425
  • Country: us
Re: LM317 wrong output voltage
« Reply #3 on: September 07, 2024, 09:01:00 pm »
you mean my resistor divider values are so high that it won't regulate regardless of what load i put to it??

R1 is supposed to be about 240 Ω or less. Recommended 120 Ω.

Quote
first time i know this about it.

It's in the data sheet. There is a very comprehensive data sheet available for the part, full of application notes. You should not ask us, you should download it and read it.
« Last Edit: September 07, 2024, 10:53:11 pm by IanB »
 
The following users thanked this post: tooki

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: LM317 wrong output voltage
« Reply #4 on: September 07, 2024, 09:09:02 pm »
Measure your ADJ pin, check if it's 1.25V below VOUT like it should be.

Also if you're using break-before-make switch it may be better to switch the upper resistor, or make the switch to shunt parallel resistor. That'll avoid your VOUT from momentarily going up all the way to VIN when you change switch position.
« Last Edit: September 07, 2024, 09:12:59 pm by ArdWar »
 
The following users thanked this post: tooki

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: LM317 wrong output voltage
« Reply #5 on: September 07, 2024, 09:14:46 pm »
R11 needs to be 120 ohms. Period.
Yes, you'll be wasting some power. Live with it or choose a different regulator IC.

For the voltage selection, your solution is not nice. Have a fixed resistor for R12 and switch in a parallel R13 resistor for the second voltage. Then everything is stable at all times.

« Last Edit: September 07, 2024, 09:19:14 pm by Benta »
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 920
  • Country: ca
Re: LM317 wrong output voltage
« Reply #6 on: September 07, 2024, 09:18:08 pm »
R11 is typically from 220R to 470R (Rtop in formula below).
R12 or R13 should be changed accordingly (Rbottom in formula below).

Also, I would NOT use a SPDT (break before make) switch like you've shown since there is a moment where both R12 and R13 are completely disconnected from the ADJ pin.  This makes the LM317 into a current regulator and you'll momentarily see Vout = Vin!  Instead, there should always be a resistance between the ADJ pin and GND and use a SPST switch to connect a parallel resistor (making the combined resistance lower) to select a lower output voltage.

Using the formula: Vout=1.25 x (1 + Rbottom/Rtop)
Re-arrange to determine Rbottom = ((Vout ÷1.25)−1)×Rtop

((12÷1.25)−1)×390 = 3354 (3K3+47 is close)
((9÷1.25)−1)×390 = 2418 (need 8K7 in parallel with above to produce; see 200K||9K1 is close)

« Last Edit: September 07, 2024, 09:25:22 pm by pqass »
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: LM317 wrong output voltage
« Reply #7 on: September 07, 2024, 09:22:24 pm »
R11 is typically from 220R to 470R

Source, please? The data sheet says something else.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #8 on: September 07, 2024, 09:27:28 pm »
Quote
R1 is supposed to be about 240 Ω or less. Maybe 120 Ω.
yes i noticed most circuits do this but still datasheet showed an example of using larger values.



Quote
VO = VREF (1 + R2 / R1) + (IADJ × R2)

this one is the one i used, but neglected "Iadj*R2" part.

 I designed many LM317 circuits in the past but never really cared about this part and they seemed to work well. Funny thing that this is the easiest least important part of the design... yet it is the only one which failed. the rest (2 buck regulators + power selection circuit + ...) worked perfectly fine.

tomorrow i will detach it from the board and use these smaller values to see what happens.

but i'd like to confirm if this is the real reason... meaning the Iadj*R2 effect when using high value R2.

I ran some calculations:

Vo = 1.25 (1+86.6k/10k) + 0.00005*86.6k = 12.075 + 4.33 = 16.4v and since input voltage is 15v then it will give the maximum it can give which is roughly 14.35v.

trying lower values:

Vo = 1.25 (1 + 1.54k/180R) + 0.00005*1.54k = 11.94 + 0.077 = 12.021v

and by adding yet another 180R resistor at the output itself as a continuous load then I guess it will be perfect. what do you think?:



__________

as for the switch, do not worry about it as the user will power off the device then choose the required voltage, after that he will power it on. there won't be any changing when the device is on, and the user will do the switch once in his life.


Offline pqass

  • Frequent Contributor
  • **
  • Posts: 920
  • Country: ca
Re: LM317 wrong output voltage
« Reply #9 on: September 07, 2024, 09:27:55 pm »
R11 is typically from 220R to 470R

Source, please? The data sheet says something else.

Most of the examples in the datasheet.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: LM317 wrong output voltage
« Reply #10 on: September 07, 2024, 10:01:14 pm »
R11 is typically from 220R to 470R

Source, please? The data sheet says something else.

Most of the examples in the datasheet.
Yes, I know. And it will mostly work with 240 ohms in a typical application. But being an engineer, it's best practice to use the limits of a specification to ensure correct operation.
And the limit is "Minimum load current to maintain regulation" (p.6), which is 10 mA(max), 3.5 mA(typ).

TI has the liberty to use typical values for their examples, in this case 5 mA.

But how you get from there to 220...470 ohms is a mystery to me. Sorry.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3921
  • Country: nl
Re: LM317 wrong output voltage
« Reply #11 on: September 07, 2024, 10:19:12 pm »
as for the switch, do not worry about it as the user will ...

No! Bad design paradigm. You have no control over your users, and they will always turn up to be a bigger idiot then you think, make silly mistakes, the switch wears out or other.

And the solution is simple: Use the resistor for the biggest voltage and solder it in permanently, then use the switch to put another resistor in parallel to it.

And also, test things like this on a breadboard before you start soldering.
 
The following users thanked this post: tooki

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #12 on: September 07, 2024, 10:23:23 pm »
R11 is typically from 220R to 470R

Source, please? The data sheet says something else.

Most of the examples in the datasheet.
Yes, I know. And it will mostly work with 240 ohms in a typical application. But being an engineer, it's best practice to use the limits of a specification to ensure correct operation.
And the limit is "Minimum load current to maintain regulation" (p.6), which is 10 mA(max), 3.5 mA(typ).

TI has the liberty to use typical values for their examples, in this case 5 mA.

But how you get from there to 220...470 ohms is a mystery to me. Sorry.

maybe he meant using 240 ohms and also put external load to make it exceed 10 mA.

but your idea of using 120 ohms as Rtop seems most safe. i don't care how many milli amps will it take too... it's use is very limited and with very low current consumption. having it consume 10 mA or even 50 mA by itself is not worrying me... still adding something like 1k ohm as external load is doable for me. will consume extra 9mA\12mA

taking the idea of parallel resistor feedback:

R top = 120 ohms
for 12v: R bottom = 1032 ohms ~ 1k ohm + 33ohms


for 9v: R bottom = 744 ohms --> to achieve it i need 2660 ohms in parallel with 1033 ohms of above. to get 2660 ohms I can have: 2.2k +470 ohm =~ 2670 ohms which is ok.

switch switches the 2670 ohm resistor or not.

calculating all with Iadj added:

V = 1.25 (1 + 1033/120) + 0.00005*1033 = 12.01 + 0.0516 = 12.061v
V = 1.25 (1 + 744.8312/120) + 0.00005*744.8312 = 9.008 + 0.037 = 9.045v

^ which seems perfect, tiny headroom is good.


Quote
No! Bad design paradigm. You have no control over your users, and they will always turn up to be a bigger idiot then you think, make silly mistakes, the switch wears out or other.

And the solution is simple: Use the resistor for the biggest voltage and solder it in permanently, then use the switch to put another resistor in parallel to it.

And also, test things like this on a breadboard before you start soldering.

I wrote this post before you added yours, please read it and check if i got it correctly this time. I think i did, unless a small calculation mistake happened.

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: LM317 wrong output voltage
« Reply #13 on: September 07, 2024, 10:48:46 pm »
RB = 1k5; RT = 240R || RT2 = 620R. VO = 9V if switch broken; might be on the lower side of IL(min), otherwise use 750R, 120R, 300R
RT = 150R; RB = 1k3 || RB2 = 3k3. VO = 12V if switch broken
« Last Edit: September 07, 2024, 10:51:15 pm by ArdWar »
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 920
  • Country: ca
Re: LM317 wrong output voltage
« Reply #14 on: September 07, 2024, 10:51:02 pm »
But how you get from there to 220...470 ohms is a mystery to me. Sorry.

You're right, my bad. I've been living dangerously, relying on the load to make up the minimum.
I usually use 330R or 220R; never less.  I never seem to have 240R (not a E12 series).
See below for the current draw and Rbottom values over some Vout and Rtop values.

Code: [Select]
Vout 30 24 15 12 9 5 3.3 V

Rtop 470 470 470 470 470 470 470 R
Rbottom 10810 8554 5170 4042 2914 1410 770.8 R
Rsum 11280 9024 5640 4512 3384 1880 1240.8 R
Isum 2.660 2.660 2.660 2.660 2.660 2.660 2.660 mA

Rtop 390 390 390 390 390 390 390 R
Rbottom 8970 7098 4290 3354 2418 1170 639.6 R
Rsum 9360 7488 4680 3744 2808 1560 1029.6 R
Isum 3.205 3.205 3.205 3.205 3.205 3.205 3.205 mA

Rtop 330 330 330 330 330 330 330 R
Rbottom 7590 6006 3630 2838 2046 990 541.2 R
Rsum 7920 6336 3960 3168 2376 1320 871.2 R
Isum 3.788 3.788 3.788 3.788 3.788 3.788 3.788 mA

Rtop 220 220 220 220 220 220 220 R
Rbottom 5060 4004 2420 1892 1364 660 360.8 R
Rsum 5280 4224 2640 2112 1584 880 580.8 R
Isum 5.682 5.682 5.682 5.682 5.682 5.682 5.682 mA

Rtop 180 180 180 180 180 180 180 R
Rbottom 4140 3276 1980 1548 1116 540 295.2 R
Rsum 4320 3456 2160 1728 1296 720 475.2 R
Isum 6.944 6.944 6.944 6.944 6.944 6.944 6.944 mA

Rtop 120 120 120 120 120 120 120 R
Rbottom 2760 2184 1320 1032 744 360 196.8 R
Rsum 2880 2304 1440 1152 864 480 316.8 R
Isum 10.417 10.417 10.417 10.417 10.417 10.417 10.417 mA
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7530
  • Country: ca
Re: LM317 wrong output voltage
« Reply #15 on: September 07, 2024, 11:03:58 pm »
The project has another issue, it's got pretty much nothing for copper pour to heatsink the IC.
Why 12 vias on the input pin? Are you hoping for 10A or something?
OP if you're expecting more than 150mA out of this, you're going to have a bad day.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17232
  • Country: us
  • DavidH
Re: LM317 wrong output voltage
« Reply #16 on: September 07, 2024, 11:10:46 pm »
The voltage across your R11 is always the reference voltage of 1.25 volts, which creates a current through your R12 or R13 setting the output voltage.  Usually R11 is selected to produce a current of 5 to 10 milliamps, or 250 to 125 ohms, satisfying the minimum load current requirement of the 317.

There is another limit however if R11 is increased in value.  The adjustment pin current could be as high as 100 microamps, which adds an error voltage into the parallel resistance of the resistor divider.  In your case, 100 microamps into about 9 kilohms is 0.9 volts, so significant  error compared to the 4% error of the 1.25 volt reference.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #17 on: September 07, 2024, 11:17:42 pm »
The project has another issue, it's got pretty much nothing for copper pour to heatsink the IC.
Why 12 vias on the input pin? Are you hoping for 10A or something?
OP if you're expecting more than 150mA out of this, you're going to have a bad day.

i am expecting very few mA, certainly not above 100 mA or so IF this rail is used. adding those vias was because i added similar ones to power hungry buck regulators nothing more.

Quote
The voltage across your R11 is always the reference voltage of 1.25 volts, which creates a current through your R12 or R13 setting the output voltage.  Usually R11 is selected to produce a current of 5 to 10 milliamps, or 250 to 125 ohms, satisfying the minimum load current requirement of the 317.

There is another limit however if R11 is increased in value.  The adjustment pin current could be as high as 100 microamps, which adds an error voltage into the parallel resistance of the resistor divider.  In your case, 100 microamps into about 9 kilohms is 0.9 volts, so significant  error compared to the 4% error of the 1.25 volt reference.

I have added some calculations based on R_top being 120 ohms, please check them.



Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3921
  • Country: nl
Re: LM317 wrong output voltage
« Reply #18 on: September 07, 2024, 11:22:35 pm »

I have added some calculations based on R_top being 120 ohms, please check them.

Use a breadboard and verify them yourself. A bit of hands-on experience helps with ... experience, understanding, and self esteem and self reliance.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #19 on: September 07, 2024, 11:31:01 pm »

I have added some calculations based on R_top being 120 ohms, please check them.

Use a breadboard and verify them yourself. A bit of hands-on experience helps with ... experience, understanding, and self esteem and self reliance.

too late now, i will try that tomorrow.

before trying them, i just wanted to share the idea and see if it is suitable.

i guess i can desolder the ADJ pin from the board and hook it up to the resistor network I will create. lifting one pin seems easier.


I had another problem in the board elsewhere, which is one of these switches used to select voltages for this IC AP22966DC8-7 seemingly didn't perform as well after a while and got shorting... resulting in the IC outputting wrong value regardless of choice. one switch position outputs the correct voltage while the other does output the short.
thus I am thinking of changing them to CUI SLW-121456-3A-N-D since CUI is a better manufacturer for sure. paying more to get better choice and never worry about it again.

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: de
Re: LM317 wrong output voltage
« Reply #20 on: September 07, 2024, 11:39:41 pm »
@VEGETA, your last calculations are fine, and you've found realistic resistor values.
Now let's take the engineering approach further operating with component tolerances.

Let's use the "exact" (but rounded) values first: R11: 120 ohms, R12: 1032 ohms, R13: 2660 ohms.
Vout1 = 12 V (R12 only)
Vout2 = 9 V (R12 || R13)

But that's all based on an LM317 reference voltage of 1.25 V.
In reality, it's 1.2...1.3 V, which gives:
Vout1 = 11.52...12,48 V
Vout2 = 8.64...9.36 V

As you see, the Ibias influence is negligible (which is the whole idea behind the LM317). And just using 1 kohm for R12 and 2.7 kohm for R13 is likely good enough.
« Last Edit: September 07, 2024, 11:44:50 pm by Benta »
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: LM317 wrong output voltage
« Reply #21 on: September 07, 2024, 11:45:06 pm »
How does a load switch even managed to output "wrong" value? Do you use it as manual priority OR-ing or something?
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #22 on: September 07, 2024, 11:54:44 pm »
@VEGETA, your last calculations are fine, and you've found realistic resistor values.
Now let's take the engineering approach further operating with component tolerances.

Let's use the "exact" (but rounded) values first: R11: 120 ohms, R12: 1032 ohms, R13: 2660 ohms.
Vout1 = 12 V (R12 only)
Vout2 = 9 V (R12 || R13)

But that's all based on an LM317 reference voltage of 1.25 V.
In reality, it's 1.2...1.3 V, which gives:
Vout1 = 11.52...12,48 V
Vout2 = 8.64...9.36 V

As you see, the Ibias influence is negligible (which is the whole idea behind the LM317). And just using 1 kohm for R12 and 2.7 kohm for R13 is likely good enough.

nice, so my values should be ok too. going precise is never bad as long as it is cheap.

Quote
How does a load switch even managed to output "wrong" value? Do you use it as manual priority OR-ing or something?

check schematic.

it has 5v and 3.3v input, outputs only one of them based on the switch position. looks like the switch was bad after i switched it quite some time despite was totally fine when I got it first, was switching ok. i removed the switch and the short is still there.

it somehow effected 3.3v rail which now outputs 4.6v..! i still can load and test the device but was a bummer getting it to short and get ruined like this especially that it is the only unit i had assembled.

EDIT: I checked the switch off circuit and it was good! what really happened!? looks like the power switch package got corrupted for some reason and i know i didn't short anything manually

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 721
  • Country: sc
Re: LM317 wrong output voltage
« Reply #23 on: September 08, 2024, 01:31:07 am »
So you do indeed use a load switch as OR-ing controller. I'm not exactly sure why or how it fails, but you aren't expected to use load switch that way. It only blocks one way, so if 5V is present at output it will backfeed 5V minus one diode drop into 3v3 input.

Use proper OR-ing controller, or ideal diode circuit, or load switch that use back-to-back pass FET.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 2012
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 wrong output voltage
« Reply #24 on: September 08, 2024, 05:14:00 am »
So you do indeed use a load switch as OR-ing controller. I'm not exactly sure why or how it fails, but you aren't expected to use load switch that way. It only blocks one way, so if 5V is present at output it will backfeed 5V minus one diode drop into 3v3 input.

Use proper OR-ing controller, or ideal diode circuit, or load switch that use back-to-back pass FET.

this circuit was suggested and discussed in another topic, we had different options including ideal diodes but this IC was selected. this IC had 2 inputs and 2 outputs but i shorted the outputs which is the function I needed. i activate the enable pin of the required input to activate it. it worked fine until it didn't and i have no explanation for it.

anyway, digging more into this i think I found a proper dedicated IC for the job: https://www.ti.com/product/TPS2117

here, i can just wire 5v into IN1 and 3.3v into IN2, also deliver 5v to MODE pin and a divider from 5v to PR1 (say 1k || 1k)... this will make 5v the primary supply. Now having the switch tied to that divider point (PR1 pin) and has 2 outputs: either nothing or GND. Nothing or no connect keeps the situation as it is meaning 5v while GND will activate IN2 which is 3.3v.

I guess now it is a proper solution for the required job, no safety issues right?

and by fixing lm317 issues as mentioned, it will be complete. to mitigate the tolerance of lm317 i can use 0.1% resistors similar to those used in buck regulators.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf