Problems controlling an LM317 - Page 1
Forum section: electronics / projects

author: PostaL
author_rank: Contributor
timestamp: January 29, 2013, 10:36:17 pm
content: Hello,I'm building my own power supply, obviously, inspired by Dave's uSupply. Schematic part relevant for this discussion is attached below.The problem that I have is correctly controlling the LM317 at U2: if I pull the adjust pin to the ground, the output will go to 1.25 V. So far so good.The problem comes when I connect the output of the opamp to the adjust pin. For some reason when the output of the op amp goes below 0.76V the output of the LM317 will stay at 2.06V, even if it goes to 0V (actually 0.01V, but that might be my cheap multimeter).When The opamp goes to 9V (max) the LM317 output is 10.25V, as expected.So, why doesn't the opamp sink the adjust pin correctly bellow 0.74V ? Am I missing something?Thank you!

author: Unknown
author_rank: Unknown
timestamp: January 30, 2013, 12:21:32 am
content: The LM358 is not a rail-to-rail op-amp, it can't drive the output all the way to its negative rail. See the bottom left figure on page 9 of theTI datasheet. The current it can sink below ~0.6 V is very small. Use a op-amp that can drive its output to the negative rail or provide the op-amp with a negative voltage at least 0.7 V below power supply output ground to fix this.

author: desirider
author_rank: Newbie
timestamp: January 30, 2013, 04:59:42 am
content: Alm is spot on.I run into this problem often and don't usually have a -ve supply available. For a quick and dirty solution I simply use a AA battery to generate a level below circuit ground and run the op-amp on it.

author: PostaL
author_rank: Contributor
timestamp: January 30, 2013, 08:07:02 am
content: Thank you guys so much! I've learned something new today. I'll try to search for a rail-to-rail opamp and try this again.

author: PA4TIM
author_rank: Super Contributor
timestamp: January 30, 2013, 08:39:23 am
content: You can make two grounds by using a diode in serie with the negative from the bridge. ( kathode to bridge and a small cap over it) Then connect the opamp negative supply to the anode. And the rest of the circuit ground to the anode. Now the circuit ground is 0.6 to 1V above the opamp ground. That is the same as giving the opamp a negtive supply( i have not tried it, not drawn it but it just comes to mind so correct me if I'm wrong because I am not good in making visuals in my head)

author: PostaL
author_rank: Contributor
timestamp: January 30, 2013, 08:44:13 am
content: I'm new to electronics, so don't ask me.What do you mean by bridge. The only bridge I know about in electronics it's a rectifier bridge, and I have none in my design.

author: _Steven_
author_rank: Contributor
timestamp: January 30, 2013, 11:14:26 am
content: I'm using a FET-circuit to bringing up an output voltage to 0 Volts....I'm still not at the end of testing.What PA4TIM means ..I understand...I think you best go on the net and look at a lot of schemes of power supplies. I cant give you a corret answer now because I'm still testing.I also use 2 extra diodes and a cap for acheiving the lower voltage than ground.Ps in you scheme...don't forget the 2 protection diodes. In the datasheet of the LM317 you can find examples.greetings

author: PostaL
author_rank: Contributor
timestamp: January 30, 2013, 12:00:17 pm
content: Quote from: alm on January 30, 2013, 12:21:32 amI'm really new to electronics, so you can imagine what headache I get from op-amps and datasheets...Based of what you said, and if I understood correctly, the op-amp that I need should sink more current at low voltages, and the rail-to-rail op-amp should generally be better at this.I'm looking at theLM6132datasheet's output voltage vs. sinking current (page 11, top), and as far as I can tell, it's not much better than LM358. Am I getting this wrong ?And secondly, not to hold my project on hold, is there any general purpose, popular rail-to-rail op-amp that is capable of sinking my LM317 adjust pin correctly and handle a 14V input voltage ? Because finding a proper op-amp based on the datasheet is one thing, but where I live, the electronics shops are quite badly supplied, and if I don't ask for a relatively popular part, they will not have it, and as I said, I would like to move on with my project.

author: Arrow
author_rank: Contributor
timestamp: January 30, 2013, 10:29:21 pm
content: Quote from: PostaL on January 30, 2013, 12:00:17 pmTake good notice of the minimum current. Datasheet tells me ~5mA. so you should change the 470 adjust resistor to 220-247ohm.As I understood you are new to electronics, but you can ask someone with more experience to help you build a adsjustable negative supply from a positive supply. And that supply will take care (compensate)of the op amp offset, and you don't need to search for a rail to rail Op amp.

author: PostaL
author_rank: Contributor
timestamp: January 30, 2013, 10:33:25 pm
content: The more I think and hear the more I'm inclining towards the negative power supply. I believe I will even be able to get the LM317 to 0V instead of 1.25V. I will try to search for resources on how to achieve this. I'm a noob, but I'm eager to learnThank you!

author: Unknown
author_rank: Unknown
timestamp: January 30, 2013, 11:09:42 pm
content: As long as the op-amp is able to sink enough current at -1.25 V relative to the negative output terminal, the LM317 should be able to regulate down to 0V. This is a common technique to use the LM317 below 1.25 V, and I think it's in the (National) datasheet as suggested application circuit.

author: _Steven_
author_rank: Contributor
timestamp: February 01, 2013, 12:04:14 am
content: I Use a fet circuit for acheiving that.Maybe this can give you an idea:http://www.circuitsonline.net/schakelingen/158/voedingen/lm317-labvoeding-bijgewerkte-versie.htmlOr here:note the difference for transformation wiring.http://www.uploadarchief.net/files/download/co%20labvoeding%20v2_b.pdfIn the first case you need a transformation with an extra wire (i really don't know how you call these on in English....only in dutchSucces. Ps i didn't tested these schemes but they are found at a really nice forum!

author: PostaL
author_rank: Contributor
timestamp: February 01, 2013, 12:16:44 am
content: Thank you very much! I also see a lot of other stuff that looks interesting there that I should understand and incorporate in my design.

author: free_electron
author_rank: Super Contributor
timestamp: February 01, 2013, 02:10:37 am
content: aaargh.. why won't this crap schematic die and go away ? this thing keeps popping up over and over on the web and is just ... hair-raisingly bad design on so many points.This is NOT the way to make a power supply. LM317's have their place, but not in an adjustable power supply as regulating element.besides, you have another problem. In your circuit there is a risk that the opamp drives the ADJ pin above Vout... with a dead LM317 as a result.You should not be actively driving the ADJ pin. Only be pulling it toward ground.http://www.ti.com/lit/ds/symlink/lm317.pdfpage 7. read note E and look at the current arrow on the ADJ pin. Send current into that pin and you can kill the LM317....page 12 of the same document shows how to do it right by adding an additional transistor to pull the adj pin down so there is no risk of driving current into the ADJ pin ( the base-emitter diode of the PNP blocks that )and please put the backfeed diodes ( output pushed higher than input protection ) see ntes E on page 7 and read all the other notes there too.

author: _Steven_
author_rank: Contributor
timestamp: February 01, 2013, 03:11:14 am
content: Do you mean the shemes i posted or the topic starters scheme? Advice is welcome..for sure!!! thank you!

author: PostaL
author_rank: Contributor
timestamp: February 01, 2013, 08:03:12 am
content: Quote from: _Steven_ on February 01, 2013, 03:11:14 amI'm 99% sure he talks about mineQuote from: free_electron on February 01, 2013, 02:10:37 amBasically, this is a learning project for me, not necessary a product, per say. Not yet anyway. What would you recommend as an adjustable linear regulator, other than LT3080 which costs a lot!Quote from: free_electron on February 01, 2013, 02:10:37 amI had no idea about this. Very good to know! I might be wrong, but it might also solve my sinking problem.Quote from: free_electron on February 01, 2013, 02:10:37 amI added those yesterday, as a matter of fact, plus another one on the output to protect the power supply from shortIt's clear that I have no clue what I'm doing, but I sure do learn every dayThank you all for your input so far !

author: Arrow
author_rank: Contributor
timestamp: February 01, 2013, 12:04:36 pm
content: Quote from: free_electron on February 01, 2013, 02:10:37 amBut if you use some fast schottky diode (0.1V) instead of those cheap diode in the datasheet, you have reduce the risk by 90%, right?National Semiconductor tells another story for the LM117, read page 9 protection diodehttp://www.ee.buffalo.edu/courses/elab/LM117.pdfThey also claim of internal protection. I use both protection diode everytime!!!"The discharge current depends on the value of the capacitor, the output voltage of the regulator, andthe rate of decrease of VIN. In the LM117, this discharge path is through a large junction that is able to sustain 15A surgewith no problem. This is not true of other types of positive regulators. For output capacitors of 25 ?F or less, there is noneed to use diodes. "

author: ptricks
author_rank: Frequent Contributor
timestamp: February 02, 2013, 01:38:03 pm
content: I always advise people starting out to avoid the integrated chips . The reason I do this is because parts like the LM317 are black boxes with pins that you connect stuff to without understanding of what is happening inside with the parts. You can build a much better variable supply using just resistors, capacitors and transistors or fets and gain some understanding of what is going on inside those black box chips .http://schematicblog.blogspot.com/2011/06/power-supply-dc-variable.html

author: Arrow
author_rank: Contributor
timestamp: February 02, 2013, 02:53:41 pm
content: Quote from: ptricks on February 02, 2013, 01:38:03 pmThat's why we have the datasheet, comes with schematics and all.I completely agree with you that you will get some understanding, but about "a much better supply" by using everything from a scratch, I don't know for sure. Dave used the LT3080 with line regulation < 0.001%/V LM317A has also LR of 0.001%/V. I don't know how I can achieve better LR than these. Furthermore I won't call it a black box because there are a lot more IC on the market with a lot more transistors like the 4040 but even so I'm not willing to build one of my own. So I'd don't see anything wrong with using the regulators unless someone comes with some other motives that I have overlooked.

author: ptricks
author_rank: Frequent Contributor
timestamp: February 03, 2013, 01:14:57 am
content: Quote from: Arrow on February 02, 2013, 02:53:41 pmI don't mean build every circuit from scratch but when starting out it really hurts the learning process if a beginner just knows what to connect to each pin and nothing about what goes on inside. Schematics are useful if you truly understand them and the majority of beginners I encounter do not understand them, they just know it has 3 pins to connect and when it fails they don't understand why . There is something about building the circuit yourself, having it not work, having to figure out why or having to substitute parts that don't exactly match the values given and finding out how it all works together that is hard to replicate in a tutorial or class. I tutor a lot of adults as a volunteer and it never fails that I will get someone who is baffled by things like switching a relay with a transistor, those students always want to jump right to a SSR because to them it solves all the problems,just connect a line from the micro, none of that external parts stuff even though doing so would require a heat sink and cost more.It isn't uncommon to find beginners that can't blink an led without putting a chip into the loop and that hurts them later when they need to use what they could have learned from a simple circuit when interfacing chips.One of my favorite things to do is give someone a bunch of transistors and resistors and caps, an incandescent bulb from a flashlight and a 9V battery. I tell them just a little bit about how transistors work then let them experiment with it, I let them burn out parts, burn their fingers from connecting things wrong and usually get a student that begins to understand the concept a lot better.

author: free_electron
author_rank: Super Contributor
timestamp: February 03, 2013, 08:39:15 pm
content: Quote from: Arrow on February 01, 2013, 12:04:36 pmif you put a diode between ADJ and output then you can actively drive the ADJ pin. no problem.the risk with active driving is that you succeed in injecting current into the ADJ pin ( once you pull ADJ more than 1.25 volts above Vout. ) you will turn on parasitics inside theLM317 and you can fry it.there is a reason they put a diode there when they do the slow start using the capacitor on vadj ... that cap needs to discharge at powerdown. if it can't it can kill the lm317 at poer-off timeCode:_____in ---|lm317|----+---+-- out|_____| | _|_| R1 /_\ <- this guy protects ADJ at shutdown by discharging| | | C1 into out at powerdown-------+---+| |r2 === C1| ---| |-+-|_|_gnd ASCIICAD (c) free_electron's handfully protect lm317 with opamp controlCode:d1-----|<|-----| _____ |in -+--|lm317|----+--+---------+-------- out|_____| | | | d2| R1 R3 --|<|--|gnd| | |+------- -----------+--r4--|gnd| ___ |E \|P / - |-----+B|N----< |C /|P \_+_|-- control|GNDd1 is the backfeed diode. try to yank OUT higher than In and it will conduct protecting the pass element in th lm317.D2 is a polarity reversal protection. force ea reverse voltage on the output and it will protect the entire supply ( it will fry itself ... this should be a diode that can handle some 'oompf' like a 10 ampere diode )the PNP can nly pull ADJ to ground . it cannot send current into ADJ send the emitter -base is a diode.now . there is still a mode of failure. if , for some reason, the opamp cranks the base more than 6 volts above the emitter of that transistor you will fry the transistor ( VBErmax) so, you can add an additional two diode in parallel to prevent that from happening.Code:d1-----|<|-----| _____ |in -+--|lm317|----+--+---+---------+-------- out|_____| | _|_ | | d2| R1 /_\ R3 --|<|--|gnd| | |d3 |+-------+---+ --------------+--r4--|gnd| _|_d4 ___ |E \|P /_\ / - |-----+B|N--------+---< |C /|P \_+_|-- control|GNDd4 now prevents more than 0.6 volts in reverse across the transsitor, but it allows current injection again ! so we add D3 to limit the reverse voltage between ADJ and OUT not that the diodes are tapped between transsitor and R2 ... we don;t want to fry the opamp output.this is the kind of misery you end up in when trying to use a component outside of what it was designed for.... you end up throwing so much external crap to prevent trouble.

author: Arrow
author_rank: Contributor
timestamp: February 04, 2013, 12:15:45 am
content: Quote from: ptricks on February 03, 2013, 01:14:57 amI Agree!!!

author: Arrow
author_rank: Contributor
timestamp: February 04, 2013, 12:34:50 am
content: Quote from: free_electron on February 03, 2013, 08:39:15 pmSo if you put the protection diode you don't need to use the transistor neither right???I don't like that schematic of thatdiodetransistor, because it influence the accuracy of the regulator badly.Just think of the Vbe drift and temp, all will be reflected on the output.If the output of the op amp is connected directly to the adj and the op amp raise its output voltage, this will also induce the regulator output to raise right? so why should current still run in the adj terminal if there is also two protection diode connected.And the out/adj is still 1.25V

author: AlfBaz
author_rank: Super Contributor
timestamp: February 04, 2013, 01:05:36 am
content: Quote from: Arrow on February 04, 2013, 12:34:50 amWhich is then seen in the neagtive feed back of the op amp which in turn adjust its output to compensate

author: Arrow
author_rank: Contributor
timestamp: February 04, 2013, 12:27:49 pm
content: I have to test it you know. Because it depends where you are in the transistor graphs by a specific Vbe. We are using a PNP transistor so in this schematic a delta Vb should give me the same delta Ve. But it is not so in practical, the op amp will work hard to keep up for that compensation. What I am trying to explain is that if you change the Base voltage with 50mV you should also noticed a instant change in the Emitter voltage, (theory) but you will not. On the Vbe will always be a sort of ghost voltage, that's why in some circuits you see them putting a resistor between the BE. So instead that the op amp will give a steady voltage, it will have to swing it's output over the adjust terminal which will influence the accuracy of the output voltage drastically.