Author Topic: Current Limiting and Oscillation  (Read 704 times)

0 Members and 1 Guest are viewing this topic.

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Current Limiting and Oscillation
« on: April 14, 2021, 02:23:42 pm »
Hello all,

I'm building a simple DAC controlled power supply based on a LM317. I'm using a dual DAC so set both output voltage and max output current, here is my schematic (R11 and LED3 not mounted):


voltage regulation is working properly nevertheless current limit has issues. After triggering the current limit and cleared that condition (removing load) the output voltage doesn't return to the correct value:


if I send a command to the DAC with much higher current limit voltage output will go up to 6V again

do you have any idea why this happens and how to fix it?

looking forward your reply,
Best regards, Mauro.

 

Offline Vovk_Z

  • Frequent Contributor
  • **
  • Posts: 628
  • Country: ua
Re: Current Limiting and Oscillation
« Reply #1 on: April 14, 2021, 04:31:17 pm »
Isn't it a software problem, possibly?
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #2 on: April 14, 2021, 05:08:16 pm »
Hello,

Isn't it a software problem, possibly?

SW only writes the DAC values it should not play a role afterwards. I think it has to do with the LM358 oscillating.

Best regards, Mauro.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 2706
  • Country: gb
Re: Current Limiting and Oscillation
« Reply #3 on: April 14, 2021, 05:28:47 pm »
I'm not surprised it's oscillating, the NCS213 is a very slow device and the MIC6270 adds a huge amount of gain to the loop, and you also have IC1A in the loop.  You are effectively trying to use a fairly mediocre comparator in it's linear region as an op-amp in this circuit.

Additionally when in constant voltage mode your over-current indicator LED is injecting significant amounts of current into the voltage set point node just after the DAC.  This will not only give inaccurate voltage setting but adds additional feedback when the current limit is reached.  Have you not noticed the LED glowing even when you are not in current limit?

Not sure where to start to be honest, certainly R11/LED3 should be removed, but you are most certainly going to need some compensation in the loop.
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #4 on: April 14, 2021, 08:40:13 pm »
Hello mikerj and thank you for your reply,

Please note that I've informed on the original post that these components are not mounted because I also thought they were a bad idea.
Additionally when in constant voltage mode your over-current indicator LED is injecting significant amounts of current into the voltage set point node just after the DAC.  This will not only give inaccurate voltage setting but adds additional feedback when the current limit is reached.  Have you not noticed the LED glowing even when you are not in current limit?
Not sure where to start to be honest, certainly R11/LED3 should be removed, but you are most certainly going to need some compensation in the loop.

nevertheless the remaining part of your comment is not so clear to me, can you please explain differently?
I'm not surprised it's oscillating, the NCS213 is a very slow device and the MIC6270 adds a huge amount of gain to the loop, and you also have IC1A in the loop.

I'm only comparing the reference voltage from the DAC with the amplified voltage from the shunt resistor, so what do you mean by:
You are effectively trying to use a fairly mediocre comparator in it's linear region as an op-amp in this circuit.

I also think I need to compensate the loop but honestly I have no clue on how to do it.

Other suggestions on how to implement current limiting are welcome.

Best regards, Mauro.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 16949
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Current Limiting and Oscillation
« Reply #5 on: April 14, 2021, 08:54:10 pm »
Try a schottky (e.g. BAT54) from ADJ to OUT?

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #6 on: April 14, 2021, 09:04:51 pm »
Hello T3sl4co1l and thank you for the reply,

I'll try it as soon as possible (I don't have a schottky on hand) nevertheless, what is the reason behind this?

Best regards, Mauro.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 16949
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Current Limiting and Oscillation
« Reply #7 on: April 14, 2021, 09:50:30 pm »
Oh nevermind, I see it now, the yellow highlight of course.  Yeah, you made an oscillator, not sure what else to expect?

I can explain what is missing.  A typical thought process goes like this:
- Default: output a regulated voltage
- When current goes above the set threshold, turn off the output

And... that's that.  See the problem?  Well, let me continue, as reality necessarily must--

- So what happens after the output is turned off?
- Current falls below threshold.
- So output goes back to default voltage.
- Which trips the current threshold.
- Etc.

It's an explicitly unstable system, due to rigid binary thinking.

To get a useful response, we need to break the loop somehow.

Often, it's enough to simply latch the output.  Instead of disabling the output only above threshold, have a separate circuit (a flip-flop) store whether the output is enabled or not.  Trigger the flip-flop, and the output becomes disabled and remains disabled.  It doesn't oscillate, it turns off like a fuse.

Which naturally leads us to the next problem: how does it reset?

We can have a power-on reset, or a manual reset button (or signal from an MCU or whatever), or have a timed delay generate a reset -- in which case, we're making an oscillator again, but this time it's specified explicitly, not arising as an emergent property.

And this might be nice.  It sounds good in principle.  But in a lot of uses, we will probably find it's unexpectedly annoying: it trips from anything, even just touching a capacitor to the output (for some values of capacitance).  Even if it's auto-restarting, it might just sit there chattering, rather than starting up, even when the load is just a few mA and the setpoint is 1A or something.

So we might go further and ask, for a short instant in time, what should we do?

When charging a capacitor from a constant voltage, a large initial current flows, reducing over time, to zero as the voltage stabilizes to nominal output.

Is this behavior we want to permit, modify, or prohibit?

To permit it: we can simply delay the response, perhaps by adding a timer between the comparator and flip-flop.  Only trip if it remains active for the entire time period, otherwise reset the timer.  (Or not fully reset the timer, in which case we can try to model a physical process, like the internal temperature of the pass regulator or load: it can sustain some current for some time, but too much current, too often (it doesn't have to all be in one whole gulp) and it trips.  In this case, the timer's count would bleed away when inactive, so that when inactive only briefly, it doesn't lose much time and finishes counting about where it left off.  That sort of thing.)

In this case, the current setpoint serves as a steady state (for some duration of "steady") limit, much as a fuse functions.  Note that a real fuse requires fault current to open -- a typical one will withstand 50-100% above rated current for quite some time (seconds-hours); their purpose is to clear faults (large sustained surges of many times rated current).  We might be serving a similar function in this case, so beware what the regulator or load is capable of surviving.  (In this case, the LM317's built in current limit will already serve the below function.)


To modify it: we can add a series impedance, or in general, alter the V/I characteristic of the power supply.

This is the traditional method, simply using a circuit that provides continuous control over current and voltage.  Instead of a comparator, use an op-amp, compensate it for stability, and that's basically it.  (Op-amps generally have bidirectional outputs; you'll need a diode on the yellow highlighted line, to mimic the open-collector output of the comparator, so it doesn't push up the VREF side, only pull down.)

As mentioned above, the LM317 already does this, with its, whatever it is, 1.5A I think current limit?  To make this adjustable, we have much work to do, and we might justifiably ask the question whether it's worth using one at all here; after all the DAC is dominating output voltage accuracy, the '317 is just a voltage follower.  It does have a high voltage drop (2V+).  It also has thermal protection (which again, makes all of these decisions rather moot, wouldn't you say? :) ), for which without, we'll have to do a bit more work.


And, to prohibit it entirely: we can again return to the fuse circuit, but make it very fast so that any current excursion is simply nipped off as it starts.


So, to wrap up loose ends -- the other way we can break the loop, is to soften the binary thought process.  This way, we're not so much breaking the loop, as refining it to a more subtle condition.

Rather than thinking in rigid on/off terms, think in continuous terms, of quantities varying gradually over time.

Instead of shutting off the output, what if we just reduce it a little bit at a time?  What's more, the amount we reduce it by, can be in proportion to the amount exceeding the threshold.  That is, the new output voltage shall be Vset - (Iout - Iset) * gain.  "gain" in turn can vary with time, perhaps being small for rapid changes (say, if a step load of 1A occurs, reduce the output by some best-guess amount like 5V or something), but tending towards large values over long periods of time -- this has the effect of integrating the error (Iout - Iset), so that, whatever the output voltage ends up at, we don't really know, but it's simply whatever is necessary to deliver Iset amperes to the load.

And this is simply all that a compensated error amplifier does.  It approaches the situation cautiously, changing slowly over time.

(And no, you can't compensate a comparator; it just oscillates.  An op-amp isn't much more than a comparator -- they're very similar devices, it's just that one isn't guaranteed to be stable under any condition at all, whereas the other is guaranteed to be stable under some range of conditions.  Often all the way up to having one input tied directly to the output (unity gain stable, voltage follower).)

Tim
« Last Edit: April 14, 2021, 10:01:52 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #8 on: April 15, 2021, 09:11:46 am »
Hello T3sl4co1l, thank you for taking the time for such thorough reply,

I'll try to break it into pieces:

I now see that it is a bad idea as the system will be switching between the two states
Oh nevermind, I see it now, the yellow highlight of course.  Yeah, you made an oscillator, not sure what else to expect?

I can explain what is missing.  A typical thought process goes like this:
- Default: output a regulated voltage
- When current goes above the set threshold, turn off the output

And... that's that.  See the problem?  Well, let me continue, as reality necessarily must--

- So what happens after the output is turned off?
- Current falls below threshold.
- So output goes back to default voltage.
- Which trips the current threshold.
- Etc.

It's an explicitly unstable system, due to rigid binary thinking.

I think the "modify" option is preferred and it relates with the current foldback mechanism some circuits have am I correct? 
To modify it: we can add a series impedance, or in general, alter the V/I characteristic of the power supply.

This is the traditional method, simply using a circuit that provides continuous control over current and voltage.  Instead of a comparator, use an op-amp, compensate it for stability, and that's basically it.  (Op-amps generally have bidirectional outputs; you'll need a diode on the yellow highlighted line, to mimic the open-collector output of the comparator, so it doesn't push up the VREF side, only pull down.)

As mentioned above, the LM317 already does this, with its, whatever it is, 1.5A I think current limit?  To make this adjustable, we have much work to do, and we might justifiably ask the question whether it's worth using one at all here; after all the DAC is dominating output voltage accuracy, the '317 is just a voltage follower.  It does have a high voltage drop (2V+).  It also has thermal protection (which again, makes all of these decisions rather moot, wouldn't you say? :) ), for which without, we'll have to do a bit more work.

And, to prohibit it entirely: we can again return to the fuse circuit, but make it very fast so that any current excursion is simply nipped off as it starts.

So, to wrap up loose ends -- the other way we can break the loop, is to soften the binary thought process.  This way, we're not so much breaking the loop, as refining it to a more subtle condition.

Rather than thinking in rigid on/off terms, think in continuous terms, of quantities varying gradually over time.

Instead of shutting off the output, what if we just reduce it a little bit at a time?  What's more, the amount we reduce it by, can be in proportion to the amount exceeding the threshold.  That is, the new output voltage shall be Vset - (Iout - Iset) * gain.  "gain" in turn can vary with time, perhaps being small for rapid changes (say, if a step load of 1A occurs, reduce the output by some best-guess amount like 5V or something), but tending towards large values over long periods of time -- this has the effect of integrating the error (Iout - Iset), so that, whatever the output voltage ends up at, we don't really know, but it's simply whatever is necessary to deliver Iset amperes to the load.

And this is simply all that a compensated error amplifier does.  It approaches the situation cautiously, changing slowly over time.


(image from torexsemi.com)

if this is the case can I implement this functionality and if so a few pointers would be nice.

Best regards, Mauro.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 16949
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Current Limiting and Oscillation
« Reply #9 on: April 15, 2021, 04:00:23 pm »
Yes, in general you can implement almost any V/I profile you like.  Flat limit, and foldback (the full diagonal slope one), are most common.

Note that aggressive foldback (such that Iset < 0 at Vout = 0) can have a latching behavior as well; this is generally undesirable as it won't start up into a load at all.  Best is a compromise between power dissipation (this is ultimately a transistor and heatsink savings measure) and a modest foldback rate (to say 10-50% of nominal current, at Vout = 0).  Keep an eye on temperature sensitivity -- the simplest typical implementation just uses a BJT to sense current, the Vbe of which is temperature dependent.  This can be compensated with a thermistor and some clever resistor choice; I suggest doing simulations to try it out.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #10 on: April 22, 2021, 08:43:42 am »
Hello again,

I've found some old HP power supplies schematics here in the forum and I've tried to integrate the ideas in my design.


I have doubts regarding the schematics, for instance what is the function of the capacitor that I'm highlighting in the image below? is the op amp still working as a comparator?

Here is my current schematic. I've changed the current comparator to a MCP6001 op amp and used the comparator as a CC indication output. What is your opinion regarding the current limiting now?


thanks in advanced,
Best regards, Mauro.
« Last Edit: April 22, 2021, 08:48:19 am by maurosmartins »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 16949
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Current Limiting and Oscillation
« Reply #11 on: April 22, 2021, 10:29:47 am »
Compensation.  Which your MCP6001 will likely need!

A series resistor into the - input, and a cap or R+C across the amp, will do.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #12 on: April 22, 2021, 12:20:36 pm »
Hi Tim,

again thank you for your reply!

Compensation.  Which your MCP6001 will likely need!
A series resistor into the - input, and a cap or R+C across the amp, will do.
Tim

R+C across output and inverting or non inverting input?

Can you point me out any literature regarding this compensation and/or the solution you are proposing.

Best regards, Mauro.
« Last Edit: April 22, 2021, 12:23:27 pm by maurosmartins »
 

Offline dietert1

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: de
    • CADT Homepage
Re: Current Limiting and Oscillation
« Reply #13 on: April 22, 2021, 01:38:49 pm »
Please try to find information and understand what is "unity gain stability" with OpAmps. Then you will learn that making a control loop with more than one amplifier requires detailed studies. In your case the current control loop has three amplifiers: The shunt sense amplifier, then the current limit DAC adder, then the voltage control adder. I left out the LM317, it also adds a delay. To calculate the stability of this combo, you need to understand what is a "Bode diagram" and how to characterize the loop experimentally. There is no simple trick that will do.
In some power supply schematics i saw a diode pair to make a "wired or" for pass transistor control. Then the current control loop does not mix with the voltage control loop. Also i am wondering about the +15 V supply of the shunt sense amplifier. This works as long as the shunt itself remains below 15 V. If you want to use higher output voltage, you need to supply more than 15 V to the sense amplifier. Some designs have the shunt in the Gnd output line, to eliminate that amplifier from the current control loop.

Regards, Dieter
 
The following users thanked this post: MathWizard

Offline maurosmartins

  • Regular Contributor
  • *
  • Posts: 53
  • Country: pt
    • Electronics and Embedded systems
Re: Current Limiting and Oscillation
« Reply #14 on: April 22, 2021, 03:08:12 pm »
Hello Dieter,

also thank you for your reply.

I'm familiar with Bode Diagrams, phase and gain margin but oddly I don't remember ever using them for such application, I'll search more!

In some power supply schematics i saw a diode pair to make a "wired or" for pass transistor control. Then the current control loop does not mix with the voltage control loop.

Indeed I've seen the diode pair in many designs in fact the HP schematic I've sent in previous post has it, nevertheless I don't see how it will fit into my design. My idea is that as long as current is below the threshold imposed by the DAC, the output of MCP6001 should be near the positive rail reverse biasing diode D2 as the voltage DAC should always be less. When current exceeds the threshold the output of MCP6001 will start to go down forward biasing D2 and creating a voltage drop at R6 and thus reducing output voltage -> reducing current (and possibly in my case oscillating as crazy  |O).

Also i am wondering about the +15 V supply of the shunt sense amplifier. This works as long as the shunt itself remains below 15 V. If you want to use higher output voltage, you need to supply more than 15 V to the sense amplifier.

in my case the "+15V" represents  the maximum input voltage so output voltage will always be smaller, the maximum output from my supply should be 12V (4V from the DAC * 3 provided by the LM358 non inverting configuration) and considering 3V voltage drop from the LM317.

Best regards, Mauro.

« Last Edit: April 22, 2021, 03:09:58 pm by maurosmartins »
 

Offline dietert1

  • Frequent Contributor
  • **
  • Posts: 882
  • Country: de
    • CADT Homepage
Re: Current Limiting and Oscillation
« Reply #15 on: April 22, 2021, 03:44:26 pm »
"Unity gain stability" is a concept of using opamps without the hassle of detailed stability analysis. But it's basic rule is "One opamp per control loop". You cannot assume that a loop with more than one unity gain stable amplifier will be stable. On the contrary - unless you apply additional "compensation" such a loop will definitely be unstable.
You have one opamp for voltage control and it seems to be stable. That means the delay by the LM317 is small enough to let the opamp balance the loop successfully. How can you control current with one amplifier? Put the shunt into the ground line and use the DAC adder opamp to control the current loop. And use a diode pair to avoid feeding the current control signal into the voltage control loop. That may be a path to success without a lot of work.

Regards, Dieter
 

Online xavier60

  • Super Contributor
  • ***
  • Posts: 1828
  • Country: au
Re: Current Limiting and Oscillation
« Reply #16 on: April 22, 2021, 10:22:25 pm »
The MIC6270 is a comparator.  I have come across open collector opamps but I didn't note the part number.
Hioki AS100D vom, HP 54645A dso, Fluke 87V dmm, AN8008 dmm, Agilent U8002A psu,  FY6600 function gen, New! Brymen BM857S-(With Battery)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf