[WorkInProgress] LM324/358 based, 0-20V, 0-1A, cc/cv PSU - Page 1
Forum section: electronics / projects

author: debininja
author_rank: Contributor
timestamp: June 22, 2017, 06:23:44 pm
content: Myused a LM723 with foldback current limiting, which is not very accurate. It's a good "beginner PSU" because the voltage output is pretty stable. The current limit, however, drifts around by a large margin, depending on ambient temperature, heatsink temperature, and so on. By no means is the LM723 a "lab grade PSU." It's time to move on to something better...======================================================As a first time op-amp based PSU builder, I'm keeping my goals modest.Target specifications:* Input voltage max: 25V* Output voltage: 20V max* Output current: 1A max @ 20V* Output power: 20W max* Must use commonly found hobbyist parts. No using fancy shmancy ICs.======================================================EDIT: Settled for Klein's simulated schematic. Transferring over to KiCAD.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 23, 2017, 09:19:50 am
content: It is a good idea to limit the voltage and current for a first try.The current sensing would not work with an LM358. It violates the common mode range, as it will not work near its positive supply. The regulator is using a kind of emitter follower output stage - so it would need a really fast current limiting or a secondary current limit (the LM395 should provide that). The LM358 is already on the slow side for this.The original circuit also used the compensation pins to speed up the reaction of the current limit. So it is a little tricky to replace the upper OP in this circuit.The TIP120 is a little unusual choice. TO220 transistors are not that well suited for high power. Two TIP140 or two 2N3055 (or TIP3055) and a BD139 would be the more obvious choice. A transistor usually fails with a short - so if one of them fails the whole circuit would fail. 40 W for a tip 120 is also rather optimistic.I don't think the part around Q4 would work well.The reference part for the voltage should be a little different. It is Ok to replace the refs with more modern ones. For the voltage I would consider the LM329. Usually the TL431 and like work best with just a little more than there minimum current, so more like 1-1.5 mA.

author: debininja
author_rank: Contributor
timestamp: June 23, 2017, 05:56:26 pm
content: Damn, that's a bummer. I was hoping there was a decent schematic for a cc/cv opamp based PSU using commonly found opamps and discrete components.Seems there's very few designs using common opamps.Even this from the 1970s uses the LM301.Maybe I should start with the basics as a newcomer. In other words, build a constant current source (can be easily done with a LM358 + mosfet + stable voltage reference + potentiometer), and then add in another opamp for the constant voltage source.What do you think? Sounds like a good plan?

author: edavid
author_rank: Super Contributor
timestamp: June 23, 2017, 06:07:27 pm
content: Quote from: debininja on June 22, 2017, 06:23:44 pmYou can get an eBay power supply for $36. Does that change the equation?http://www.ebay.com/itm/3-1-2-LED-Digital-30V-3A-Adjustable-Variable-DC-Power-Supply-Regulated-Lab-Cable-/162551854197

author: debininja
author_rank: Contributor
timestamp: June 23, 2017, 06:35:05 pm
content: I'd much rather buy a used $70 GPC-3020 linear PSU than some no-name garbage, switching PSU with horrible decoupling caps and the bare minimal, cheapest components from China that explodes (seriously, some guy's PSU caught fire, and it was one of those models). Even if a PSU uses analog meters, I don't find it a hassle. Better safe than sorry.I actually made my first SMPS a week ago, after taking almost a month. It was a challenging project for sure, my very first SMPS and very first serious project. It's not the most efficient thing, nor is it pretty, but it does work and meets all my set goals (FBT, secondary isolated via optocoupler, 5V regulated output, 1A continuous current).Anyways, it's a learning experience for me with opamps. I'm not afraid to make mistakes, so long as they are calculated risks. Building a cc/cv is a big challenge, but I'm sure I can get it done and learn a lot in the process.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 23, 2017, 07:46:52 pm
content: It is possible to build a lab supply based on standard OPs. The LM358 might not be the best choice due to its low maximum supply voltage and not so good speed. However it works - I also have an old supply base on the LM324 (quad equivalent of LM358).There are mainly two options:1) The classical floating regulator, with a second transformer to power the regulator circuit.This one is flexible and relatively easy to use with digital control / display as the extra transformer can also power the display / control circuit.2) The classical emitter follower circuit, similar to the circuit shown here. Usually one has the shunt at the low side. It is usually limited to something like 20-30 V due to the OPs supply and the better versions need a negative supply too. Here the output capacitor can be smaller, but current regulations tends to be slower in response. For a low end supply up to about 20 V this circuit is also a little easier, and easier to understand.There is a parallel thread on a supply of the 1st type:https://www.eevblog.com/forum/projects/help-with-psu-design/The shown circuit has the basic features, but could be simplified in some areas.

author: debininja
author_rank: Contributor
timestamp: June 23, 2017, 08:09:04 pm
content: Perfect, I'll go with the first type using two transformers.Although, it doesn't have to be a separate transformer, right?An auxillary winding on the same xfmr would be electrically isolated, so it should work just as well, correct?(And regarding that circuit you linked. I noticed there are output caps on the output. Seems like a terrible idea to do so for a cc/cv PSU, as those capacitors can output dozens or hundreds of times the set current once a load is placed, being limited by the ESR and load resistance).If you have a schematic for the LM324 PSU that you created, I'd appreciate it if you could upload it here.

author: edavid
author_rank: Super Contributor
timestamp: June 23, 2017, 08:16:53 pm
content: Quote from: debininja on June 23, 2017, 06:35:05 pmThe eBay supply I cited is a linear supply. I don't see why it would be any more likely to catch fire than a home-made one.

author: debininja
author_rank: Contributor
timestamp: June 23, 2017, 08:33:39 pm
content: Sure it's "linear," but it has a SMPS output stage with questionable filtering capabilities and high ripple (even though they claim it's 10mV, I highly doubt it--100mV,maybe).It weighs ~3 pounds.The linear series pass stage will attenuate the noise, sure, but it wont be much with the amount of puny little capacitors and inductors they can fit in something that size. Instead of paying $36 on that sort of SMPS garbage, I'd much rather pay double for the GPC-3020.The GPC-3020 available on eBay for $60-80, 30V, 2A, parallelable or series-able (to 60V, 2A), andweigh 18 pounds. Look at itsimpressive datasheetand you have a clear winner in terms of what the better quality PSU is.I'm aware it's economically unwise to create a DIY power supply, because, well, it won't quite meet the performance of quality, factory made devices. With $20/hr wages, you can buy a quality PSU for 3-4 hours of work. Besides, building an op-amp based PSU is a good learning experience, and that's my main goal--experience and knowledge.EDIT: Found a post with a schematic for a lab cc/cv PSU using very common parts:https://www.eevblog.com/forum/testgear/are-cheap-ebay-power-supply-worth-the-money/msg248693/#msg248693Attached schematic for those curious.EDIT2: edavid, those are all SMPS based cc/cv lab PSUs you're linkingThere's nothing wrong with them, but what is a dead giveaway is the cost. A SMPS based lab PSU will need a lot of proper filtering for decent noise levels. At $36, I know for a fact that I can't find anything decent when buying those, new. A 10kuF, major branded capacitor costs $5 (Mouser), some TO-247 power transistors ($3 each), opamps, precision resistors, etc etc, it'll come out to at least $30 for the base parts if lucky. Much better off buying used linear PSUs for long term guarantee that the thing wont expode or pop the capacitors.

author: edavid
author_rank: Super Contributor
timestamp: June 23, 2017, 09:41:07 pm
content: Quote from: debininja on June 23, 2017, 08:33:39 pmHmm, how about this one:http://www.ebay.com/itm/0-30V-0-3A-3-Digits-Variable-Adjustable-Digital-Regulated-DC-Power-Supply-W9Y8-/192073872220

author: floobydust
author_rank: Super Contributor
timestamp: June 23, 2017, 11:58:47 pm
content: I like the aux. floating supply approach the best- you get almost no V losses in the pass-transistors and can use ordinary (non rail-rail) op-amps, they have to slew less.Disadvantages I find are the output overvoltage spike on power up/down, extra transformer and Vregs.Most of the lab bench PSU's from Asia use the old-school low cost dual op-amps:LM358 $0.55LF353 $0.79TL082 $1.18LT1013 $5.91I'd rather spend $5 of the budget on decent power transistors like 2SC5200's instead of high-performance op-amps.

author: aries1470
author_rank: Regular Contributor
timestamp: June 24, 2017, 12:06:52 am
content: @ OP - debininja,Can you also comment on what Voltage range and Current you are looking for.Just curious, and what your usage will be.Then I can search more specifically for you.Does it need to follow that old design, and if yes, why?Will you be using a large transformer - linear, or do you prefer SMPS?If SMPS, what convertion target of efficiancy are you looking for? Will 60% -75% do, or do you need 80%+What is your total budget for the project so realistic goals can be set.Sorry for all these questions, but they will help identify many things

author: debininja
author_rank: Contributor
timestamp: June 24, 2017, 12:41:48 am
content: I listed those in my first post.* +25V rail max, -3V rail min(unless there is a way to get a single supply based cc/cv design. I couldn't find too many of those around the net)Oh look,here's one.And this! I love this thing!I think it'll make a good first cc/cv project!* 20V max output @ 3A max current (60Watts. A big heatsink from an old Pentium 4 PC should work just fine).* I would prefer a modular design. If I can hook it up to, say, a 24V laptop charger (SMPS) that can output 3.5Amps, that's fine. I can add in external filtering if required. I would rather not build another SMPS at this point, so my preference is for pre-existing SMPS that can be found around the house (inkjet printers have nice and juicy SMPS that output 30V or so, and I have one that outputs 32V @ 1.6A. I can definitely use that by modifying the TL431 voltage divider present within to output 25V).--> I also have a MOT pre-wound (24turns_CT_24turns) and ready, which outputs 36V-0V-36V rectified at the moment (I can unwind some turns to keep it at 25V instead--I'm keeping some headroom in case the mains power surges by +10%, that way LM358s wont get burned. The filtration stage consists of a common mode choke and 6600uF combined capacitance (will do fine for 3Amps max).* It doesn'thaveto be an old design. I'm just looking for something that can be built with common, inexpensive, discrete parts--parts that are surely in stock by 90% of hobbyists: LM358s, LM324s, TIP120s/TIP127s, TL431s, 12V and 5.1V zeners (non-precision), 2N3904s and 2N3906s, IRF640Ns, IRFP250Ms, 1N4148s, 1N4007s, various TO-220 and TO-247 schottky diodes.--> I'm willing to spend $10 OOP in parts beyond what I listed above, which I have at the moment. I spent $30 on the SMPS build from last week, so I can't be blowing more money around at this point. The life of an EE student on a budget is not an easy one

author: aries1470
author_rank: Regular Contributor
timestamp: June 24, 2017, 07:50:40 am
content: Hi,I found a "simple" and hopefully easy for you to source, or should have most components handy, power supply to make your ownOh, and it ain't too fancy eitherI came across a few, but here is the 1st on the list:1.30v-4a-adjustable-bench-power-supplyI will be updating and adding to this list in due time for future websearches too.from underneath here will be all the new additions:2. Simple commercial bench top power supply, theCSI3005X5, foundhere. Just needs a X-Former, and no, you don't need that fancy front end, and now more people have a stepping stone to do more google searches for it, without the need for the fancy LCD front-end, LED Front ends work great too

author: David Hess
author_rank: Super Contributor
timestamp: June 24, 2017, 08:22:50 pm
content: This designs takes advantage of two unusual properties of the LM301A making it difficult to replace. Offhand, I know of no modern equivalents to the LM301A.1. The LM301A has a common mode input voltage range which includes its positive supply making it useful in high side current sense applications like here.2. In this particularly design, the compensation pin of the LM301A is used for clamping to improve switching between constant current and constant voltage mode. Offhand, I know of no available modern parts which provide this capability except maybe the LT1008 and while it would make an excellent error amplifier except perhaps for speed, it's common mode range does not include the positive supply.

author: floobydust
author_rank: Super Contributor
timestamp: June 24, 2017, 08:45:24 pm
content: Quote from: aries1470 on June 24, 2017, 07:50:40 amThis is a chinese design kit sells for $6 on ebay. No way it can reliably output 4A with a single pass-transistor, see SOA curve.All are missing the protection diode from Vout to Vfilter cap.ThatMini Bench PSUhas Vout going directly to op-amp X4. Not a good idea.Making a lab PSU bullet-proof, a lost art. Sigh

author: debininja
author_rank: Contributor
timestamp: June 25, 2017, 03:51:51 am
content: Hello everyone. I ended up findingthis gem of a project.I transferred over the schematic to KiCAD and modifed many of the parts.See my first post here for all the hacks I put in.Please let me know what you think. I think it'll be a nice little PSU to start off with and work my way up.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 25, 2017, 09:24:39 am
content: The MiniBenchPsu does not look that promising. Having the shunt at the high side is making things more complicated than necessary. It can be bad for stability too and it would need an amplifier that work up to the positive rail. The way of using a differential amplifier, to bring down the common mode voltage introduces quite some errors and needs accurate resistors. So it is more like a collection of points not to do.The compensation input of the LM301 is used to speed up reaction of the current limiting. There are other ways to achieve this and having the shunt on the high side has more disadvantages than just needing the OP to work at the upper rail. Usually it is not a good ideal anyway.Possibly having a spike on turn on is nothing specific to the floating regulator type. It can happen with other circuits too and there is a way to prevent this. It might be even a little easier with the floating regulator.The commercial Mastec circuit can make a good bases for a supply with floating regulator. It is not perfect, but also not that bad. The compensation used is very simple, maybe even oversimplified, but this is possible to fix / improve with a few small caps and resistors, but quite some thoughts behind them. One can also add sense input to that circuit if needed. With only 20 V and 1 A one can simplify or leave out transformer tap switching. For just two taps (e.g. a transformer with center tap) one can also use an elegant electronic way of using two raw voltages. There are mainly two downsides with the floating regulator: it needs the second supply (e.g. extra transformer or isolated winding) and the output capacitor might need to be a little larger.The simple circuit without a floating regulator usually has the shunt on the low side. One can get away without a negative auxiliary supply, if single supply OPs like the LM324 are used. However without a negative supply there is no way of making a kind of minium load current sink and this limits the performance. With a transformer as a power source one can use a simple charge pump for the extra negative voltage. This is not a big deal, as one only needs something like 10-20 mA. With something like a laptop supply to start with, this is more difficult, but one could still use a kind of small switched mode converter or even just a diode in series for the negative side (so loosing some 0.7 V) - just -0.6 V can be enough to make a current sink. In some cases the extra negative supply can help to reduce the drop out - so there is not that much lost by the diode.While it is possible to use just an LM324 type OP, it might be a good idea to use a slightly better (faster and maybe more accurate) OPs especially for the CC mode loop in the non floating design. Often one starts with a kind of generic OPs in the design and later one decides which OPs would fit best.

author: mikerj
author_rank: Super Contributor
timestamp: June 25, 2017, 09:27:21 am
content: That has a significant flaw for a bench supply, look how much capacitance is on the output. If you connect a circuit to the output expecting the current to be limited to the value set by the pot, then you will be disappointed.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 25, 2017, 12:01:40 pm
content: Many lab-supplies have a capacitance in the 500 µF range at the output. This is not ideal in some cases, but this what you have to expect. With less capacitance the regulator circuit needs to be rather fast or there will be significant voltage drop and overshoot on load transients. A fast regulator can get surprisingly tricky, as suddenly parasitic inductance of just a few cm of wire or an capacitor can get important.One can build a regulator without an output capacitor, but this would be not a normal lab supply, but a rather special one with deficits at other points, like a high no load power dissipation and not so good regulation.The output capacitance of the shown circuit (now in inital post) is not the main problem. The main problem is that current limiting is so slow, that chances are high that the circuit would not survive a dead short when at a higher voltage. So even without a physical capacitor at the output, there can be huge current spike. This potential current spike is a problem with most circuits based on a emitter follower output stage, and even worse with a source follower stage (which is not commonly used anyway). Chances are also high that the CC mode might oscillate under some conditions and it will show significant ripple.A simple regulator with the shunt on the low side would about look like the attached files.The OPs use in the simulation are slightly faster (1MHz) than the LM324 though. So more like an OPA170. The simulation shows a 10 mA - 1 A - 10 mA transient test.

author: alm
author_rank: Super Contributor
timestamp: June 25, 2017, 01:00:34 pm
content: Output capacitance is just something to be aware of, in my opinion. So do not connect a LED with the power supply set to 20 V, 10 mA. Something like 500 uF is typical for linear supplies with up to 1 A output current, but higher current supplies can easily be much higher. Yes, this energy gets dumped into the circuit in the case of a sudden short. A solution is to set the voltage limit to 0 V before connecting the load, so the output cap is discharged. A downprogrammer might also alleviate the problem.Specialty high-speed power supplies without significant output capacitance, in addition to extra complexity, also tend to be more finicky about reactance on the output. They are not necessarily suitable as general-purpose power supply.

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 25, 2017, 01:32:47 pm
content: So how slow is too slow?Ultra fast PSU can be advantage and disadvantage, in terms of usability and the effort of designing correctly. some people like them, some not.Slow PSU is pretty much horrible for everyone, the current limiting is useless.what is the sweet spot? something that will not take too much theory to design and make it stable but not something that is too slow to be useable.The circuit posted by Kleinstein takes about 142us to switch from CV to CC:is that fast enough? is that slow enough? would most people be happy with that kind of speed? will the circuits under test that are connected to the PSU survive or be damaged in case of current-limiting? is it worth to go to the efforts to design a faster one for a beginner?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 25, 2017, 02:03:50 pm
content: That's not a current limit, that's an oscillator.Tim

author: debininja
author_rank: Contributor
timestamp: June 25, 2017, 03:25:57 pm
content: Everyone here is just shooting me down with their fancy shmancy, microvolts precision, super quiet PSU output requirements.As a hobbyist on a budget, and as a first time cc/cv PSU builder, I don't care about that sort of precision and accuracy (as long as it's better than the LM723). I just need something to work, and work decently, following the K.I.S.S. principle.People expect too much from people without an extensive engineering background. The massive income that comes from this sort of profession tends to spoil many, and I think that's the trouble with an electronics forum. There are too many here with extremely precise equipment, costing thousands, or tens of thousands of dollars, who have become spoiled from the performance of their equipment.Here's another one I found, and it seems to fit the bill for me perfectly.According to one of the commenters:QuoteI'll have to change out the reference voltage and gain setting resistors, but I think I'll go with this schematic (current sense is on the low side).

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 25, 2017, 03:58:16 pm
content: Quote from: debininja on June 25, 2017, 03:25:57 pmI'm sorry but your response is childish.are you trying to learn from this project? are you doing it just to get over it because you must?nobody is going against you, and nobody throws microvolt precision at you. and to be real everybody likes Ferrari over fiat, even if they don't need to accelerate to 100km in 3 seconds every day.Current limited PSUs are special in that to make sure then are stable and don't oscillate under any load that is not a pure resistor, they require you some knowledge of control theory. and it's complicated to be real, that's why you have people here helping you giving you a proper schematic or knowledge, because there are many designs on the web that are just bad and will not work you.Nobody is spoiled, nobody has ultra expensive equipment just because they can, and nobody started to begin a hobbyist with those kinds of equipment.

author: debininja
author_rank: Contributor
timestamp: June 25, 2017, 04:40:55 pm
content: How is my answer childish? Of course there's a lot of theory behind it (which will take time and experience to learn), but making a basic PSU with some tradeoffs is fine to me. To you, it might not, and that's fine--to each their own. All I'm saying is that I'm fine with keeping expectations low when building something as a beginner, considering the cost of the build and the parts used, and my current knowledge.

author: mikerj
author_rank: Super Contributor
timestamp: June 25, 2017, 04:52:39 pm
content: Quote from: debininja on June 25, 2017, 03:25:57 pmI hope you aren't considering a career in electronics based purely on the notion that you will have a massive income, as you are likely to be quite disappointed.People are simply pointing out flaws with the circuit. No one knows if you are already aware of these flaws or whether you are happy to accept the consequences of them. Your responses make you look overly sensitive/defensive which is strange as it's not even your circuit design.

author: debininja
author_rank: Contributor
timestamp: June 25, 2017, 05:06:04 pm
content: Fair enough. Not being overly defensive, but I'm just saying, based on what I saw from the guy's data, it seems pretty good (to me).I just swapped out some parts from his schematic to suit my needs.

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 25, 2017, 05:11:57 pm
content: Quote from: debininja on June 25, 2017, 04:40:55 pmGreat,Kleinstein attached a good simple PSU circuit, trust me, it's better than the most PSUs schematics on the web, and it's cheap, it uses simple part, and not that complicated to understand. he also made it stable which is the hardest, so probably if you just copy and paste it into a PCB with small modifications it would work. Why not use it? trust me he spent time on this even though it looks like it took 5 minutes for him, and you go and search for another schematic without first saying why not that is probably 4 times worse and complicated than his.A top of the line PSU with ultra-low noise and ripple, UV precision, and ultra-fast performance don't cost much in terms of parts, they cost much in terms of time and knowledge.the performance of most Bench PSU's compare to many things in life is not determined by money, because inside in general if you remove the transformer and the case they are really cheap, probably cost less than 10$ in terms of components.So if you can improve the performance, just by adding a resistor there and there or just changing the designing without increasing cost, why not?

author: debininja
author_rank: Contributor
timestamp: June 25, 2017, 05:22:15 pm
content: Thanks for getting it through my head.I will do that. Let's call for a peace treaty now.I will update the post once I finish transferring it to KiCAD.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 25, 2017, 07:02:11 pm
content: Quote from: debininja on June 25, 2017, 03:25:57 pmThat circuit is not that bad. There are kits for a similar circuit without the 33 V regulator and different negative supply. The main trouble with these kits is they claim to much power and suggest to high a voltage so they violate the ratings of the OPs and transistors. But after scaling down to 20 V and 1 A they might be perfectly OK. The difference to many other circuits is that the current regulation turn down the set voltage instead of acting after the regulator. With rather slow OPs like the LM324 this might actually even be an advantage. for faster reaction.A time of 120 µs until the current limit sets in, sounds like long, but the charge flowing before this is not that much. It's 2 A times 120 µs, thus about 250 µAs or the charge of a 100 µF capacitor dropping 2.5 V. Depending on the excess current (e.g. closer to a dead short) the delay can get shorter (down to about 25 µs for a dead short) or longer. It is just the limitation of the CC mode used OP. With an LM324 it would get even slower and might be still acceptable if the peak current is limited. This additional limit of the peak current is probably a good idea. The circuit shown is also just a simple close to minimal version. Except for the compensation in the CV mode (which is made to reduce / avoid voltage overshoot), this is more or less the basic lab supply circuit with an emitter follower output stage. Using a faster OP for the CC mode is likely a good idea, though there are limits too: too fast and it might oscillate, depending on parasitics.

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 25, 2017, 08:54:01 pm
content: Quote from: Kleinstein on June 25, 2017, 07:02:11 pmSo the classical floating regulator and the emitter follower output stage are very similar, the difference is minimal in performance.if you could get a separate transformer winding, is it recommended to go for the classical floating regulator or the emitter follower regulator? it seems like although you get slightly better performance for the floating regulator, it's more hassle and more complicated.

author: debininja
author_rank: Contributor
timestamp: June 26, 2017, 05:29:40 pm
content: Hi all. Changed up klein's schematic up a bit. End result is the same, works in the same way, same performance.* Changed up the gain to be 8.05 now, so max vout is 8.05 * 2.5V ref from TL431, so 20.125V (set via potentiometer).* Made some minor changes to some of the resistors. (22k resistors instead of 20k--that's what came with the resistors kit I have).* Added in an output protection diode (reverse biased, probably throw in some random 1n400x diode).* Changed up wire parasitic inductance to 100nH (10cm of wires, at worst)Question:* I don't get is the purpose of D1 (at U1). Is that supposed to be a LED for constant voltage mode indicator?(I checked out the current limit mode by adjusting the input voltage at U2 non-inverting amp. D6 sinks about 3.6mA via the LED when CC limit is reached, so that's working fine).Attached the modified asc.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 26, 2017, 07:22:37 pm
content: The Diode D1 is there for the analog minimum function. So the lower voltage from U1 and U2 sets the actual output voltage. In some circuits D1 could be replaced with a resistor and R1 removed.There are a few circuits that use LEDs at this position. However the reverse voltage for most LEDs is limited and the higher forward drop can prevent the voltage to go all the way to zero. So the better way is to use a kind of comparator and compare the outputs of the 2 OPs. This could be the 4 th OP in the LM324.Another point to think about might be replacing R1 with a kind of current mirror, that can also be used as an output enable / disable and prevent voltage spikes during turn on. A limited, constant current would also act as a secondary fast current limit to prevent current spikes.Having Q1 an 2N3904 might be just acceptable for an 1 A output current and 25 V. Normally this transistor might need to be a little higher power, maybe like an BD139. So the 2N2222 was already an the small side.Remember that the circuit is simulated for fast OPs than the LM324. At least for U2 the speed of the OP is relevant. So using a LM324 would make current limiting even slower. For a 1 A current range the shunt should be a little larger - this also helps a little with a faster current limit.R7 = 1 Ohms can be removed. It is a kind of left over, just in case a significant resistor is needed for stability.

author: floobydust
author_rank: Super Contributor
timestamp: June 26, 2017, 07:34:07 pm
content: OP you are forgetting there are situations where you'll see a positive output voltage, that is above your V setpoint (or also in CC mode). It can be due to power outage, charging batteries, loads with huge capacitance. It can happen for msec to minutes.Think you are charging a 12V battery. The output is around 12V and if the supply is in CC mode, U2 has it's output pulled down to back off current.Unfortunately, current can backflow through D5, LED D6, U2 and somebody gets damaged.Same scenario in CV mode, your battery is 12V and you either dial it down a bit, switch off power etc .Voltage-correction op-amp U1 will be trying to keep the output voltage lower than it is, and backfeed occurs. D1, D3 or the reverse-biased E-B junctions of Q1, Q2 conduct causing over-current for U1 and it blows.Number one for me is reliability in a design and performance is second.For your LTSpice circuit, some of my opinion:I see no use for D3 or D5.I think C8 is a bad idea, why slow down the voltage correction so much there? 1uF/220RI recommend a protection diode across +Vout and V1 (C-E on Q2)Q1 is too light duty, unless you add current-limiting resistor for it. Calculate Pdiss at say 10V 1A output.D4 limits differential overload on U4 to 0.7V, I've seen this diode with older LM741 designs. Again, where your commanded voltage setpoint is above your actual output voltage, U1 can saturate and take a very long time to recover and you get big overshoot.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 26, 2017, 07:59:41 pm
content: D3 and D5 have the purpose to act as a kind of simple down programmer. So exactly in the situations that there is a higher voltage at the output, like a charge capacitor. Nearly all OPs have an internal current limit. So the current through these diodes is limited by the OP and nothing bad happens. There is no absolute need for both D3 and D5, one of them is enough. However without them one might exceed the reverse BE rating of Q1. The diodes can also help to avoid some modes of oscillation with a highly capacitive load and low current. D3 can slightly speed up the response in a few cases, when fast turning off Q2 is needed.C8 is only filtering the set voltage. So it only limits the speed how fast one can change the set voltage. It is there to take out the frequency response of the differential amplifier around U3.D4 is limiting the input difference for OP one might consider a second one for the other direction too. It is not only for protecting the OP, it is also about limiting the charge in C4 and discharging C7 when the current limit sets in. This helps to prevent voltage overshoot one a fast CC to CV transition. It kind of slightly slows down the recovery of the voltage, but it usually more acceptable for the voltage comes up slow instead of an overshoot.

author: floobydust
author_rank: Super Contributor
timestamp: June 26, 2017, 08:13:08 pm
content: Hmmm I'm not sure why then I change exploded LED's so much, lol. They pop across the lab.Example in this B&K 1670/1671 lab PSU, kinda similar to OP's circuit but has floating aux. supply for the op-amps. (sch missing a resistor for base drive to TIP31 I think).

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 26, 2017, 09:56:55 pm
content: I have redrawn @Kleinstein schematic so it will be more readable.I have added an overvoltage protection crowbar circuit, but I think this is not the best solution because you will have to have a fuse to blow up and replace, so I rather find something else.I have changed the Darlington transistors and this caused some oscillation, so I had to increase C5, the capacitor across the CV op amp.I also added a constant-current led indicator.You might want to replace R2 with a current source, I have seen people do that although I don't see any difference between just a resistor and a current source.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 27, 2017, 09:29:47 am
content: R3 is much smaller than necessary, D2 and D3, and probably R1, are unnecessary, D8-R5-M1 are a crude shunt regulator not a crowbar (there's no latching, and certainly not an unlimited current draw -- use an SCR), U3 and associated components look superfluous (why not do the same thing with U2?), and C7 looks suspiciously large, or not needed. C1, C2 and C3 are superfluous in a simulation of ideal caps, and the structured values are paranoia anyway; a single part is almost always better.C4 and C5 aren't helping with integrator windup and it's not clear how well compensated this will be, but they can be adjusted. C6+R7 is well placed, and the same for U1 might be good.Just small changes, doing better.Tim

author: not1xor1
author_rank: Frequent Contributor
timestamp: June 27, 2017, 11:40:36 am
content: Quote from: T3sl4co1l on June 27, 2017, 09:29:47 amthere is an error in ZeTeX's schematicC7 should be connected to the negative output not to groundthe purpose of U3 in Kleinstein's schematic is to tie the negative pole of the voltage reference to the negative output rather than to groundwithout U3, the reference voltage depends on the load current too

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 27, 2017, 05:07:08 pm
content: Quote from: not1xor1 on June 27, 2017, 11:40:36 amThanks, fixed it.Quote from: T3sl4co1l on June 27, 2017, 09:29:47 am- I increased R3 to 150ohms, usually, I see people using about 100-150ohms, saving a few mA- About D2, D3, R1 - for D2, and D3, Kleinstein explained their reason, for R1 you might be right, but as kind of protection, I think I rather leave it there: "D3 and D5 have the purpose to act as a kind of simple down programmer. So exactly in the situations that there is a higher voltage at the output, like a charge capacitor. Nearly all OPs have an internal current limit. So the current through these diodes is limited by the OP and nothing bad happens. There is no absolute need for both D3 and D5, one of them is enough. However without them one might exceed the reverse BE rating of Q1. The diodes can also help to avoid some modes of oscillation with a highly capacitive load and low current. D3 can slightly speed up the response in a few cases, when fast turning off Q2 is needed."- I'd figure a proper overvoltage protection later- C1 C2 C3 have different ESR, it's important for simulation and real life.- C4 & C5 are for stability, I don't want to play with them too much, I just trust Kleinstein that he didn't just throw them in there with a random value.Thanks for your help!

author: Kleinstein
author_rank: Super Contributor
timestamp: June 27, 2017, 05:38:03 pm
content: C3 is just a leftover from simulating a capacitive load. So no need for it in the circuit. Having two caps at the output kind of helps as an electrolytic cap has some ESR than helps with stability.C5 is there just in case the OP is too fast. It might not be needed, but it would be a good idea to have the option, just in case U2 oscillates or as another point to optimize. So one might leave it out (unpopulated) initially.I tried a compensation with a series R + C instead of C4 too, but it turned out to be best with R = 0. Also having the compensation from the other side of the diode did not make a big difference, as much of the speed is set by teh GBW of U1 anyway. It is only with a fast OP that the compensation here is really needed.

author: not1xor1
author_rank: Frequent Contributor
timestamp: June 29, 2017, 04:12:20 am
content: Quote from: ZeTeX on June 27, 2017, 05:07:08 pmI modified all capacitors by choosing real capacitor models of same value, 50V rated, and checked for 1s transient 10mA/.9A pulse load.The circuit seems stable, but as soon as I change either transistors with more common ones, like BD139 and TIP41C, both or just one of them, the circuit oscillates wildly (LTspice XVII 2017-02-06 build).I'll later check the phase margin with stable loads of 10mA and .9A and or when in CC mode.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 29, 2017, 12:42:30 pm
content: That's one reason for the larger value B-E resistor: less bias current gives less bandwidth in the output transistor(s), and therefore less prone to oscillation. (We're talking ~10MHz of bandwidth, well in excess of what the op-amp can deliver -- the transistors don't need to be that fast, and it can hurt to run them that fast, for this reason.)Note that SPICE models often fail to model transistor phase shifts correctly:I built the circuit on the left, which oscillates. The simulation shows it is stable. I had to modify it, to the circuit on the right, to get the simulation to oscillate. Unfortunately, the parasitic components are about 10x larger than what is realistic for the circuit. I am left to conclude there is some additional phase shift or delay in the real transistor(s), which is not present in the provided models (which I obtained from ON Semi, IIRC), or which SPICE cannot model at all*.*SPICE contains two infamous hacks to approximate real phenomena:1. A PN junction, in forward bias, stores charge. This charge must be built up before the junction "turns on" (forward recovery), and depleted before it "turns off" (reverse recovery). SPICE models this as a dependent capacitor with a dependent current sink, so that the V(I) curve is logarithmic (following the Shockley equation -- the static diode curve), and the stored charge behaves like a battery (charge is ~exponential with voltage). A dependent capacitorcannotmodel forward recovery, because it's always capacitive, and the capacitance increases as it's being charged, whereas forward recovery is more like a resistor that decreases as charge is stored. Reverse recovery is modeled reasonably well at least, but diode losses are usually underestimated (recovery loss is significant in real converters). But even more tricky iswherecharge is stored: it's not stored uniformly in the junction: it diffuses through the semiconductor. You can apply a short forward-bias pulse, then hold reverse bias, on a diode; if it's the right kind of diode (the doping profile is involved, as well), the reverse recovery transient will not move softly, but explode open in a fraction of a nanosecond: this is called drift step recovery (aka Grekhov diode). The short forward-bias pulse dumped a wad of charge into the junction, which happened to diffuse out all at the same time, then suddenly, poof, the junction goes open-circuit! This sort of thing is, in principle at least, impossible to model accurately in SPICE, because it's a bulk semiconductor thing.2. Transmission lines. This is a much less lengthy description, okay... Transmission lines: you put waves in one end, wait a delay, and they come out the other end (and reflect back and forth, depending on impedances). This is a hack because SPICE uses variable timesteps, which means what waves entered the TL are propagating at a nonuniform rate (that is, not at a constant distance per timestep). It's not as simple as spinning around a circular buffer. Most simulators simply restrict the maximum timestep, so the steps become uniform inside the TL -- which means no shortcuts can be taken during slowly changing times, and the simulation crawls. (Or it may be more complex than that, I haven't looked. It 'feels' like this is the case. It may simply be that it's doing extra math to resolve the variable timesteps, and that increases the overhead significantly.)In any case, these are components which cannot fundamentally be realized in SPICE: SPICE is the domain of matrices, where there is no speed of light (or, if there is, it's infinite), where transfer functions have no real delay, only poles and zeroes. You can make approximations, but only that; an RLC transmission line approximation needs dozens or hundreds of stages, or the SPICE transmission line hack requires lots of internal memory** and runs slow. One must keep these limitations in mind, when one wishes to construct some more unusual simulations (you know, like things in reality).**Okay, to be fair, this was back when you were lucky to run SPICE on a mainframe with 64k+ of core. Now who here remembers what "mainframe", "64k", and "core" wereTim

author: Kleinstein
author_rank: Super Contributor
timestamp: June 30, 2017, 09:10:29 am
content: The circuit shown needs some (usually just the parasitic) inductance of the shunt to get a stable current regulation. There is a reason this inductance was included in the circuit. Besides some positive effect on current regulation, parasitic inductance can make the voltage regulation more difficult.Besides limitations in the models, the parasitic inductance of low impedance parts is a real problem with such a circuit. So even if it works in the simulation, it might oscillate real life, especially if the circuit is fast. The low impedance intended for a voltage regulator makes parasitic inductance important - it is a little complementary to the difficulties with parasitic capacitance in high impedance circuits.Some of the transistor models are supposed to be very good, but some are also simplified. At least the reverse recovery is modeled rather good (though usually not much differentiation between hard and soft recovery diodes). With transistors there is not much of a forward recovery. This is more like an effect important in PIN diodes (especially high voltage high frequency rectifiers) - normal PN diodes are rather well described with the capacitor model, voltage overshoot is due to lead inductance and not due to the semiconductor part.