Please check over my LM317 power supply design! - Page 1
Forum section: electronics / beginners

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 06:18:01 pm
content: Hi,I'm making an LM317 current-limited constant-voltage power supply (I'm a semi-beginner). I am posting the schematic (attached) in case there are any glaring errors / mistakes I may have missed! I would really appreciate your help if you do spot something.Thanks in advance!

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 06:28:23 pm
content: A few things. 1) How much power can your 100 ohm potentiometer for current control handle? That's a lot of current through a pot. There's a pretty easy way to divert current around it with a couple transistors, I'll see if I can dig up a schematic. 2) LM317's minimum load is 10mA. With no external load connected, your only load is R1. 1.25V/560R = 2.2mA, nowhere near 10mA. Decrease R1 or add a small dummy load. 3) In general, your capacitors are quite small. It will work, most likely, but you'll have better performance if you increase all of them by a factor of ten or so.The only truly important error is #2 (minimum load). When not loaded enough, LM317 tends not to regulate properly.

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 06:34:20 pm
content: 1) I was thinking of using an (expensive) 10-turn 3W wirewound pot, but would welcome other ideas!2) OK, I will add in a 100r resistor between Vout and GND. I forgot about the minimum load, but I don't want to decrease the size of R1 as it is good for my requirements as is.3) Right - thanks!Edit: Added new schematic.

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 06:53:09 pm
content: Do you have access to a negative voltage? Try this. Only 1mA goes through the pot (R2).It's a 1k pot in series with a 200 ohm resistor, if you aren't familiar with SPICE format. You could eliminate the series resistor (it sets a maximum limit - without it, the current goes up to 1.25A).The two transistors form a constant current source programmed to about 1mA (The VBEthreshold of Q2 divided by R4). That causes a voltage drop in the pot (1mA * pot resistance).The LM317 just regulates such that 1.25V appears between the output and adjust pins, so that leaves (1.25V - this drop) to appear on current sense resistor R1.

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 06:56:38 pm
content: I will be running off a transformer, which is then rectified and smoothed. If there is a transformer I can use that will give me a negative voltage winding then I would use it but I don't really know what to look for - would something like 12-0-12 work?

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 07:02:24 pm
content: Yes, it would, but you'd be wasting half the power capacity of the transformer for this little bias voltage. Try to tell before buying it whether or not it's a split-bobbin transformer. If it's split (primary winding on one half and secondary on the other, rather than concentric), you can safely add a winding just by wrapping a few turns of wire around the existing secondary, without getting anywhere near the dangerous primary. You only need two volts or so (plus diode drop), and because you only need 1mA you can rectify it with a single, little signal diode and a small capacitor. Alternately, there are a million and one ways to generate a negative voltage from a positive one (cue Paul Price).

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 07:07:10 pm
content: It might be easier to generate a negative voltage from the positive Vin, so I don't need to bother rectifying and smoothing another input. How would you go about generating a negative voltage?

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 07:11:38 pm
content: Apply a square wave to this circuit. You'll have to experiment with component values a bit, and I'll leave it to you to figure out where to get the square wave from (hint: 555 timer). Dave did a video on this recently.Also, I'm playing around with that current control circuit a bit; there's no reason such a thing wouldneeda negative rail, it's just that that particular one does. I'll see if I can get rid of that requirement.

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 07:22:31 pm
content: Can you afford a little bit more voltage loss? This version doesn't require as much voltage overhead, so you can get your "negative voltage" with a little trickery: put two diodes in the return path so that theoutputis shiftedup1.4V or so. That way, the original "ground" is 1.4V less than your new ground. For everything that comes after this part, consider the new low output to be ground and forget about the original one.Don't let the way I drew it confuse you - R3's not part of the circuit, it's just a load to test it with. The two wires coming out to the right are the output.In theory, Q2 and Q3 should be matched in gain, threshold and temperature; in practice, this isn't a precision circuit, just make sure they're the same part number and you'll be fine.

author: Paul Price
author_rank: Super Contributor
timestamp: June 18, 2013, 07:27:08 pm
content: You can get any positive power supply to generate a negative bias voltage with a 555 timer. See attached. It generates about minus two volts.Unlike some other suggestion offered, this circuit does not require to match some components for gain nor limit the output voltage range by a few volts thus giving you a greater range of output voltages. It is slightly more complicated but might offer better performance.

author: c4757p
author_rank: Super Contributor
timestamp: June 18, 2013, 07:33:38 pm
content: Quote from: Paul Price on June 18, 2013, 07:27:08 pmHey, I'm just building on the existing circuit. I assumed he was fine with the 1.25V minimum output since that's what the original circuit did.Some people(*cough*me) might call that a bit over-complicated. You might as well just pull out the power transistors and op amps at that point - the reason you'd use an LM317 is that while a bit limited, it's dead simple.

author: Paul Price
author_rank: Super Contributor
timestamp: June 18, 2013, 07:36:00 pm
content: As I said,It is slightly more complicated but might offer better performance, plus the supply is also a standard LM317 constant voltage supply whose output extends down to near zero volts.As for your original design, it is simple but it simply has quite a few problems.Firstly I like the idea of using a diode across the LM317 to protect.I do not like the idea of C4 as it would dump a large current into a circuit when first connected, likely damaging some component.R2 would prevent the supply working as a constant current supply, since it is shunting the output current and so your design as it is no longer a constant current supply.R2 would also require you to continually juggle back and forth between two potentiometers to adj voltage and current, if it at all was possible to get a constant current out of your supply as it is drawn.Thirdly you have the issue of transient response of two LM317's, they have a tendency to overshoot and undershoot the output voltage set with a quick change of load and this would result in voltage as well as current surges that could damage whatever you are working on.Forthly, the circuit is likely to oscillate rather than regulate at some output load, current and voltage settings, because of the the very slow transient response of the two LM317 current and voltage regulated circuits cascaded and competing to control the output.Also, the effect of two LM317's in series does seriously subtracts you from achieving the full output voltage range potential of your power supply.Otherwise from that I congratulate you on taking the initiative to create your very own power supply design!

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 08:14:36 pm
content: QuoteShould I get rid of it then? It is only there to reduce ripple / improve transient response.QuoteWhat do you suggest? Should I get rid of it and decrease the value of R1 to meet the minimum load requirement?QuoteIs there any way to remedy that? I'm thinking tantalum caps...QuoteYou assumed right!

author: Paul Price
author_rank: Super Contributor
timestamp: June 18, 2013, 08:22:59 pm
content: Tantalum caps would not help.The problem is basically the design, you could try mine or else creating something different on your own!Firstly your design will not be a constant current power supply at all with any load resistor on the output. This means if you eliminate R1 and R2 and have a circuit with no R1 and no R2, without these two components your supply will always be set to the maximum output voltage and not function at all.If you eliminate the output load resistor you still have current surges from the output capacitor, the larger the capacitor, the slower the transient response and the greater the surge.If you eliminate the output capacitor the circuit will likely oscillate.

author: microbug
author_rank: Frequent Contributor
timestamp: June 18, 2013, 08:26:01 pm
content: What is yours? Do you mean the schematic you already posted or something else?Edit: If I drop the load resistor and lower the cap to 47uf would it then be OK, if not great?

author: Paul Price
author_rank: Super Contributor
timestamp: June 18, 2013, 08:27:10 pm
content: The one I posted, but there are many many others out there in electron land.

author: Paul Price
author_rank: Super Contributor
timestamp: June 18, 2013, 08:29:18 pm
content: Sorry, I don't think so, for the reasons I list. Perhaps you can take a look or breadboard mine to get some ideas on how the individual components form a constant current supply/constant voltage supply that will work.I would add that you can completely eliminate the 555 circuit and connect your adj. pot directly to ground if you don't mind the output voltage limit that would prevent any constant current power supply to regulate current at voltages < 1.2 volts.For a constant current power supply to work it must have "full voltage compliance."Hint:Your circuit has implemented it's two functions backwards. The constant voltage source must come before the constant current limiting stage.The tail must not wag the dog.

author: westfw
author_rank: Super Contributor
timestamp: June 19, 2013, 03:03:25 am
content: QuoteThat's not the way it's done in the typical 317 "app-note"...Obviously it's a current-limiter rather than a "constant current" supply, though.

author: c4757p
author_rank: Super Contributor
timestamp: June 19, 2013, 03:09:32 am
content: Quote from: Paul Price on June 18, 2013, 08:29:18 pmOf all the deficiencies of all the circuits presented here, I'd say that's the worst. So you lose the limit if the output is shorted?QuoteEvery LM317 CC/CV circuit I have ever seen places the current limit before the voltage regulator, with the exception of ones like yours that combine it into a single stage.

author: IanB
author_rank: Super Contributor
timestamp: June 19, 2013, 03:20:18 am
content: Quote from: Paul Price on June 18, 2013, 08:29:18 pmThat's contrary to every other piece of advice out there in electron land.

author: IanB
author_rank: Super Contributor
timestamp: June 19, 2013, 03:26:46 am
content: Quote from: westfw on June 19, 2013, 03:03:25 amIn reality there is no difference between these two concepts.Every "constant current" supply is actually a current limited supply (you can make it supply less current by putting a sufficiently high resistance across the output).Every "constant voltage" supply is actually a voltage limited supply (you can make it supply less voltage by putting a sufficiently low resistance across the output).There tends to be a breakdown of the English language when people talk about these things.You can regulate the output voltage to be no more than the maximum, but sometimes less.You can regulate the current to be no more than the maximum, but sometimes less.A practically realizable constant voltage supply does not exist.A practically realizable constant current supply does not exist.

author: microbug
author_rank: Frequent Contributor
timestamp: June 19, 2013, 06:33:54 am
content: OK, I've had a look around - would the first designherework?

author: mariush
author_rank: Super Contributor
timestamp: June 19, 2013, 06:55:31 am
content: That circuit is from the LM117/LM337 datasheets (one of them, since the same IC is made by various companies) :http://www.ee.buffalo.edu/courses/elab/LM117.pdfIt's on page 18. There are other good example of circuits and the extra explanations might be helpful.Yes, I don't see why it wouldn't work.Though you might want to change some components with more easy to find ones, maybe 2n5884 (http://uk.farnell.com/on-semiconductor/2n5884g/transistor-pnp-to-3/dp/9556044) instead of MJ4502 and some newer opamps (though the lm301 is a very generic one, probably anything else would do)

author: Paul Price
author_rank: Super Contributor
timestamp: June 19, 2013, 10:08:36 am
content: WestFw and IanB, We might just be facing a wording, semantics problem here, and your knowledge about electronics is immense, butI am very certain you are mistaken here with what you both are saying, maybe sometimes if only by your way of explanationI hope with 10000 words or less I can clarify the situation. I don't want constant current v. current limiting to become a "What came first, the chicken or the egg?" argument!A constant voltage source comes first and sets the nominal, non-current limited output voltage, and the current limiting or constant current circuit stage then monitors the current being drawn out of the constant voltage source and adj's voltage output down to achieve the constant current mode of operation.We can say that the constant current stagefeeds backto control the constant voltage stage to make this happen.You might notice, in my circuit that the constant currentsensingand control is the in of the constant voltage output stage, but that it feeds back to control the LM317 voltage output to achieve constant current operation.IanB states also in reply,"That's contrary to every other piece of advice out there in electron land." is also mistaken in the same way as WestFw.You might notice, for example, in my circuit (which is in fact a commonly seen implementation of many other circuits published) that the constant currentsensingand control is in the constant voltage output stage, but that it feeds back to control the LM317 voltage output to achieve constant current operation.If you try to do it the opposite way, the constant voltage stage will never work to provide a constant current because it is always trying (at the output of your supply) to provide a constant voltage.i repeat,The constant voltage stage most be controlled by the constant current stagebut part of its circuit senses the current in the constant voltage output state, and there is usually some way of feeding back or controlling the constant voltage stage to correct the current to the desired set value.So, is it a just a problem of semantics, that we are both trying to say the overall method of operation is to use a part of the whole circuit that to sense the output current used by the load to and control the constant voltage output stage circuit to achieve voltage compliance to maintain the output current of a power supply?------------------------------------Microbug: your question,"OK, I've had a look around - would the first design here work?"The answer is yes, it would, but it is not a very good circuit.This circuit would have bad transient response, and this causes sudden load changes (such as happens when you first connect your power supply to a circuit and a high current is drawn) to cause your power supply to overshoot the correct output voltage and the excess voltage could be enough to damage your test circuit you are working with.The bottom line is that the LM317 is a very poor choice to be somehow "jerry-rigged" to create a switching power supply. The datasheet shows how it can be done, but that is misleading. The datasheet writer is just trying to sell you on the idea to use this part, to sell you their part, so they present this schematic to try to get you to use their part in an awkward way.I think the idea of trying my circuit is better because it is simpler, it is a linear not a switching power supply, and their exists some range of linear constant currentcontrol.Good transient response is an important characteristic of a power supply in that it allows the power supply to act well with sudden load changes.IanB: We are getting into a weird battle of semantics here, but as you say it, you are wrong because you are misleading Microbug in telling him that:"A practically realizable constant voltage supply does not exist.""A practically realizable constant current supply does not exist."They do exist and are being sold and used everyday. You are correct to say there is no such thing as a "constant voltage" or a "constant current" supply if you think such a thing can work perfect in any imaginable load condition.Every constant voltage or constant current supply has its limitations set by the ratings of a supply parts, the maximum current that is available to be delivered safely and without overheating, there is always a limit to the maximum perfection of output regulation that can be achieved, etc.Butwhen you use the word "practical" here, it is misleading, "practical circuits" do exist, and can be quite tiny and work well.Ideal or theoretical circuits often do not.If you used the work "Ideal" or "theoretical" (instead of "practical", when you try to give the meaning that a perfect power supply, operating perfect in every possible load condition does not exist), then you could have explained the problem of "theoretical" versus "real world" practical better.---------------------------------IanB: in another replyyou are incorrect and confusing when you say"In reality there is no difference between these two concepts."in trying to clarify if there is really any difference between constant current and constant voltage supplies.A constant current supply, within its range of voltage compliance, which is the limits of itsconstant current operation, delivers a constant current that is set by a control.A constant current supply has many applications, for instance, it is a circuit device and tool that allows such allows smooth voltage ramp generation with a capacitor, it can also set the limit of current delivered by a power supply, and a constant current power supply is often required for battery charging methods that safely charge batteries.A current limited supply may smoothly or abruptly switch to a current limited condition of operation, and thecurrent limit may not be adjustable by the user,but just be set and limit the output flow of current to a safe value that would not damage the power power supply.Current limiting is a way of talking about how a power supply protects itself, rather than the circuit it is attached to.which may not be designed to be constant,just limit the current to a safe value to protect the supply or the circuit it is attached to.An example where current limiting is used but a constant current is not delivered is when "Foldback Current Limiting" is used. In this case the current is first limited to a higher value, then as the load is increased, the power supply voltage drops with a fast-sloped characteristic limiting curve to limit current at a lower level prevent damage to the circuit involved and to the power supply supplying the current. Any 555 timer, 7805 or LM317 regulator have current limiting, but the actual current is neither constant and varies with temperature nor is the current limit user adjustable.----------------------Finally, I would point out thehype adviceyou find in some datasheets, theyoften try to get you to use as many of the devices shown as possible in a given application so as to maximize sales of the device.In many cases, the optimal circuit solution to a circuit application or problem shows only one the answer, "just use more and more of these excellent xxx devices to do it"Not all application notes or datasheets do this, and studying them is probably one of the most important ways to learn about electronics,but remember this, the purpose of a datasheet is meant to be just about the part it is describing, it is not beingintellectually honesthelping you in finding better ways to solve your circuit problem.I wish to thank everyone for their replies, and please excuse me for letting bold print get out of control somewhere.I also am very grateful for your replies that give me food for thought (even while I am having lunch) and a giving me a chance to clarify things in electron land. Because I have only my lunch hour to reply, I might have created a poorly edited words-in-excess reply that attempts to say what I really wanted to say here.

author: c4757p
author_rank: Super Contributor
timestamp: June 19, 2013, 11:54:55 am
content: Quote from: Paul Price on June 19, 2013, 10:08:36 amIf the stages are going to be separate, the constantcurrentmust come first, because in nearly every practical power supply the usual application is CV mode and that is what must regulate most closely. You can combine the two stages into one, as you have done, in which casethe two are one. If you put them in series but have them sense the same output, they arestillone stage with two pass elements; they're sensing off the same point. I can't think of a single practical reason to use a two-stage solution with the current senselastand sacrifice voltage regulation accuracy.QuoteYour circuit does not have two stages, it modifies the LM317 to sense both voltage and current. There are two control loops running inparallelcontrolling the same pass element.QuoteRestricting the maximum voltage into it is one way of accomplishing this.Quote"Jury rig". Sorry, pet peeve. Jerry's actually a very good engineer and never rigs anything.QuoteJust because it has happened doesn't mean this is an example of it happening.QuoteSimpler?QuoteEvery power supply has certain specifications, you don't just shoot for "as much transient response as possible". If the OP is fine with the transient response of the LM317 circuit, it's a fallacy to say the circuit is garbage because of the transient response.Quote"Ideal" was implied in not otherwise qualifying "constant voltage" and "constant current", the same way that a "car" is not assumed to be a "clown car" unless otherwise stated. "Practically realizable" does not mean "practical".QuoteOtherwise unqualified, "current limit" implied "constant current". There are variations, like a foldback limit, but none was specified. As you have defined the two, they are the same. Read your own definitions again.QuoteAgain, and as you point out yourself, just because it has happened doesn't mean it is happening here. The two-LM317 CC/CV supply does not work nearly as poorly as you think, and no, it doesn't oscillate. In fact, it works quite wellfor its purpose. Nobody here is trying to make a lab-grade power supply, it's just a quick-and-simple thing with intentionally low specifications. It still works well within those.

author: niflheimer
author_rank: Contributor
timestamp: June 19, 2013, 01:32:24 pm
content: With the right filtering caps it actually performs on par with some cheap bench supplies.I have the same two stage supply working at this moment , with a power NPN across the potentiometer for current control. While you lose about .7V output ( I suppose because of the voltage drop in the diode stage of the transistor ) , the result is smooth and the potentiometer (or in my case a trim pot , was too lazy to drive to the store for another wirewound) is not heating up.I'v actually been surprised with the this tiny supply. Sure , the current regulation is less than stellar ( it will vary by a few mA - typically 2-3 mA at full load) , and the voltage will drop while in current limit , the voltage supply is quite stable.My fluke 87 is showing a constant 10.000 if set to 10v with a light load , and it will vary by a few milivolts on a higher load.

author: microbug
author_rank: Frequent Contributor
timestamp: June 19, 2013, 03:17:10 pm
content: OK, having read through the recent posts I have decided to use Paul Price's design. Thanks for your advice!Edit: On Paul Price's design it says to use a 5V 1W zener diode, but I can only find 5v1. Would a 5.1v diode be OK instead of a 5v one?

author: Paul Price
author_rank: Super Contributor
timestamp: June 20, 2013, 12:17:09 am
content: Yes, any 1 watt rated 5V to 8.2V zener will do nicely.C4757p: You say I still end up equating constant current with current limiting...I don't think so.For instance a 555 timer, a 7805 regulator and the LM317 in this case all have current limiting. The current limiting is not fixed to an exact nor linear current limit value and current limiting varies without user control.From my experience what I would call a constant current supply, when we are talking about lab power supply equipment, is usually firstly a constant voltage regulated power supply that switches over to constant current, not current-limited operation.The word constant means just that, it doesn't vary over the output voltage compliance range of the power supply...current limiting does not require that the current remainsconstant.

author: westfw
author_rank: Super Contributor
timestamp: June 20, 2013, 05:06:24 am
content: QuoteI think perhaps so.Although, I think it's also true that the usual two-317 CCCV supply does do the CC first, and it gets away with it because the current consumed by the voltage regulation stage is small and nearly constant; it doesn't matter whether you regulate the input current (as the circuit does) or the output current (as you'd really want to do.)

author: Paul Price
author_rank: Super Contributor
timestamp: June 20, 2013, 11:37:42 am
content: Westfw: says,"it doesn't really matter..."Yes it does, that's what this OP's circuit inquiry is all about, getting a circuit to work to providing a constant current.

author: ali6x944
author_rank: Frequent Contributor
timestamp: December 27, 2016, 11:17:08 am
content: http://www.onsemi.com/pub_link/Collateral/LM317-D.PDFin page 8 see there is a circuit there, the circuit is simple and easy but it uses FETs and negative voltages which is quit annoying, but u can still use a simple MC34063 in a inverter config can give u negative voltages, but the FETs ..... well i still haven't find a way around them....

author: SeanB
author_rank: Super Contributor
timestamp: December 27, 2016, 12:17:36 pm
content: FET's are easy to get rid of, just use a small constant current source driven from the negative rail, and use that. A simple red LED, run at around 1mA, to drive the bases of 2 single NPN transistors set up as current sources. Emitter resistors of around 10R will give roughly 9mA of constant current to emulate those 2 constant current sources. Use a common 100V rated signal transistor in both locations, and thermally couple them as well. 100V transistor only needed for the first, but easier to match, and the current sources only need to be able to sink the regulator quiescent current with zero load.Your negative supply though has to be able to sink around 30mA at -5V, but does not need really good regulation, as it has those clamping diodes providing a reference. Makes the supply design easier.

author: Audioguru
author_rank: Super Contributor
timestamp: December 27, 2016, 06:22:52 pm
content: A lot of replies for such a simple LM317 circuit.You never said the input voltage or the maximum output voltage you want. Your first circuit with the wrong 560 ohms and 10k pot would have a max output of about 23.6V if the input is at least 26V.Then the 100 ohm output resistor will fry with 5.6W. Reducing the values of the 560 ohm resistor and pot would eliminate the 100 ohm resistor and its heat.

author: Zero999
author_rank: Super Contributor
timestamp: December 28, 2016, 12:23:58 am
content: The main problem with cascading an LM317 constant current source and an LM317 voltage regulator is, the drop out voltage will be huge. The LM317 needs at least 2.5V to regulate properly (3V is ideal). The current source needs an additional 1.25V of headroom on top of the 2.5V, giving 3.75V. The total drop-out voltage, at the maximum current setting will be 6.25V.

author: ZeTeX
author_rank: Frequent Contributor
timestamp: December 28, 2016, 01:48:37 am
content: Quote from: c4757p on June 18, 2013, 07:22:31 pmJust so you know, you have LT317 in LTspice.

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: December 28, 2016, 02:29:07 am
content: Has anyone here yet mentioned that the schematic of the OP has output ground NOT connected to GND? As it is the output voltage will be at constant 1.25Vdc. I just thought I'd throw that in...

author: not1xor1
author_rank: Frequent Contributor
timestamp: December 28, 2016, 10:30:23 am
content: Quote from: Paul Price on June 18, 2013, 07:27:08 pmif you have a transformer there is no need to add another IC and more high frequency noise, you just need a couple of diodes and a couple of capactitors to get a further negative (or positive rail)in the example below you can see how it is easy to get both double Vout and -Vout when you need just few mAs or few tenths of mA...you need just to add a resistor and a zener diode to the negative rail to adjust the voltage to the needed value