Oscillation in PSU simulation - Page 1
Forum section: electronics / projects

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 08:36:34 am
content: Hi, I'm a hobbyist and trying to "design" a lab PSU;I tried adding RC filter between inverting and output of both op amp with different values (trial and error) but haven't had any luck getting it to not oscillating, before giving up thought maybe you guys can point me at right direction.Connecting the inverting input of the op amp (voltage feedback) directly to the output stops the oscillation but still oscillates in CC mode, but connecting it to the differential op amp which measures the voltage causes oscillation both in CC and CV mode.Is it a bug in the simulator? how can I stabilize the output?Link to the simulator:http://tinyurl.com/yancfgls

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 08:48:57 am
content: Just a capacitor between output and inverting input of the CV op-amp should work. 10nF should be overkill. Then reduce it.Maybe the same for the CC side.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 08:59:23 am
content: You can click on the simulator link and try it yourself, it doesn't fix it...

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 09:19:45 am
content: A resistor is needed in series with the inverting input of the CC op-amp for a compensating capacitor to be effective.I was seeing large amounts of noise on the scope. It cleared up after I removed and added the scope again.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 10:08:16 am
content: When you reset the scope you have to right click on the scope and choose "max scale" to be able to see the noise, the oscillation is still there.

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 10:11:17 am
content: There are too many op-amps. You only need two: one for current and one for voltage. Putting two amplifiers inside one loop like that is asking for oscillation.I've removed the unnecessary op-amps and it's more stable, but there's still noise, even when 10nF is used for the compensation capacitors, so I don't think it's oscillation, probably an artifact of the simulator. By the way, it's drawn backwards, the convention is to start with the input (power source) on the left and the output (load) on the right.http://tinyurl.com/y7fmlfnm

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 10:33:41 am
content: I think it's a simulator problem. Turning off Max Scale always hides the problem.By probing certain points on the output wire shows no problem.And it's stable with no compensation.What is the Max Scale setting for?

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 10:36:22 am
content: That's what I wanted to know, is it the simulator or there's really oscillation.Max scale zooms in to the signal.I have to learn to use ltspice, this isn't working...

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 10:42:10 am
content: I noticed that you bold the link to simulation, the oscillation is still there and I'm coming to conclusion that the noise is from the simulator...

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 10:45:05 am
content: Your circuit in practice should be easy to compensate.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 10:49:43 am
content: Yeah I have to build it on breadboard and test it out. the problem is I don't have a decent oscilloscope to analyze it in depth. just a cheap chinese one, that's why I was trying to use a simulator...

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 10:58:03 am
content: Quote from: ElectronSurf on April 17, 2020, 10:36:22 amQuote from: ElectronSurf on April 17, 2020, 10:49:43 amYes, I noticed the link could easily be missed, so I went back and enlarged it. In that case, it's just noise i.e. rounding errors in the simulation. You'll often see similar things in real life, when zooming in on a signal very closely, especially with a digital oscilloscope. What oscilloscope do you have? Some of the cheap Chinese ones are perfectly decent.The circuit you originally attached appears to oscillate and experience tells me it's likely to do so, because it has two amplifiers in each loop, especially as one of them is open-loop. Sometimes this is a necessary evil, or it's is just easier to design that way, but in this case it isn't: you've already got a current source going to the base of the Darlington pair and ORing diodes, so you might as well connect the output of each amplifier to each of them.Why is LTSpice not working? I know it depends on what one is familiar with, but I find it infinity easier to use than that falstad simulator, which made me curse and swear after a few minutes of editing your schematic. If it was in LTSpice, I would have been able to mirror it, with the input to output going left to right, but there doesn't seem to be a way to do that with falstad, without redrawing it.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 11:10:36 am
content: The scope is DSO138, it's a toy. I didn't say ltspice isn't working, I meant the falstad isn't working and I have to learn ltspice.For current sensing I ordered INA128 in-amp so I thought it's better to simulate it as a simple differential amplifier for now. and to be able to measure the voltage remotely I'm going to need another in-amp which I'm planning to home-brew it with three OP07. do you think having two in-amp and two op amp is going to oscillate because of the loop you mentioned? (the keyword is "hobbyist", this guy (me) don't know anything about electronics)

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 11:38:07 am
content: If a loop oscillates, add a compensating capacitor as already shown. The more stages there are in a loop, the more likely it will be unstable.You can experiment with the value to see what works ok. Too large a value for the CV loop wont matter much because the output stage is naturally voltage sourcing.You don't want the capacitor to be too large for the CC loop because the PSU will be too slow too respond to large overloads.Many designs have extra circuitry for fast current limiting.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 11:57:15 am
content: Quote from: xavier60 on April 17, 2020, 11:38:07 amIsn't what I implanted fast? can you please show me an example?

author: xavier60
author_rank: Super Contributor
timestamp: April 17, 2020, 12:05:09 pm
content: In this example, Q5 monitors the voltage across the CS resistor. Its Collector can draw drive current away from the Darlington's Base.https://www.eevblog.com/forum/projects/how-to-design-fast-bench-supply-with-cc-and-cv/msg3018424/#msg3018424

author: StillTrying
author_rank: Super Contributor
timestamp: April 17, 2020, 12:15:15 pm
content: I thinkthe 2 improvements have created a problem where the +5V current setting reference voltage is no longer referenced to ground ?

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 12:19:54 pm
content: Quote from: xavier60 on April 17, 2020, 12:05:09 pmSorry for asking unrelated questions to the topic; does op amp slew rate plays a role in fast switching to CC mode too?

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 12:39:58 pm
content: Quote from: ElectronSurf on April 17, 2020, 11:10:36 amWhy do you want to use an instrumentation amplifier? They're not designed to be used in a loop like that. There's certainly no point with the voltage amplifier, just use precision resistors and a low offset/bias current op-amp. The internal matched resistors inside an instrumentation amplifier make more sense, for the current amplifier, but precision matched pairs of resistors can be used with the op-amp circuit I posted if you want better performance.https://www.mouser.co.uk/ProductDetail/Vishay-Thin-Film/ORNTA50-1T0?qs=sGAEpiMZZMvrmc6UYKmaNbqQAD9%252BUsfF3rw6ojp5gC0%3Dhttps://www.mouser.co.uk/ProductDetail/Vishay-Thin-Film/AORN100-1AT5?qs=sGAEpiMZZMvrmc6UYKmaNV6xYUiB84CiwIR2BTir2S8%3DQuote from: ElectronSurf on April 17, 2020, 12:19:54 pmYes. When switching from one mode to another, the op-amp must swing from close to the positive rail, all the way down to just above whatever the output voltage is supposed to be. For example, suppose the output is set to 20V, the voltage amplifier's output will be somewhere around 21.5V and the current amplifier's output will be saturated, as close to its positive rail, as it can. When the output is short circuited, the current amplifier's output will have to rapidly drop down to 1.5V or so, whist the voltage amplifier's output shoots all the way up close to its positive rail. This takes time and a large current will flow. When the short circuit is removed, there will be some voltage overshoot.Here's a link to a simulation of a circuit, showing the current and voltage overshoot. Note that it's not very stable and will oscillate with a capacitive load, because the current amplifier is within the voltage amplifier's loop: U1 pulls down U2's inverting input, via a diode.https://www.eevblog.com/forum/projects/how-to-design-fast-bench-supply-with-cc-and-cv/msg3007168/#msg3007168Diodes can be added to clamp the op-amp's output voltage to the inverting input, just limiting the output rate of change and is discussed in the thread linked to above.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 01:23:38 pm
content: I wanted to use in-amp to measure the current accurately (0.1 mV/16 bit ADC) at the high side of circuit. unfortunately I couldn't find any seller who sells thin film resistors where I live, so the only option is to use a simple voltage divider or an in-amp/differential amplifier. is there a third option? can I compensate for the created loop instability somehow?About the op amp slew rate; does JFET op amps speed makes them a good solution for lab power supply application?This for example:https://www.analog.com/media/en/technical-documentation/data-sheets/OP249.pdf

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 01:51:07 pm
content: Quote from: ElectronSurf on April 17, 2020, 01:23:38 pmWhy not simply use an ordinary op-amp for the current amplifier and an instrumentation amplifier to monitor the current?QuoteWhether it's J-FET or BJT makes no difference to the speed of the op-amp. J-FETs don't draw any current through their gate junctions, so J-FET op-amps have lower bias currents and a higher input impedance than BJT input devices. BJTs are essier to make with matched characteristics, than J-FETs so BJT input op-amps have lower input offset voltages, than J-FET op-amps, although modern J-FET devices are very good.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 02:04:04 pm
content: Quote from: Zero999 on April 17, 2020, 01:51:07 pmBecause I'm thinking of implanting an current/voltage set mode before enabling the output, using two different op amps one for measuring and displaying and another for current amplifier makes a little bit of difference between the user input and actual output.I haven't had any luck at high side current sensing with an general purpose op amp without adding another op amp (two op amp in-amp) and even that introduced a lot of error. though this only is my thoughts/trial errors and I don't have any experience, just sharing it with you to come up with a solution...

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 04:50:24 pm
content: Quote from: ElectronSurf on April 17, 2020, 02:04:04 pmI don't see how you'll be able to do this without using separate amplifiers. One of the control amplifiers will always give a false reading. When it's in current mode, the voltage amplifier will be saturated at the positive rail, thus be giving a false reading and the current amplifier will do the same, when it's in voltage mode. I suppose you could just ignore the reading from the amplifier which is pulling the ADC out of range and assume the current or voltage is equal to the value set, depending on the mode.QuoteWhat circuits have you tried?

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 06:54:23 pm
content: Quote from: Zero999 on April 17, 2020, 01:51:07 pmBut the values is not going to be readen from the control op amps, voltage using voltage divider at the output and current from current sensing in-amp output.QuoteDifferential amplifier with 1% resistors is not giving any meaningful output, two op amp in-amp gives a value close to actual current passing through the shunt resistor and with an "home-brew" in-amp I was able to get current reading with ~ ±1mA error.

author: Zero999
author_rank: Super Contributor
timestamp: April 17, 2020, 08:08:20 pm
content: Quote from: ElectronSurf on April 17, 2020, 06:54:23 pmA 1mA error over what range?I think I'm with you now. 1% resistors shouldn't be that bad. What op-amp and values did you use?If you must put the instrumentation amplifier in the loop, then you'll need to add a low pass filter to the error amplifier, otherwise it'll oscillate. I'll post a schematic later, if no one beats me to it.

author: ElectronSurf
author_rank: Regular Contributor
timestamp: April 17, 2020, 08:32:03 pm
content: 1 mA in 0-1A with three OP07. actually LM324 was showing some good results too, ~±3 mA error considering the resistors error it was good for a cheap op amp but only with a 1 ohm shunt.Appreciate it if you post an schematic of that RC filter and thanks for all the information.

author: Zero999
author_rank: Super Contributor
timestamp: April 18, 2020, 10:12:37 pm
content: Here's a schematic I drew up. The problem is the transient response is poor. RL is a time dependant resistor. Its value is suddenly changed from 1k to 1R and the current and voltage are monitored. When the resistor value falls to 1R, the current shoots up, before the current limit kicks in and the voltage spikes, when the value rises to 1k again.EDIT: I've just noticed the current limit on the schematic at the start of the thread is 1A, whilst on this circuit it's 2A. Obviously just change R2 to 1R for 1A.PSU Instr Amp.asc(4.05 kB - downloaded 112 times.)

author: xavier60
author_rank: Super Contributor
timestamp: April 18, 2020, 11:22:57 pm
content: Would the voltage overshoot be acceptable with 100 milliohms for the CS resistor and 1A maximum load?

author: Zero999
author_rank: Super Contributor
timestamp: April 19, 2020, 09:51:18 am
content: Quote from: xavier60 on April 18, 2020, 11:22:57 pmAre you asking the original poster or me?I don't see the need for such a low value current sense resistor in a linear power supply such as this. 1V or so of additional voltage drop, at full load should be acceptable. Going for very low values will increase the error, from offset voltages, especially at lower currents.

author: xavier60
author_rank: Super Contributor
timestamp: April 19, 2020, 10:14:13 am
content: Quote from: Zero999 on April 19, 2020, 09:51:18 amI was asking you since you already had it in a simulator. Maybe the voltage overshoot will be acceptable with an output capacitor added and faster compensation.

author: Zero999
author_rank: Super Contributor
timestamp: April 19, 2020, 01:02:24 pm
content: Quote from: xavier60 on April 19, 2020, 10:14:13 amThe overshoot is worse, at lower voltage settings. Adding some anti-slew diodes, along with the associated feedback network helps.PSU Instr Amp.asc(4.85 kB - downloaded 80 times.)Here's what it looks like, with the output set to 5V, without R7, R8, D3 & D4.And with R7, R8, D3 & D4.Note, I set the current limit to 1A, as that's what the original poster's schematic does.

author: xavier60
author_rank: Super Contributor
timestamp: April 19, 2020, 01:23:46 pm
content: I wonder if Kleinstein's idea will work in this topology, C2 gets connected to the ORing node rather than to the CV op-amp's output.The mod made a big improvement to my design but it's the current sourcing type.With C2 connected to the ORing node the CV op-amp will immediately get miller feedback as soon as the overload is removed allowing the output voltage to rise.The mod will also cause a large negative going transition at the CV op-amp's Inverting input as the CC op-amp pulls down.There could be other problems that I'm not seeing yet.

author: Zero999
author_rank: Super Contributor
timestamp: April 19, 2020, 05:22:52 pm
content: Quote from: xavier60 on April 19, 2020, 01:23:46 pmOh I missed that in the other thread. That's the trouble when there are so many posts. It's difficult to read all of them in detail.PSU Instr Amp.asc(5.23 kB - downloaded 118 times.)Yes that works quite well. I was a bit worried about oscillation, but I also plotted the output of the op-amp and it's better than I thought it would be.