opamp transistor follower oscillates to buggery when in CC mode - Page 1
Forum section: electronics / beginners

author: nemail2
author_rank: Regular Contributor
timestamp: July 24, 2019, 08:08:14 pm
content: Hiso I did make this cheapass LabPSU circuit which is attached below and did build it up with a PCB.(details and more files like board layout here:https://github.com/mamama1/LabPSU_CA1)The github version is not the most recent one, i have changed R6 from 1k to 4k7 and changed T1 from TIP3055 single NPN to TIP142 Darlington. Everything else is unchanged.Now, when the PSU goes to constant current mode, the whole thing oscillates to buggery. I had this issue before in a similar design and some nice fella told me how to compensate it.Principle how CC mode works: IC3B goes to 0V on output pin 7 when the read current (from MAX4080 via shunt R3) on IC3B pin 6 is higher than the set current on IC3B pin 5. D6 starts conducting and pulls IC3A output pin 1 low and the whole thing should settle at the set current.In this circuit it works perfectly, without any oscillation:https://github.com/mamama1/LabPSU_Darlington/blob/master/schematics.pdfAttached is also a measurement of how the output of the MAX4080 looks like (after D2 and R5) when it oscillates.I hope I might get away with just changing the values for R10, C11, R11, C13 and maybe R5. in that case I wouldn't have to respin the PCBs.Any suggestions would be highly appreciatedThanks!

author: iMo
author_rank: Super Contributor
timestamp: July 24, 2019, 09:02:55 pm
content: Try to connect C11 to pin 1 (IC3A) instead to the darlington's base..

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2019, 09:13:09 pm
content: Why is D2 at the output of the current sense amplifier there? The working schematic has a very small bypass capacitor across R5 there. IC3B may be unhappy if D2 is forward biased.

author: nemail2
author_rank: Regular Contributor
timestamp: July 24, 2019, 09:27:58 pm
content: Quote from: imo on July 24, 2019, 09:02:55 pmthat changed the oscillation to this (attached). notice the smaller amplitude, but it is still there...Quote from: David Hess on July 24, 2019, 09:13:09 pmD2 was a suggestion of another dude to make the current control faster in case of big current spikes... what bypass capacitor across R5? I'm confused... so maybe try to remove D2?

author: nemail2
author_rank: Regular Contributor
timestamp: July 24, 2019, 09:40:28 pm
content: removing D2 does this to the oscillation (additionally to connecting C11 to pin 1 of IC3A instead of the darlingtons base.

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2019, 11:33:23 pm
content: Quote from: nemail2 on July 24, 2019, 09:27:58 pmThe working schematic you linked has a 22 picofarad capacitor in place of the diode. Diode D2 causes other problems.In place of the diode, a better idea would be to clamp IC3B so that it does not suffer from integrator windup but this is not a trivial design change.Inserting the current sense amplifier within the current control loop makes things difficult because of the added phase lag. The extra phase lag requires extra compensation for IC3B which slows things down and increases recovery time. It should be possible to get the circuit as shown (without the diode and with other minor changes) working but better would be to combine IC3B with the current amplifier. Essentially, move the current sense amplifier to the high side and instead of level shifting the current measurement, level shift the slow current limit signal.Quote from: nemail2 on July 24, 2019, 09:40:28 pmI would remove D2 and then adjust the external compensation for IC3B for stability. Replacing D2 with a low value capacitor as shown in the working schematic should help by adding phase lead.Does the oscillation change with load current? The current sink you added to the output is a good start but it does not draw much current and it does not work down to zero volts. Until this is fixed, run the current limit tests at higher voltages. I would tend to use a bipolar current sink on the output and AC couple the error signal to it making the output class-ab.Decoupling capacitor C5 screws up the current limit loop. Other designs omit it without problems and rely on C4 through the current shunt for input decoupling.The example shown below includes these ideas making it worth studying.

author: nemail2
author_rank: Regular Contributor
timestamp: July 26, 2019, 06:27:22 pm
content: Hisorry for the delay. Thanks for the suggestions, David, highly appreciated!I have tried to implement them according to my understandig and possibilities:- replaced D2 with 22pF- removed decoupling cap C5unfortunately I do not understand how to combine IC3B with the current amplifier and how to move the current sense amplifier to the high side (erm, it is high side current measurement, already?!) and what you mean regarding level shifting...I only tested this with a 4R power resistor until now so I don't know if the oscillation changes with load current (while the voltage staying the same). it certainly gets a bit worse if I allow more current to flow (by increasing the output voltage, by increasing the current limit through pin 5 of IC3B). I was testing around 1.5 - 2V so the LM334 should have kicked in. In my other PSU design I used a opamp + n-channel fet current sink which works really great. I may should have put that one in this design in as well.. my fault...I managed to get the oscillation amplitude pk-pk down to about 30mV by increasing C13 to 100(!)nF and decreasing R11 to 1k. Diode D2 and C5 are still removed, C11 is connected to the Darlington's base again.However there's still some nasty stuff happening (the ringing, see screenshot attached). I attached a 2200µF capacitor to the output cause I had one lying around but that did very little to the oscillation.Oh and I'm not sure whether that's clear/obvious, the screenshot is a measurement from the PSU output terminals.I'll have to study your attached design, I hope I can manage to squeeze something into my brain...Any more suggestions how to get this stable (with minor bodge-compatible changes)? This is supposed to be a really cheap and easy design, BOM cost is currently around 50 EUR, incl. a 2004 character LCD from Mouser (without transformer, case and heatsink) and I'd prefer if I wouldn't have to respin the PCB immediately (also because waiting for the china shipment from jlcpcb). Downsides like slow CC mode wouldn't bother me much. I mean, slow CC mode is better than no CC mode, right? :-)

author: nemail2
author_rank: Regular Contributor
timestamp: July 26, 2019, 09:41:17 pm
content: ok so i kinda fixed it now. I revertedeverythingback to the original schematics (so D2 and C5 are back in, e.g.), and then replaced the TIP142 Darlington with a TIP3055 + BD139 Darlington like in my working schematics -> boom, working.anyone can explain this to me? I guess it has something to do with the gain of the two Darlingtons?I guess I'm gonna leave it now that way and maybe at some point make a new PCB revision with the BD139/TIP3055 Darlington pair as I have now just bodged that in.To describe it Dave's way: it is a bit how ya doin' and flapping around in the breeze now. but hey, no oscillation.

author: David Hess
author_rank: Super Contributor
timestamp: July 26, 2019, 11:12:04 pm
content: Quote from: nemail2 on July 26, 2019, 06:27:22 pmI would also remove C9 although I do not think it is causing the problem.Quote from: nemail2 on July 26, 2019, 09:41:17 pmThere are two major differences associated with changing the pass transistor:1. The TIP142 Darlington has internal base-emitter shunt resistors which should always be included when the base is only driven one way which is always the case with the larger transistor of the Darlington pair.2. Did you add in R20 or R21? Those combined with the ESR of the output capacitor have a significant effect on frequency compensation and perhaps more importantly in this case, the local stability of the Darlington.

author: nemail2
author_rank: Regular Contributor
timestamp: July 26, 2019, 11:20:06 pm
content: hmm i have always had the footprints for base-emitter resistors in my dual BD139/TIP3055 design (the working circuit) but never populated them as someone in another forum told me not to do so. never had (obvious) issues with that. do you have a link maybe which explains, why they should be used?@R20, R21: no, as those are balancing resistors and in this (cheap) design I only use one TIP3055, I did not include them. but interesting to know that they can affect stability as well. certainly wasn't aware of that.

author: David Hess
author_rank: Super Contributor
timestamp: July 27, 2019, 01:04:12 am
content: Quote from: nemail2 on July 26, 2019, 11:20:06 pmThe base-emitter shunt resistor does two things:1. It removes charge allowing faster turn-off and this makes it important in a power supply for good transient response when the load decreases.2. It sinks the Icbo leakage current which can be considerable in a hot power transistor. If this leakage is large enough, then it can force the transistor on.QuoteA low impedance load at the emitter of the transistor can reflect into the base as a negative resistance causing oscillation. The output capacitor presents a low impedance AC load limited only by its ESR. This is why I suggest removing the 0.1 microfarad output capacitor; if it is necessary for RF decoupling, it should be located at the chassis anyway.This is an advantage of placing the current shunt in series with the emitter; it improves stability. Some linear regulators take a portion of their AC feedback directly from the emitter before the series resistor placing the series resistor in series with the output capacitor. This allows a low ESR output capacitor like a film or ceramic to be used while maintaining good stability. Feedback from the base through C4 is doing the same kind of thing.

author: nemail2
author_rank: Regular Contributor
timestamp: July 27, 2019, 01:28:16 am
content: i guess I should really have that base-emitter shunt resistor then.is there a formula or a rule of thumb what value that resistor should be?guess what, the thing oscillates again. i don't know for sure whether i wasn't measuring correctly or like whether i forgot to measure across the whole voltage range but at 4 Ohms at about 450mA it starts to get ugly. below that, it is good.i'll later (tomorrow) swap the MAX4080T for a MAX4080F as the F version is the one which i used in the working circuit (in an earlier revision, before going to the LTC6102). Maybe that's adding problems as well, as the T version has a much higher gain.otherwise, the differences left between working and non-working are these now:- LM324 vs. OPAx197- 1 vs 2 BD139/TIP3055 Darlingtons- therefore no current sharing resistors vs. current sharing resistors- LM334 load vs. zener diode/npn load (in the old, working revision with the MAX4080F)oh boy.. i'd love to get away with just some minor parts value changes...

author: David Hess
author_rank: Super Contributor
timestamp: July 27, 2019, 02:38:21 am
content: Quote from: nemail2 on July 27, 2019, 01:28:16 am1/20th of the base current is typical for a power transistor (the TIP142 is about that for its output transistor) but I usually figure 1/10th to 1/4 of the base current should flow through the base-emitter shunt resistor depending on the application. The resistance is calculated based on the Vbe voltage which will be between 0.6 and 1.0 volts depending on the current level. Small signal transistors will be 0.6 volts and power transistors will be 1.0 volts or even a little higher. The value is not particularly critical.Note that just because it does not oscillate without the base-emitter shunt resistors, does not mean that it is working correctly. The transistor's slow off-time without the base-emitter shunt resistor masks the problem.

author: nemail2
author_rank: Regular Contributor
timestamp: July 27, 2019, 01:25:49 pm
content: i did put it the 0.1R current balancing resistor now like in the working circuit and replaced the MAX4080T with a MAX4080F and oscillation now really seemed to stop. i still don't have the base-emitter shunt resistors in place, though.so at 1A max output current through the darlington, values like 200R and 10K should be right, i guess?do you have any idea where I can learn everything I need to know to be able to calculate or at least guestimate how to compensate control loops like this? are there like youtube videos or entry-level documents on this, you are away of? I WANT to learn it but unfortunately I'm quite lacking a fair amount of the basics and I had absolutely no technical education. I'm only around two years a electronics hobbyist now (besides learning really basic basics from my grandpa when I was a kid and always having some technical understanding of stuff).analog stuff is really evil.. :-)Thanks!

author: David Hess
author_rank: Super Contributor
timestamp: July 27, 2019, 05:14:08 pm
content: Quote from: nemail2 on July 27, 2019, 01:25:49 pmYes, that will work. Like I said, the values are not critical as long as at a minimum, the resistors can sink the worst case Icbo leakage current. I normally use much lower values sized based on the excess available current from the previous stage which helps remove charge from the emitter-base junction more quickly.QuoteUltimately this comes down to how negative feedback is used and the relationship between gain and phase. I do not know of any good practical books on specifically this but I am sure one exists and someone can suggest it. I first picked it up in bits and pieces from various places.

author: iMo
author_rank: Super Contributor
timestamp: July 27, 2019, 06:35:59 pm
content: The simplest way to estimate the behavior is to simulate its stability (ie. phase margin, etc.) in LTSpice. Just put the essential parts of your PSU into the LTSpice and there is a good tutorial which outputs pretty useful results for example here:https://www.analog.com/en/technical-articles/ltspice-extracting-switch-mode-power-supply-loop-gain-in-simulation-and-why-you-usually-don-t-need.htmlExcept that you may simulate your PSU such you wire a dynamic load to it and watch the currents/voltages at the important nodes.We have done that many times in various threads here already.

author: nemail2
author_rank: Regular Contributor
timestamp: July 28, 2019, 12:04:02 am
content: Quote from: David Hess on July 27, 2019, 05:14:08 pmOk, i bodged them in now, PSU still as stable as before. However I noticed that (doesn't matter whether the base-emitter shunt resistors are in place or not) it starts oscillating if the current consumption of the attached load is JUST exactly as high as the set current limit. if I adjust the load slightly down or the current limit slightly up, the oscillation goes away. also if I adjust the current limit slightly down (or even a lot or doesn't matter how much), no oscillation occurs.it seems that it is only happening in the "transition zone".@literature: feedback and gain I only know in context with opamp feedback resistors and therefore set gain, everything else is chinese to mephase shifting and such is chinese as well (or maybe japanese) to me. someone (or some book or video) would really have to start at page 1 with me...Quote from: imo on July 27, 2019, 06:35:59 pmThanks for the link, I took a glimpse at it and will read it thorougly tomorrow and try to learn from it.I tried to simulate my PSU (always) but the lack of parts in LTSpice is frustrating. Due to my limited knowledge I never know where I can substitute which parts without significantly affect the simulation results. E.g. LTSpice has no MAX4080. My other (working) circuit uses the LTC6102, which is obviously included in LTSpice, as it is an LT part. But that one is really expensive and I did aim for low cost with this (not very good working) design.OPA2197 isn't included as well, neither is the LM358 but at least for the latter I did find a .lib file to use in LTSpice. Also, with those 3rd party .libs you never know how accurate they are.Anyway, I did not manage to get my current, not working design to oscillate in LTSpice. that makes it quite hard to try to stabilize itI have attached what I have come up with (rename LM324.ti.txt to LM324.ti.lib). Due to the lack of the MAX4080, I inserted a LTC6102, which is not accurate, I know - but what should I do?

author: nemail2
author_rank: Regular Contributor
timestamp: July 28, 2019, 08:18:55 pm
content: i have replaced C13 (original schematics) with 100nF and removed the diode D2.only oscillation that is left ist the one in the attached screenshots, when transitioning from CV to CC mode or vice versa.with C13 being 1nF this oscillation was WILD and irregular. with C13 @ 100nF it got this small and regular. I tried to mess with R11 as well and to put 22pF between IC3B pin 6 and 7 but I didn't manage to get that oscillation away (which looks like ripple to be honest).also touching the circuit with my finger at various points didn't do much - i thought doing this i might find sensitive places which react to capacitance...in SDS00005.png you can see the transition and the oscillation during the transition.in SDS00006.png you can see the continuous oscillation if I manage to tweak the load knob with my tongue at the right angle to just about the set current limit.I'm using this load and I have already tried powering it with batteries, the 50Hz oscillation is still there:https://www.aliexpress.com/item/150W-adjustable-Constant-Current-Electronic-Load-Battery-Tester-12V24V48V-Lead-acid-lithium-Discharge-Capacity-meter-200V/32866240382.html?spm=a2g0s.9042311.0.0.27424c4dTzPJu2Any ideas? As this is supposed to be a "random kinda crappy, half-decent general purpose" PSU, i might leave it like this but if anyone has suggestions how to get rid of that oscillation, I'd be happy to modify the circuit. Looking at the changes I have made already, I have to respin the PCB anyway. I just don't really want to spend very much time on it anymore so complete redesign won't be the solution for me (maybe another place, another time, another PSU, ...)...Thanks!