Author Topic: Constant Current Load Stability  (Read 6637 times)

0 Members and 2 Guests are viewing this topic.

Offline KaneTopic starter

  • Contributor
  • Posts: 24
  • Country: gb
Constant Current Load Stability
« on: May 12, 2023, 10:46:26 pm »
Hello,

I have been trying to make a constant current load powered from a 9V battery as a little project and I've been having stability issues with the op amp oscillating.

I did some research on op amp stability and found the feedback compensation techniques of adding a resistor Riso and Riso + dual feedback but I don't have a waveform generator to make bode plots to calculate the compensation values. Instead I soldered on some wires to put in a breadboard and tried different values of resistors and capacitors for R5, R6 and C2. I managed to get it very stable when increasing the current from 0, the circuit is shown below.



My main issue now is that it oscillates under some circumstances when switching on the output of the power supply if the current is set on.

Example:
If the voltage at LOAD + is more than a few volts then it doesn't oscillate at all.
If the voltage at LOAD + is less than a few volts then it only oscillates if the current control is above a few hundred milliamps when turned on. if it is turned all the way down and then increased from 0 it doesn't oscillate.

This made me think it has something to do with the op amp driving the MOSFET fully on when there is no load voltage connected and the current control is on causing a current surge when the power supply output is turned on, though it doesn't oscillate at higher voltages where the current overshoot is worse.

I've built the thing on copper clad board but I connected a button to pull up the inverting input of the op amp on a breadboard so I could drive the output of the op amp low to allow me to turn on the supply and have the MOSFET turn on instead of a big surge of current and the op amp trying to turn it off fast and being slew rate limited. This did have a big impact and holding the button while I turn on the supply and then releasing makes it turn on stably down to 0.5V but this was just a test and not an adequate solution.

I just tried using a normal 1.5V AA while writing this and It doesn't oscillate so maybe it is fighting the control loop in the switching power supply? still doesn't explain why it works at higher voltages where the surge current is higher.

Any body have any ideas of how I can stabilise the startup and prevent it from fighting the power supply? Here's the circuit construction if it helps.



Apologies if this is a big wall of text with not much helpful info to go on. I'm just learning and googling as I go along and It's hard to explain things I don't fully understand.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3299
  • Country: gb
Re: Constant Current Load Stability
« Reply #1 on: May 12, 2023, 11:26:10 pm »
R5 seems a bit high, try taking that down to 100R.
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6527
  • Country: ro
Re: Constant Current Load Stability
« Reply #2 on: May 13, 2023, 12:30:19 am »
LM324 has problems at zero crossing.  This w2aew's video explains why:  https://youtu.be/VgodYtiD_F0

Will read the rest tomorrow, it's 3AM here.  Before anything else, I would add a resistor from the output of the opamp to the power supply. 

I like the schematic style, is that hand drawing with a pen, or a program that produces hand drawings like schematics?
 
The following users thanked this post: mawyatt

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 3627
  • Country: us
Re: Constant Current Load Stability
« Reply #3 on: May 13, 2023, 01:13:38 am »
That's a very nice video, thanks for posting :-+

Best,
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 

Offline KaneTopic starter

  • Contributor
  • Posts: 24
  • Country: gb
Re: Constant Current Load Stability
« Reply #4 on: May 13, 2023, 01:14:46 am »
R5 seems a bit high, try taking that down to 100R.

I tried lower resistance values for R5 as I saw others had lower value and I didn't want to slow down the charging and discharging of the MOSFET gate too much but they all oscillated at higher load voltages.

I then used the calculations in the TI Precision Labs video series on stability to get the values for R6 (RF) and C2 (CF) which were:



Looking back at it now though I used 1700pF for CLOAD as that was listed as the input capacitance in the datasheet for the IRLZ44N but it changes with VDS and is nearly 2400pF at 1VDS so I will increase C2 in the morning.
 

Offline KaneTopic starter

  • Contributor
  • Posts: 24
  • Country: gb
Re: Constant Current Load Stability
« Reply #5 on: May 13, 2023, 01:43:45 am »
LM324 has problems at zero crossing.  This w2aew's video explains why:  https://youtu.be/VgodYtiD_F0

Will read the rest tomorrow, it's 3AM here.  Before anything else, I would add a resistor from the output of the opamp to the power supply. 

I will definitely give that a try tomorrow, It's 2:30AM here. I just finished binge watching all of W2AEW's videos the other day too they are incredible. It's what prompted me to buy some copper clad board, I really like his circuit construction techniques.

I like the schematic style, is that hand drawing with a pen, or a program that produces hand drawings like schematics?

It's hand drawn in Microsoft OneNote on my iPad, nothing fancy.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1452
  • Country: ua
Re: Constant Current Load Stability
« Reply #6 on: May 13, 2023, 06:52:25 am »
Increase C2 to several nFs. And decrease R5 to about 47 R. But with large enough C2 anything else won't hurt stability much.
 

Offline eblc1388

  • Frequent Contributor
  • **
  • Posts: 400
  • Country: gb
Re: Constant Current Load Stability
« Reply #7 on: May 13, 2023, 02:11:40 pm »
Usually we would connect the black current wire nearest to the current sensing resistors, as shown. This will prevent the current related voltage drop of the copper trace from messing up with our reference voltage.
 
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #8 on: May 13, 2023, 02:58:10 pm »
The issue here is not only the crossover distortion of the LM324. The LM324 output impedance is too high to drive a MOSFET. This creates two problems:

1. The low pass filter created by the limited output impedance has a very low corner frequency causing a 90° phase shift long before the op amp run's out of gain. The 90° phase shift must be added to the op amp phase margin. You can overcompensate the op amp. But response will be slow.

2. You don't have sufficient current to drive the drain to gate miller capacitance. Any change in drain voltage will cause the current to change.

What you can do:
select a high speed op amp and buffer the output with a totem pole drive with low value emitter resistors. (see point 2 on why you need those low value resistors). However, "clamping" the gate with a low output impedance driver creates an other oscillator. This time any inductance in the drain wiring will create an oscillator with the drain source capacitance. but killing the oscillator is easy by adding an RC network from drain to GND. Something like 2µF in series with 2,2...4,7 will do.

 
 

Offline KaneTopic starter

  • Contributor
  • Posts: 24
  • Country: gb
Re: Constant Current Load Stability
« Reply #9 on: May 13, 2023, 03:45:57 pm »
The issue here is not only the crossover distortion of the LM324. The LM324 output impedance is too high to drive a MOSFET. This creates two problems:

1. The low pass filter created by the limited output impedance has a very low corner frequency causing a 90° phase shift long before the op amp run's out of gain. The 90° phase shift must be added to the op amp phase margin. You can overcompensate the op amp. But response will be slow.

2. You don't have sufficient current to drive the drain to gate miller capacitance. Any change in drain voltage will cause the current to change.

What you can do:
select a high speed op amp and buffer the output with a totem pole drive with low value emitter resistors. (see point 2 on why you need those low value resistors). However, "clamping" the gate with a low output impedance driver creates an other oscillator. This time any inductance in the drain wiring will create an oscillator with the drain source capacitance. but killing the oscillator is easy by adding an RC network from drain to GND. Something like 2µF in series with 2,2...4,7 will do.

 

It does work with the LM324, I have it stable now with 300Ω for R5, 30kΩ for R6 and 200pF for C2. The current is pretty constant with drain voltage within a couple milliamps. The problem I'm having is when I turn on the power supply I think it's fighting the constant current limit as the indicator latches on sometimes at startup.

So I have to turn the set current on the load all the way down until the op amp output goes to ground and then turn on the power supply and increase the current to what I want. Doing it this way, it works and i've tested it from 0-20V 0-3A, but as you can imagine its a pain having to keep turning it down and up.

So I think my question is really how to prevent it from fighting control loops in power supplies but I'm not 100% sure thats whats happening I will try to capture some waveforms of the startup behaviour
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #10 on: May 13, 2023, 04:00:13 pm »
The op amp went into saturation with the power supply being switched off. That's normal. The LM324 will take some time to come out of saturation and because of the over compensated op amp it will take a while.

It's impossible to eliminate this entirely. You can try a full CMOS type op amp. They tend to come out of saturation much faster.

 

Offline KaneTopic starter

  • Contributor
  • Posts: 24
  • Country: gb
Re: Constant Current Load Stability
« Reply #11 on: May 13, 2023, 04:07:15 pm »
The op amp went into saturation with the power supply being switched off. That's normal. The LM324 will take some time to come out of saturation and because of the over compensated op amp it will take a while.

It's impossible to eliminate this entirely. You can try a full CMOS type op amp. They tend to come out of saturation much faster.



I will definitely get some different op amps and experiment.
Do you have any recommendations for better performing "jellybean" op amps that will work for a decent range of projects?
 

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 3627
  • Country: us
Re: Constant Current Load Stability
« Reply #12 on: May 13, 2023, 04:39:26 pm »
If you watch the video that RoGeorge mentioned on the LM324, that technique of loading the opamp output not only reduces cross-over distortion but lowers dynamic output impedance, a very simple and effective technique.

If you require an even lower output impedance you can add an emitter follower (2N3904) and emitter resistor with a bias level of 10~20ma which will drop the dynamic output impedance as "seen" from the emitter of the added transistor to a few ohms, dominated by transistor parasitic resistances.

Dynamically the impedance depends on the current sinking or sourcing in almost all opamps, and the added emitter follower is no different. With a NPN follower the current sourcing impedance is very low (ideally ~{kT/q}/Ie), and the sinking impedance is controlled by the emitter resistor, negative feedback keeps this level lower for small/moderate signal level changes and within slew rate limits. We've utilized this concept often and it works with almost all opamps.

Best,
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 
The following users thanked this post: RoGeorge

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6527
  • Country: ro
Re: Constant Current Load Stability
« Reply #13 on: May 13, 2023, 05:40:27 pm »
that technique of loading the opamp output not only reduces cross-over distortion but lowers dynamic output impedance

I was not aware of that aspect, thank you!  :D



About the 324/358 type of opamps in particular, TI published an "Application Design Guidelines for LM324/LM358 Devices" https://www.ti.com/lit/pdf/sloa277

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 3627
  • Country: us
Re: Constant Current Load Stability
« Reply #14 on: May 13, 2023, 06:31:14 pm »
that technique of loading the opamp output not only reduces cross-over distortion but lowers dynamic output impedance

I was not aware of that aspect, thank you!  :D



About the 324/358 type of opamps in particular, TI published an "Application Design Guidelines for LM324/LM358 Devices" https://www.ti.com/lit/pdf/sloa277

Especially true as the output enters and crosses the crossover region, here neither output transistor is conducting.

Best,
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 
The following users thanked this post: RoGeorge

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #15 on: May 13, 2023, 07:14:36 pm »
Quote
If you require an even lower output impedance you can add an emitter follower (2N3904) and emitter resistor with a bias level of 10~20ma which will drop the dynamic output impedance as "seen" from the emitter of the added transistor to a few ohms, dominated by transistor parasitic resistances.

An emitter follower will not do the job. As I wrote, you will need a totem pole buffer because the driver must be able to sink the current injected trough the drain gate miller capacitance.

start up problem:
The op amp will go into saturation anyhow when the inputs are left open. You want something to turn off the current sink when no supply is present or always connect a power supply and then turn on the current sink.

I don't know of any jelly bean op amps unless you want to use dual supplies. A not jelly bean op amp could be a TLV172.

« Last Edit: May 13, 2023, 09:48:12 pm by temperance »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1547
Re: Constant Current Load Stability
« Reply #16 on: May 14, 2023, 05:50:32 am »
Hello,

I have been trying to make a constant current load powered from a 9V battery as a little project and I've been having stability issues with the op amp oscillating.

I did some research on op amp stability and found the feedback compensation techniques of adding a resistor Riso and Riso + dual feedback but I don't have a waveform generator to make bode plots to calculate the compensation values. Instead I soldered on some wires to put in a breadboard and tried different values of resistors and capacitors for R5, R6 and C2. I managed to get it very stable when increasing the current from 0, the circuit is shown below.



My main issue now is that it oscillates under some circumstances when switching on the output of the power supply if the current is set on.

Example:
If the voltage at LOAD + is more than a few volts then it doesn't oscillate at all.
If the voltage at LOAD + is less than a few volts then it only oscillates if the current control is above a few hundred milliamps when turned on. if it is turned all the way down and then increased from 0 it doesn't oscillate.

This made me think it has something to do with the op amp driving the MOSFET fully on when there is no load voltage connected and the current control is on causing a current surge when the power supply output is turned on, though it doesn't oscillate at higher voltages where the current overshoot is worse.

I've built the thing on copper clad board but I connected a button to pull up the inverting input of the op amp on a breadboard so I could drive the output of the op amp low to allow me to turn on the supply and have the MOSFET turn on instead of a big surge of current and the op amp trying to turn it off fast and being slew rate limited. This did have a big impact and holding the button while I turn on the supply and then releasing makes it turn on stably down to 0.5V but this was just a test and not an adequate solution.

I just tried using a normal 1.5V AA while writing this and It doesn't oscillate so maybe it is fighting the control loop in the switching power supply? still doesn't explain why it works at higher voltages where the surge current is higher.

Any body have any ideas of how I can stabilise the startup and prevent it from fighting the power supply? Here's the circuit construction if it helps.



Apologies if this is a big wall of text with not much helpful info to go on. I'm just learning and googling as I go along and It's hard to explain things I don't fully understand.

Hi,

There are a lot of issues that can come up here with a circuit like this.

The first is the MOSFET.   These have capacitive inputs and thus are harder to drive.  A biploar would be simpler.

The second, probably even more important, is that regulator circuits that use the source (or emitter) connected to the sense resistor and use the drain (or collector) as the current output (or input) makes it a much harder circuit to compensate and for a general load and it may actually be impossible to compensate.  That's because the different kinds of loads you can encounter could have resistance combined with capacitance and/or inductance, and that just doesnt work.  To get it to work you would probably need some minimum capacitance on the load, which means actually adding some permanent output capacitance.  That's the way it is with these circuits because the transistor provides an increase in loop again, and it could be a lot, and that means the internal compensation of the op amp is no longer effective in keeping the circuit stable.  This i could guess is the major problem.

To rectify this, change the circuit into a circuit that uses the source (or emitter) of the transistor as the OUTPUT while possibly also sensing current in the source (or emitter) but you could also try sensing in the drain (or collector).  What this does is it reduces the voltage gain of the transistor to less than 1 and makes it easier to stabilize.  This is the most likely to work as you need with a more general type of load.

What you should probably do is start with a bipolar transistor and go from there.  Once you get it working if you really think you need a MOSFET then switch to that and rework the design a little.  In that case you should really use the source terminal as the output though not the drain as mentioned above.

 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #17 on: May 14, 2023, 11:14:23 am »
@ MrAl

Did you read what others and me posted to solve the problem? You probably didn't.

Quote
To rectify this, change the circuit into a circuit that uses the source (or emitter) of the transistor as the OUTPUT while possibly also sensing current in the source (or emitter) but you could also try sensing in the drain (or collector).  What this does is it reduces the voltage gain of the transistor to less than 1 and makes it easier to stabilize.  This is the most likely to work as you need with a more general type of load.

The circuit itself is a source follower with a gain <1.
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6527
  • Country: ro
Re: Constant Current Load Stability
« Reply #18 on: May 14, 2023, 03:24:34 pm »
The schematic tells the load (not drawn) is between the drain and V+, so the drain potential can be anywhere between 0 and V+.  To be a source follower, the drain would need to be tied at V+, and the load would need to be moved, from drain (as it is now) to the source side.
« Last Edit: May 14, 2023, 03:26:52 pm by RoGeorge »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1547
Re: Constant Current Load Stability
« Reply #19 on: May 14, 2023, 04:02:59 pm »
@ MrAl

Did you read what others and me posted to solve the problem? You probably didn't.

Quote
To rectify this, change the circuit into a circuit that uses the source (or emitter) of the transistor as the OUTPUT while possibly also sensing current in the source (or emitter) but you could also try sensing in the drain (or collector).  What this does is it reduces the voltage gain of the transistor to less than 1 and makes it easier to stabilize.  This is the most likely to work as you need with a more general type of load.

The circuit itself is a source follower with a gain <1.


Hello there,

Not sure what you mean, the original circuit is not a source follower.  The sense resistor is in the source circuit not the load.  To be a source follower, it has to have the load in the source circuit not the drain, and the drain would be connected to +Vcc.
See the following diagram.

In this new diagram, the load is connected to the source and the sense resistor is connected in series with the load.  That's the simpler connection but then the load can not connect to ground.  To get the load to connect to ground, the sense resistor has to be connected to the source and the load connected to the sense resistor and ground, or else the sense resistor has to be moved to be in series with the drain, but either way then the circuit has to be modified so that the op amp can still sense the current in the sense resistor which means a few more modifications to how the inverting and non inverting inputs connect to the sense resistor.

Also, C2 may have to be increased to 0.01uf or something.

The problem with the original circuit is that there are all kinds of conditions that can come up that will cause oscillation.  It works for some loads and not for other loads.  Even the best circuits can have problems like this, but that is probably one of the worst.
« Last Edit: May 14, 2023, 04:05:38 pm by MrAl »
 

Offline exe

  • Supporter
  • ****
  • Posts: 2604
  • Country: nl
  • self-educated hobbyist
Re: Constant Current Load Stability
« Reply #20 on: May 14, 2023, 04:23:49 pm »
An emitter follower will not do the job. As I wrote, you will need a totem pole buffer because the driver must be able to sink the current injected trough the drain gate miller capacitance.

Probably a gate-source resistor can fix that, though response won't be as nice as with totem pole.

An alternative could be just using an opamp that can drive a capacitive load. I had success driving PSMN9R5-100XS (4.5nF gate capacitance) with bare MC33071 on breadboard, no compensation (and may be even no decoupling, I don't remember). Though capacitive load driving doesn't guarantee unconditional stability as mosfet with source resistor add a phase shift. Also, compensation will make response nicer as capacitive load causes overshooting for any opamp.
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #21 on: May 14, 2023, 04:41:11 pm »
It depends on how you look at it. You can also say that the original circuit is common source circuit with a source degeneration resistor. But I prefer to stick with a common drain amplifier / source follower because the amplifier input is the gate and the output is in this case the voltage across the source resistor. The voltage gain or what's fed back into the op amp of this circuit is <1. A= Vin/Vout or A= (gm x Rsource) / (gm x Rsource + 1)


But I think you misunderstood the circuit. The device under test is a power supply connected between the drain and GND from which you want to draw a constant current.

This topic has been posted many times in here and most people underestimate the MOSFET drive requirement. Jay_Diddy_B made a full analysis of this circuit. But I can't seem to find his post.
 

Offline exe

  • Supporter
  • ****
  • Posts: 2604
  • Country: nl
  • self-educated hobbyist
 
The following users thanked this post: temperance

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: 00
Re: Constant Current Load Stability
« Reply #23 on: May 14, 2023, 04:57:36 pm »
Quote
Probably a gate-source resistor can fix that, though response won't be as nice as with totem pole.

An alternative could be just using an opamp that can drive a capacitive load. I had success driving PSMN9R5-100XS (4.5nF gate capacitance) with bare MC33071 on breadboard, no compensation (and may be even no decoupling, I don't remember). Though capacitive load driving doesn't guarantee unconditional stability as mosfet with source resistor add a phase shift. Also, compensation will make response nicer as capacitive load causes overshooting for any opamp


-You want to move the phase shift away from the op amp phase shift. You've got two options: feed forward compensation (but that works only over a limited range) or speeding up the MOSFET driver such that the onset of the phase shift occurs above 2...5MHz.
-The MC33071 can work because it seems to have a complementary output stage. But the value of the PNP output transistor emitter resistor is unknown. (but probably low because the op amp can drive 10nF.)

A similar construction as described can be found in this app note including the required low value emitter resistors. Nothing fancy.
https://www.analog.com/media/en/technical-documentation/application-notes/an133f.pdf



« Last Edit: May 14, 2023, 05:07:30 pm by temperance »
 

Offline exe

  • Supporter
  • ****
  • Posts: 2604
  • Country: nl
  • self-educated hobbyist
Re: Constant Current Load Stability
« Reply #24 on: May 14, 2023, 05:09:34 pm »
BTW, there is one approach to current sources that I want to try. FETs inherently limit current in saturation region. So, say, jfets of depletion fets can just limit current with a source resistor driving gate.

What I learned recently is that enhancement fets are not very different from depletion fets, they just have an offset in "Id vs Vgs" curve. That makes them not suitable for simple current source (fet+resistor). However, with an opamp we can add an offset voltage to compensate for that. I attached the circuit (set C8 to a higher value, like a few uF, it has to be big to "hold" the voltage during transients). So, it's basically a typical current source, but it's extremely fast as it relies on inherent mosfet characteristics for performance, opamp can be very slow. I checked the circuit with a 3kHz BW opamp in LTSpice, it showed very fast step response (but long settling time because of 3kHz opamp). So, as long as mosfet in saturation, it works well.

I'm not sure it's suitable for large currents, but works very well in simulator for small currents. I'm going to build it as I don't trust simulation results. Also not sure if it's suitable for anything above, say, 50mA, but I'll try. Looking at Id vs Vgs curvatures for a few transistors I have at hand, it should work reasonably well for Vds more than a volt or two. Attached is curves for IRFZ24N .


Edit: added better clarifications.
« Last Edit: May 14, 2023, 05:12:28 pm by exe »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf