LM317 wrong output voltage - Page 1
Forum section: electronics / beginners

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 08:32:25 pm
content: 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.htmlwhich 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 = 10kR2 = 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

author: wraper
author_rank: Unknown
timestamp: September 07, 2024, 08:38:36 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 08:49:48 pm
content: Quote from: wraper on September 07, 2024, 08:38:36 pmbut 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.

author: IanB
author_rank: Super Contributor
timestamp: September 07, 2024, 09:01:00 pm
content: Quote from: VEGETA on September 07, 2024, 08:49:48 pmR1 is supposed to be about 240 Ω or less. Recommended 120 Ω.QuoteIt'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.

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 07, 2024, 09:09:02 pm
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: September 07, 2024, 09:14:46 pm
content: 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.

author: pqass
author_rank: Super Contributor
timestamp: September 07, 2024, 09:18:08 pm
content: R11 is typically from 220R to 470R (Rtopin formula below).R12 or R13 should be changed accordingly (Rbottomin 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; see200K||9K1 is close)

author: Benta
author_rank: Super Contributor
timestamp: September 07, 2024, 09:22:24 pm
content: Quote from: pqass on September 07, 2024, 09:18:08 pmSource, please? The data sheet says something else.

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 09:27:28 pm
content: Quoteyes i noticed most circuits do this but still datasheet showed an example of using larger values.Quotethis 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.021vand 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.

author: pqass
author_rank: Super Contributor
timestamp: September 07, 2024, 09:27:55 pm
content: Quote from: Benta on September 07, 2024, 09:22:24 pmMost of the examples in thedatasheet.

author: Benta
author_rank: Super Contributor
timestamp: September 07, 2024, 10:01:14 pm
content: Quote from: pqass on September 07, 2024, 09:27:55 pmYes, I know. And it willmostlywork 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.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 07, 2024, 10:19:12 pm
content: Quote from: VEGETA on September 07, 2024, 09:27:28 pmNo! 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.

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 10:23:23 pm
content: Quote from: Benta on September 07, 2024, 10:01:14 pmmaybe 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\12mAtaking the idea of parallel resistor feedback:R top = 120 ohmsfor 12v: R bottom = 1032 ohms ~ 1k ohm + 33ohmsfor 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.061vV = 1.25 (1 + 744.8312/120) + 0.00005*744.8312 = 9.008 + 0.037 = 9.045v^ which seems perfect, tiny headroom is good.QuoteI 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.

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 07, 2024, 10:48:46 pm
content: RB= 1k5; RT= 240R || RT2= 620R. VO= 9V if switch broken; might be on the lower side of IL(min), otherwise use 750R, 120R, 300RRT= 150R; RB= 1k3 || RB2= 3k3. VO= 12V if switch broken

author: pqass
author_rank: Super Contributor
timestamp: September 07, 2024, 10:51:02 pm
content: Quote from: Benta on September 07, 2024, 10:01:14 pmYou'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 Rbottomvalues over some Voutand Rtopvalues.Code:Vout30241512953.3VRtop470470470470470470470RRbottom1081085545170404229141410770.8RRsum11280902456404512338418801240.8RIsum2.6602.6602.6602.6602.6602.6602.660mARtop390390390390390390390RRbottom897070984290335424181170639.6RRsum9360748846803744280815601029.6RIsum3.2053.2053.2053.2053.2053.2053.205mARtop330330330330330330330RRbottom75906006363028382046990541.2RRsum792063363960316823761320871.2RIsum3.7883.7883.7883.7883.7883.7883.788mARtop220220220220220220220RRbottom50604004242018921364660360.8RRsum52804224264021121584880580.8RIsum5.6825.6825.6825.6825.6825.6825.682mARtop180180180180180180180RRbottom41403276198015481116540295.2RRsum43203456216017281296720475.2RIsum6.9446.9446.9446.9446.9446.9446.944mARtop120120120120120120120RRbottom2760218413201032744360196.8RRsum2880230414401152864480316.8RIsum10.41710.41710.41710.41710.41710.41710.417mA

author: floobydust
author_rank: Super Contributor
timestamp: September 07, 2024, 11:03:58 pm
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: September 07, 2024, 11:10:46 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 11:17:42 pm
content: Quote from: floobydust on September 07, 2024, 11:03:58 pmi 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.QuoteI have added some calculations based on R_top being 120 ohms, please check them.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 07, 2024, 11:22:35 pm
content: Quote from: VEGETA on September 07, 2024, 11:17:42 pmUse a breadboard and verify them yourself. A bit of hands-on experience helps with ... experience, understanding, and self esteem and self reliance.

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 11:31:01 pm
content: Quote from: Doctorandus_P on September 07, 2024, 11:22:35 pmtoo 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 ofthese switchesused 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.

author: Benta
author_rank: Super Contributor
timestamp: September 07, 2024, 11:39:41 pm
content: @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 VVout2 = 8.64...9.36 VAs 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.

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 07, 2024, 11:45:06 pm
content: How does a load switch even managed to output "wrong" value? Do you use it as manual priority OR-ing or something?

author: VEGETA
author_rank: Super Contributor
timestamp: September 07, 2024, 11:54:44 pm
content: Quote from: Benta on September 07, 2024, 11:39:41 pmnice, so my values should be ok too. going precise is never bad as long as it is cheap.Quotecheck 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

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 08, 2024, 01:31:07 am
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: September 08, 2024, 05:14:00 am
content: Quote from: ArdWar on September 08, 2024, 01:31:07 amthis 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/TPS2117here, 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.

author: VEGETA
author_rank: Super Contributor
timestamp: September 08, 2024, 09:41:25 am
content: Quote from: ArdWar on September 07, 2024, 10:48:46 pmso you suggest in the first line to switch the top resistor in parallel instead of bottom one. values of 750 ohms for bottom, 120 ohms for top when 9v and in parallel with 324 ohm when 12v seem fine and uses less resistors than my previous suggestion. very low values ensure Iadj won't do much.plus it will have nice load current even without using external load... 1.25/87ohm = about 14.3 mA, 1.25/120 = 10.4 mA. adding another 750ohm resistor as a constant load will give 12v/750R = 16 mA or 9v/750R = 12 mA. both will be more than enough to make it stable (total will be 30.3 mA for 12v, 22.4mA for 9v).will see today if i have such low values in my storage to test them.and sorting out the power selector ic with tps2117 would seem to fix all things.EDIT: I didn't have enough time tonight, so I will try later. On another side of the story, I tested the buck regulators and they performed perfectly fine. about 5mV total p-p ripple figure when fully loaded without noise or spikes or bad transients... can't really complain!

author: Zero999
author_rank: Super Contributor
timestamp: September 09, 2024, 01:09:13 pm
content: Quote from: Benta on September 07, 2024, 09:14:46 pmThe LM317 will work with higher resistor values for R1, but one has to beware of the minium load current and IADJalso starts to become significant for higher values of R2, which are also required.

author: VEGETA
author_rank: Super Contributor
timestamp: September 09, 2024, 06:54:13 pm
content: Quote from: Zero999 on September 09, 2024, 01:09:13 pmusing higher value resistors is the cause of what i had, will try to use smaller value when i have time and report back.you are correct, it can work with high value resistors but you need to compensate for Iadj... this is what i learned from this thread despite using lm317 for many years.

author: VEGETA
author_rank: Super Contributor
timestamp: September 09, 2024, 09:23:03 pm
content: I tried lifting the leg of the smt lm317 in that very tight space on the board but failed and broke the leg.however, i got another through hole lm317t from ST which i got years ago, soldered it in prototype board as seen in attachments... and it worked exactly as intended.top resistor = 120 ohmsbottom resistor = 748 ohms (combined 680 + 68)parallel switchable top resistor = 300 ohms (combined 150 + 150)of course they are not precisely that but close enough to demonstrate the idea.just to be sure I soldered a fixed load (around 220 to 280 ohms, don't remember) just to ensure enough load.i got 12v and 9v (with tolerances) as expected.so now I can consider this solved.next step is to build another prototype with this corrected circuit + the power switching circuit between 5v and 3.3v based on TPS2117.NOTE: I attached 2 pictures of the product prototype I was talking about, you can see the smt lm317 there.

author: Zero999
author_rank: Super Contributor
timestamp: September 10, 2024, 07:55:18 am
content: I'm glad you've got it working.If you don't need the full 1.5A, then there's the LM317L (100mA, TO-92 available) and LM317M (500mA, SMT only).

author: VEGETA
author_rank: Super Contributor
timestamp: September 10, 2024, 10:44:28 am
content: Quote from: Zero999 on September 10, 2024, 07:55:18 amyes thanks to those who helped. It really ticks me off that I didn't know this small info about lm317 despite working with it for years.as for needed amps it won't be much since the only usage it will get is to deliver 9v or 12v to some TVs when using RGB SCART signal since it is a power supply for retro console. so this 9v or 12v when the target tv (crt tv) gets it then it knows you hooked an RGB SCART cable and will automatically switch to it (mostly in Europe only). I didn't measure this but certainly won't be anything much of couple of milliamps or tens of milliamps at most.this is the part I got:https://www.lcsc.com/product-detail/Linear-Voltage-Regulators-LDO_Texas-Instruments-LM317DCYR_C51466.htmlit is sot-223 and as i said won't have any significant load._______on the other hand, I made a new load switch circuit in the attachments.it uses tps2117 with a switch, TI support told me it should work without a problem but i asked about "priority mode" vs "manual mode" and he said he will get back to me later. won't affect circuit operation though.