Constant Current Load Stability - Page 1
Forum section: electronics / beginners

author: Kane
author_rank: Contributor
timestamp: May 12, 2023, 10:46:26 pm
content: 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.

author: mikerj
author_rank: Super Contributor
timestamp: May 12, 2023, 11:26:10 pm
content: R5 seems a bit high, try taking that down to 100R.

author: RoGeorge
author_rank: Super Contributor
timestamp: May 13, 2023, 12:30:19 am
content: LM324 has problems at zero crossing. This w2aew's video explains why:https://youtu.be/VgodYtiD_F0Will 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?

author: mawyatt
author_rank: Super Contributor
timestamp: May 13, 2023, 01:13:38 am
content: That's a very nice video, thanks for postingBest,

author: Kane
author_rank: Contributor
timestamp: May 13, 2023, 01:14:46 am
content: Quote from: mikerj on May 12, 2023, 11:26:10 pmI 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 CLOADas that was listed as the input capacitance in the datasheet for the IRLZ44N but it changes with VDSand is nearly 2400pF at 1VDSso I will increase C2 in the morning.

author: Kane
author_rank: Contributor
timestamp: May 13, 2023, 01:43:45 am
content: Quote from: RoGeorge on May 13, 2023, 12:30:19 amI 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.Quote from: RoGeorge on May 13, 2023, 12:30:19 amIt's hand drawn in Microsoft OneNote on my iPad, nothing fancy.

author: Vovk_Z
author_rank: Super Contributor
timestamp: May 13, 2023, 06:52:25 am
content: Increase C2 to several nFs. And decrease R5 to about 47 R. But with large enough C2 anything else won't hurt stability much.

author: eblc1388
author_rank: Frequent Contributor
timestamp: May 13, 2023, 02:11:40 pm
content: 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.

author: temperance
author_rank: Super Contributor
timestamp: May 13, 2023, 02:58:10 pm
content: 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.

author: Kane
author_rank: Contributor
timestamp: May 13, 2023, 03:45:57 pm
content: Quote from: temperance on May 13, 2023, 02:58:10 pmIt 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

author: temperance
author_rank: Super Contributor
timestamp: May 13, 2023, 04:00:13 pm
content: 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.

author: Kane
author_rank: Contributor
timestamp: May 13, 2023, 04:07:15 pm
content: Quote from: temperance on May 13, 2023, 04:00:13 pmI 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?

author: mawyatt
author_rank: Super Contributor
timestamp: May 13, 2023, 04:39:26 pm
content: 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,

author: RoGeorge
author_rank: Super Contributor
timestamp: May 13, 2023, 05:40:27 pm
content: Quote from: mawyatt on May 13, 2023, 04:39:26 pmI was not aware of that aspect, thank you!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

author: mawyatt
author_rank: Super Contributor
timestamp: May 13, 2023, 06:31:14 pm
content: Quote from: RoGeorge on May 13, 2023, 05:40:27 pmEspecially true as the output enters and crosses the crossover region, here neither output transistor is conducting.Best,

author: temperance
author_rank: Super Contributor
timestamp: May 13, 2023, 07:14:36 pm
content: QuoteAn 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.

author: MrAl
author_rank: Super Contributor
timestamp: May 14, 2023, 05:50:32 am
content: Quote from: Kane on May 12, 2023, 10:46:26 pmHi,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.

author: temperance
author_rank: Super Contributor
timestamp: May 14, 2023, 11:14:23 am
content: @ MrAlDid you read what others and me posted to solve the problem? You probably didn't.QuoteThe circuit itself is a source follower with a gain <1.

author: RoGeorge
author_rank: Super Contributor
timestamp: May 14, 2023, 03:24:34 pm
content: 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.

author: MrAl
author_rank: Super Contributor
timestamp: May 14, 2023, 04:02:59 pm
content: Quote from: temperance on May 14, 2023, 11:14:23 amHello 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.

author: exe
author_rank: Unknown
timestamp: May 14, 2023, 04:23:49 pm
content: Quote from: temperance on May 13, 2023, 07:14:36 pmProbably 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.

author: temperance
author_rank: Super Contributor
timestamp: May 14, 2023, 04:41:11 pm
content: 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.

author: exe
author_rank: Unknown
timestamp: May 14, 2023, 04:55:05 pm
content: Here is that post:https://www.eevblog.com/forum/projects/dynamic-electronic-load-project/

author: temperance
author_rank: Super Contributor
timestamp: May 14, 2023, 04:57:36 pm
content: Quote-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

author: exe
author_rank: Unknown
timestamp: May 14, 2023, 05:09:34 pm
content: 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.

author: temperance
author_rank: Super Contributor
timestamp: May 14, 2023, 06:30:39 pm
content: I see what you want to do. but this is not going to be stable with temperature. To compensate that you need some kind of current mirror approach.

author: exe
author_rank: Unknown
timestamp: May 14, 2023, 06:37:52 pm
content: Quote from: temperance on May 14, 2023, 06:30:39 pmOpamp handles that. I think a few kHz loop bandwidth should be enough. I'm making a test pcb to thoroughly test this approach.

author: exe
author_rank: Unknown
timestamp: May 14, 2023, 07:54:09 pm
content: I just assembled a current sink with mc3302, 1 Ohm resistor and PSMN9R5-100XS fet (last plot, I messed up attachments), no compensation whatsoever.Orange trace is shunt voltage, blue is gate drive. The test is 0mA-200mA step (applied to opamp's Vin+) I guess it's safe to say it needs compensation.Then I replaced the mosfet with D965 bjt of suspicious origin, and, guess what, looks like response is much better(first plot)The second plot is made with BS170, a small fet from onsemi. It looks the best, imo.I tried to do the shortest wiring possible, and added a few 1uF decoupling caps. NB the second opamp is not used, and left floating in the air. But it seems it doesn't oscillate (as seen on output), so we good there.

author: TopQuark
author_rank: Frequent Contributor
timestamp: May 15, 2023, 11:16:35 am
content: Quote from: MrAl on May 14, 2023, 05:50:32 amOpamps driving mosfets to form a dynamic load is nothing new and not that difficult if you are not aiming for very high control bandwidth. Numerous commercial MOSFET-based programmable loads offer dynamic loading function with programmable slew rate, usually in the range of few A per us. They don't oscillate even if the DUT is connected with meter-long cables.Quote from: Kane on May 12, 2023, 10:46:26 pmYou can have a look at my project as a base to improve on. 0A to 50A in 283ns (>1MHz BW), no oscillation and minimal overshooting.https://www.eevblog.com/forum/projects/gt1mhz-bandwidth-electronic-load/My project is more of a skill building exercise rather than trying to design a general commercial product, so it is not designed to perform well with inductive loads, and it doesn't. You can add a RC snubber between the two load terminals, or add more phase margin and lower the control BW to make it more suitable with general loads.The way I see it, there's two ways of designing a stable closed loop controlled DC load.The professional way would be to model the components you are going to use, build a simulation, find the poles and zeros in the plant (the thing you are controlling), design your type 1/2/3 compensator, placing the compensator poles and zeros in a way that maximises your system open loop bandwidth (crossover frequency) and stability (phase margin). This probably won't account for the crossover distortion of the LM324 however.The intuitive way (or at least how I think about it) would be to make sure the thing you are trying to control responds faster (how fast your opamp output can drive the MOSFET, and how fast the feedback signal arrives back to the control opamp) than how fast the opamp is trying to control it (i.e. the gain bandwidth of the feedback loop).So the gist of it is to use an opamp with high drive strength (or add a high current buffer amp like in my design), MOSFET of low gate capacitance then roll off the control gain-bandwidth by increasing C2 until it is stable. You can shape the response further by placing a cap in series with R6 etc. , but the above steps should be sufficient.

author: MrAl
author_rank: Super Contributor
timestamp: May 15, 2023, 12:05:11 pm
content: Quote from: TopQuark on May 15, 2023, 11:16:35 amIm not sure why you stated all that. I never said you cant do it, just that you have to do it right.

author: TopQuark
author_rank: Frequent Contributor
timestamp: May 15, 2023, 02:04:37 pm
content: Quote from: MrAl on May 15, 2023, 12:05:11 pmI agree I was not very specific. I meant to say the circuit configuration shown by the OP was tried and true, only requiring tuning to make it work, but I predict the modifications you proposed to be problematic. I believe it will cause more stability issues, if it works at all, certainly not what I would call "right".Quote from: MrAl on May 14, 2023, 04:02:59 pm1. The OP is trying to build a DC load, a device that presents itself as a load, that sinks a set amount of current from a power source. Your circuit describes a programmable current source, that sources a set amount of current into a load.2. Putting that very fundamental issue aside and lets assume we are trying to build a current source. In the circuit you propose, say you wish to source 1A through a simple 10 Ohm load, the gate voltage at the opamp outputrelative to groundthat is needed to turn on the MOSFET is:Vgs (Vgs thresh is 2-4V according to IRFZ44N datasheet, let's be charitable and say only 3V is needed for 1A Ids) +V_load (1A x 10Ohm = 10V) +V_shunt (1A * 0.1Ohm = 0.1V) = 13.1VThe original circuit is stated to be powered by a 9V battery. The LM324 output can swing from ground to V+ - 1.5V, which is 7.5V, not anywhere close to ~13V needed. So the proposed circuit fails to perform as a half decent current source.As a load, the original circuit's opamp output voltage range only needs to cover Vgs required to turn the FET on + V_shunt. 7.5V at the gate will have no trouble sinking around ten amps, and max DUT source voltage is only limited by MOSFET Vds. With proper heatsinking and a tuned control loop, this can be a versatile general purpose device.3. In the proposed modification, your opamp output includes Vgs and V_load. We all agree it can be tricky enough to drive Vgs to maintain current control stability, but now it has to account for Z_load as well. By simply hooking up different resistors as a load will change your control loop gain (V_gate / I_mosfet), making it very difficult to tune for stability, not to mention if you stick a cap or inductor in there. Including a wildcard impedanceinsideyour control loop is just inviting problems.

author: temperance
author_rank: Super Contributor
timestamp: May 15, 2023, 03:15:47 pm
content: @ exe, well done.@ KaneA fast responding dummy load which doesn't oscillate with jelly bean components. The disadvantage being the quiescent current in the totem pole buffer stage and the current trough R2. In total something like 5...7mA.-D4 and D5 make sure that the input of the buffer stage can be driven to GND.-C2 assists on "eating" the current injected trough drain gate capacitance if a transient appears on the drain.-C1 and R5 compensate parasitic inductance introduced by the cables connected to the drain. C1 is a film capacitor, any type, nothing fancy. R2 must be a 1..3W resistor depending on the input signal.-Q1 and Q1: any "normal" transistor will do. BC547, BC557...-All small signal diodes: any small signal diode will do. 1N4148, 1N917, BAS318, BAV70,...-The LT1014 is a low offset version of the LM324.This is what those cheap Chinese dummy load circuits which you can buy everywhere for peanuts but don't work should look like.

author: exe
author_rank: Unknown
timestamp: May 15, 2023, 07:25:35 pm
content: to temperance:Does it make sense to split R1 into two resistors (one for Q1's emitter and one for Q2's emmitter)? Otherwise I think gate pull-up will be slower than pull down. Or this is intended? Like here on Figure 6A:https://sound-au.com/amp_design.htm#s22

author: MrAl
author_rank: Super Contributor
timestamp: May 15, 2023, 07:44:19 pm
content: Quote from: TopQuark on May 15, 2023, 02:04:37 pmIt's an example of a source follower. Have you never seen a source follower before?If you have doubts do a simulation, but i suggest a bipolar not a mosfet. Any of these circuits may need compensation of some type though.Of course if you want an actual current sink, that's different. The example is for providing current to some load, as in powering it.

author: temperance
author_rank: Super Contributor
timestamp: May 15, 2023, 08:40:30 pm
content: Hello MrAl,maybe we can agree on a few things?-The original circuit is for a current sink. Not a current source.-Whatever name the circuit in question has, for the op amp the gain of the buffer is always <1. The remainder is a matter of text book definitions which more often then not are open for interpretation and unfortunately misunderstandings.Thank you.

author: MrAl
author_rank: Super Contributor
timestamp: May 15, 2023, 08:59:14 pm
content: Quote from: temperance on May 15, 2023, 08:40:30 pmHi,Sure, no problem. I was trying to show an example.Here is an example that should be more to your liking.Note the load is in the emitter circuit (R3) and the sense resistor is R1. Vo1 is just for testing.You should be able to use a Darlington if you need higher current.

author: exe
author_rank: Unknown
timestamp: May 15, 2023, 10:38:43 pm
content: Quote from: MrAl on May 15, 2023, 08:59:14 pmI'm curious why using PNP bjt? Wouldn't NPN be more stable bc it's an emitter follower? What's the purpose of base resistor?

author: temperance
author_rank: Super Contributor
timestamp: May 15, 2023, 11:03:19 pm
content: All good. Reading what you wrote earlier, it seems there is a misunderstanding in your circuit analysis. A quote from something you've posted earlier:QuoteThe MOSFET or transistor, has a gain <1. It's the voltage across the source resistor which is being fed back into the op amp. The only thing the buffer does is providing current gain (hopefully a lot) which doesn't change the loop gain at all in this case.For the voltage across the resistor (R3 in the circuit I posted) we get: A= Vin/Vout= (Gm x Rs)/ (1+ Gm x Rs). So, no matter what Gm is and Rs might be, the gain is very close to 1 but never >1. And that's what the inverting input of the op amp is being fed with. What remains is getting rid of the pole pole introduced by the MOSFET capacitance and it's driving source.Also, TopQuark does know what his talking about.

author: temperance
author_rank: Super Contributor
timestamp: May 15, 2023, 11:15:26 pm
content: @ exeQuote-No, during fast transient testing for example the driver must eat the current injected trough the drain gate capacitance when the drain voltage increases. The injected current will translate into a voltage across any emitter resistor added in series with Q2. Something you don't want. You want to gate voltage to remain unchanged during such events.-The small asymmetry is not such a problem because the op amp slew rate is the limiting factor in both directions.-I just noticed that the value I've chosen for R3 (by some ruff guess) seems a little high. 33R would be more appropriate for driving large capacitance MOSFET's. (of course, the op amp still doesn't require any compensation.)And if you really like, you can omit one diode (D1 for example) and replace it with a trimmer to set the quiescent current in the totem pole stage to something like 5mA. Or the fancy stuff a Vbe multiplier. (not really required of course)Why the quiescent current: for two reasons.1. no cross over problems.2. Q2 is now always readily biased to eat the injected current. Response time of the current sink with a BC807 or similar falls in the the range of 5ns. (If you ever want to make transistors switch very fast, use some biasing and avoid saturation. The numbers you will see in spice are darn close to a real circuit.)

author: MrAl
author_rank: Super Contributor
timestamp: May 16, 2023, 01:21:50 am
content: Quote from: temperance on May 15, 2023, 11:03:19 pmHello again,Not sure why you are harping on this when i posted a better circuit diagram that you apparently ignored.There's more to it than that. That appears to be what you and your friend seem to be overlooking.If it was that simple, then why did it not work for you the first time and why so many posts talking about such a "simple" concept.Almost 40 posts now. Gee what a simple thing to do, let's create a mosfet current sink and then figure out why it doesnt work over multiple posts (chuckle) and at the same time still say it's simple. BTW i like to add a little levity now and then to keep the discussion a bit lighter in spirit.It's time to put your simulator where your mouth is (ha ha).Simulate a circuit you think will work, then post here. It's time for proof, not words alone.See, i can say a rock and a racoon will form the best current sink (har har). See how easy that was? It's only when we prove it.It may be that a mosfet circuit will in fact work one way or another, but the way it appeared in the first diagram in this post will not be as stable as a real common source circuit. That's because the transistor adds GAIN. Apparently it is gain that you dont seem to see is there.That's ok i guess, but you should look at what happens in the drain when the transistor drives the mosfet.As i said you may get it to work, but then get it to work and stop knocking other designs when you still havent gotten one to work, and also you should go back and compare the circuits and see what one is the MOST stable.Notice that there has been a lot of rocket testing recently, and many of the projects have failed (not all though). Why is that. It's because the designers believed it would work but it didn't in actual practice.Where did the Space Shuttle go. It took years to figure out it was not as practical as thought.Elon Musk is a pretty smart mofo, yet he has had many failures. Testing and proving, that's what it is all about in the real world.If you want the MOST stable circuit, then you go with the most stable design. That's why i am trying to point out to you.I am not forcing you to use any particular circuit you are certainly free to use any design you care to. Im just suggesting a better circuit and it comes from some 50 years experience, not only in general electronic analysis and professional design work with companies and universities, but in power supply design, very sophisticated power supply design that involved not only these simple DC supplies but also in pure sine converters that had to be very low in THD and also very high in efficiency (90 percent plus).What i am trying to do is share those years of work and study and with my huge technical library with you so you can get a good working circuit. It's always, always up to you if you want to use a given design or any given advice but now you know where this is coming from.

author: MarkF
author_rank: Super Contributor
timestamp: May 16, 2023, 01:28:57 am
content: Some reference material from the forum:Jay_Diddy_B's Electronic Loadwith analysis.My Dummy Loadwhich can be externally driven up to a few kHz.Peter Oak's discussion on stability.I found that the feedback capacitor must be at least 5nF to stop oscillation.I would reduce R5 <= 100Ω and R6 <= 10KΩ in the original post circuit.

author: temperance
author_rank: Super Contributor
timestamp: May 16, 2023, 09:53:00 am
content: @ MarkFdid you read what other people posted. Especially what I posted? Probably not, adding more clutter to the discussion.-If you would read what I wrote, you might understand why a feedback capacitor of 5nF would be required. And what is 5nF without stating the feedback resistor value? A Useless commend so far.-Your dummy load is faulty.-The video's shows an other faulty dummy load. On top of that, sponsored by Farnell. Well done farnell for trying to be an educator spreading faulty circuits. Put a transient on the drain and see what happens. In the second video he seems be toying around with speed up capacitors to mitigate the original fault, undoing the compensation. Which of course doesn't help.My posts took the guesswork out of compensating a dummy load. Just like Jay_Diddy_B did. Build it, try it. Sit back and enjoy a properly compensated feedback circuit running at speeds you can't achieve with guesswork and a transient response beyond your imagination with nothing else than jelly bean components which can be driven op to 10KHz and even more if you replace the op amp.So, maybe instead of posting more clutter you might want to read what has been written en discuss how to compensate the loop properly (yes, there is room for improvement). Instead you add in your mall functioning experience. That math involved isn't complicated at all in this simple circuit.@ MrAI:QuoteQuoteok, I give up. Even with the math in front of you, you keep on saying that the gain is >1. The conclusion you should draw from what I wrote is that you're better circuit is an attempt to improve something you didn't understand.And no, this is not only a simulator. I used LT spice to quickly draw a schematic. Build it, try it.

author: temperance
author_rank: Super Contributor
timestamp: May 16, 2023, 12:31:23 pm
content: ok, MrAl, you asked for it.What you see:-the circuit as attached earlier with R3 changed into 33R.-Voltage measured across 0.1R sense resistor. 1kHz test signal.-Rise and fall time measured across the 0.1R sense resistor.As you can see, this thing is stable no matter what and extremely fast too. Just for fun, it easely handles 10kHz as shown below. This is not the fastest dummy load featured an EEVBLOG. But the the fastest one featuring jelly been components.The ringing seen is not the dummy load but the GND connection. The wire inductance is ringing because of the high di/dt.Your 50 years experience, which is a bad argument anyhow, down the drain... 24 years experience in action.The only "problem" encountered is the quiescent current setting of the totem stage. 1 diode must be removed and replaced with a trimpot or something.

author: MrAl
author_rank: Super Contributor
timestamp: May 16, 2023, 08:37:30 pm
content: Quote from: temperance on May 16, 2023, 12:31:23 pmFirst, when you say "50 years experience is 'down the drain' " that just tells me you still dont understand the situation and that you have very poor social skills if you can actually tell that to someone that is trying to help you, EVEN IF YOU ARE RIGHT.Second, since you are so sure of your circuit, then why not just go with it. Use the circuit you have and be happy with it.Third, and last, i should point out that 'math' is not reality. Math is an artificial rendering of reality, and if even one little assumption is wrong we get a big fat pile of BS. If you really want a detailed map of what is happening, then do a root locus analysis, but be sure to include the MOSFET parameters.So with that, i wish you good luck with your newfound 'success'

author: temperance
author_rank: Super Contributor
timestamp: May 16, 2023, 09:22:15 pm
content: QuoteWhy are you so sure about yourself? Attached is a circuit diagram with two buffered op amps. Which one of the two buffers, according to you, is is not an emitter follower. What is the voltage gain of both buffers according to you if you ignore the op amp?About my poor social skills: read what you wrote yourself. I rarely ridicule others unless being asked for. Remember how you wrote a wall of text ridiculing my schematic, insinuating I just simulated something and don't know how to build a real circuit,... on and closing the sentence with something like haha?And if I find time, I will build your circuit and prove you that are completely wrong if I'm not too busy. Or do it yourself and prove me wrong? Your welcome.

author: MrAl
author_rank: Super Contributor
timestamp: May 18, 2023, 06:37:25 am
content: Quote from: temperance on May 16, 2023, 09:22:15 pmHello again,Oh i see you took my improvement suggestions to heart i was not intending that.See, when people try to help sometimes it sounds like they are being overly critical, and that's a shame. It may have sounded that way but it was intended just to help and draw out some of the pitfalls of various schemes, those that are the same as the circuit you need and those that are similar (like the current source).What happens with the mosfet is the gain of the mosfet itself comes into play because of various things about the speed of the mosfet and the speed of the op amp, comparatively. The mosfet responds fast while the op amp is rather slow. When the mosfet is 'told' to put out more current, it will keep raising the current for a period of time which there is no control over. That causes an overshoot. It takes time for the op amp to detect this and correct the gate drive, but meanwhile the mosfet it still putting out a current that is too high. It may dampen out, that's a hope.What you can do is simple i think. Just use spice to simulate the following two circuits and then try to determine which one is more stable.There's a third circuit i didnt get time to draw but these two may act as a reference.BTW this problem comes up in other places too but sometimes it's even worse, like with the LM431 which requires a certain output capacitance to remain stable.My original concern though was what happens if you use something other than a resistive load.Im posting the two circuits, and note there is no compensation capacitors. Look at the outputs of both circuits and see what you think.The two are easy to set up in a spice program.

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: May 18, 2023, 09:57:58 am
content: Quote from: MrAl on May 18, 2023, 06:37:25 amDepending on the design, it is possible to slow down the Mosfet response, bending the edges of the signal.For example, in a PSU transient test, using a maximum load of 2A and a signal with a rising edge of 8µs and considering the use of the mosfet (IRFP260) used by Temperance, which has a Qgs of 39nC, we have a maximum current estimated 4.8mA:Imax = Qgs/dtImax = 39nC/8µs =~4.8mAMy conclusion is that the direct use of an Opamp to drive the IRFP260 is plausible, even with a 50µs pulse. Generally a 200µs pusl is sufficient for a good transient test.

author: RoGeorge
author_rank: Super Contributor
timestamp: May 18, 2023, 10:32:28 am
content: There is also the Cgd, which seems 2-3 times bigger than Qgs (110nC vs. 42nC inhttps://www.vishay.com/docs/91215/irfp260.pdf).When the load is connected in the drain, it means the voltage on the drain will swing in the opposite direction than the swing of the gate terminal, which makes the voltage on the Cgd to appear steeper than it would be in a common drain repeater. This extra voltage swing of the drain terminal (when the transistor is not working as a source repeater) will need more current at the gate (to remove the gate charge). A common-source (load placed at the drain side) will make the gate current to depend more of the load's impedance (because the load's impedance gives the voltage slope at the drain) than it will depend for a common-drain voltage repeater (load placed at the source side).This makes me believe the gate current will need to be higher in the common-source configuration than in the common-drain configuration, so it would be preferable to have the load on the source side, but I didn't double check this kind of argument in simulation/practice.

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: May 18, 2023, 11:01:33 am
content: Quote from: RoGeorge on May 18, 2023, 10:32:28 amIn the transient test of a PSU, the drain voltage variation is very small (maximum of about 200mVpp). The gate voltage orbits around 4.5v. The Mosfet in this case always works in the linear region. For Cgd to have any influence, and I consider it little, the PSU output must be below 4.0v.

author: exe
author_rank: Unknown
timestamp: May 18, 2023, 04:35:46 pm
content: Quote from: Avelino Sampaio on May 18, 2023, 11:01:33 amThat's an interesting discussion. Anybody willing to do a spice simulation?)In my limited experience, drawing more than a milliamp or two reduces opamp bandwidth. So, I prefer to do sziklai/darlington, that improves transient response. The question is how fast it needs to be. Too much bandwidth won't do good for a general-purpose power supply with long leads and "difficult" load.

author: sorin
author_rank: Frequent Contributor
timestamp: May 18, 2023, 08:13:48 pm
content: Quote from: temperance on May 16, 2023, 09:53:00 amPlease can you tell us what is a mathematical way to calculate the optimal capacitance (C2) in this situation?It is obvious that 5nF or larger capacitance is a nonsense.

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: May 18, 2023, 10:21:30 pm
content: Quote from: exe on May 18, 2023, 04:35:46 pmIn this project of mine I am using the OPA172 to drive the IRFP460 linear mosfet, which has a Qgs of 29nC. Note in the images that the duo behaved very well in the transient test of my PSU.PSU at 8v with pulse current applied around 1AThe applied pulse has an edge slope of about 8µs.1 - schematic2- 200µs pulse on the gate3- 200µs pulse on the source4- PSU response to the 200µs pulse. Much of the 200mVpp is due to the resistance of the long cable I used.

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: May 18, 2023, 10:24:20 pm
content: Follow the test with a pulse of 50µs and edge slope of 8µs1- 50µs pulse at the gate2- 50µs pulse at the source3- PSU response to the 50µs pulse

author: Avelino Sampaio
author_rank: Frequent Contributor
timestamp: May 19, 2023, 11:26:41 am
content: I forgot to mention two details:1- The 8µs rising edge slope was obtained using the cny17-2 optocoupler.2- A DC floor (10%) is always kept on the wrist, to keep the Mosfet always on. This ensures a smaller effect of the Qgs charge.R6 is responsible for the DC floor.

author: temperance
author_rank: Super Contributor
timestamp: May 19, 2023, 03:42:42 pm
content: Calculating the feedback capacitor:1. The pole introduced by the limited drive capability. The gate resistor is 300Ohm + 1K. The 300Ohm is taken from an LM324 data sheet. That's the open loop output resistance of the op amp. (we can't supply more current)What do we get: Ciss of the IRF240 increases with decreasing drain voltage. This causes the phase shift being introduced into the feedback loop to shift left and right. (The gain and phase is measured across R2 because that's what's being fed back into the op amp.)As shown the phase shift occurs well below where the op reaches unity gain. The total phase shift at the unity gain frequency is now >>180°. Or, an oscillator.2. Compensating the op amp:With a 10K feedback resistor and 1K3 gate drive resistance and drain voltages being taken as low as 1V (Ciss increases with decreasing drain voltage), the minimum feedback capacitor to compensate for the pole must be 1 / (2 * 3.14 r * f)= 1 / (2 * 3.14 * 10K * 50K)= 318pFThis results is a load with sloppy response.3. Decreasing the gate resistor in order to improve the step response:nice idea. But op amps aren't ideal. When driving a capacitive load, something called gain peaking occurs. More on that in this app note:https://ww1.microchip.com/downloads/en/Appnotes/00884b.pdfThe app note doesn't show the phase shift at this gain peak. But the circuit, being an imaginary inductor driving a capacitor will change it's phase above resonance. The bandwidth and maximum phase shift are determined by the network Q factor. Low resistance, or low gate resistors imply a larger phase shift. I didn't bother to calculator the inductor value based on the app note. But one can see that this will happen way before the op amp reaches unity gain.An extra buffer amplifier:An extra buffer isolates the MOSFET capacitance from the op amp and places the pole introduced by the low output impedance driver well above the unity gain bandwidth of the op amp.I'm not going to investigate if the OPA172 will work properly because at first glance, the open loop output impedance is not defined.

author: MrAl
author_rank: Super Contributor
timestamp: May 21, 2023, 10:16:05 am
content: Hi again temp,That sounds like a very good analysis, i have to praise anyone who takes the time and effort to look at these kinds of circuits in that detail. Very good work i am impressed, and i trust you enough to believe you got it right.One other thing i did learn in the past i forgot to mention in current feedback circuits (i know this is a little different but it deals with current too) is that if the driven device is much faster than the, say, op amp, and has good compliance, the circuit usually works even without compensation. That i think is because the driver can follow the (op amp) almost perfectly and that means the op amp gets its normal feedback signals.There could be exceptions i guess, but one example is when adding a single transistor to add current feedback to a voltage regulator. The idea of course is to implement a known current limit when that is not built into the voltage regulator, especially when we want some adjustment too.A single bipolar with current sense resistor (any maybe a diode) can sense the current level and provide "OR'ed" feedback to the voltage regulator, thus implementing current limit. The transistor is so fast that the regulator probably sees it as not even being there.Just something to think about, but as i said there could be exceptions.I think that to get this to happen with a MOSFET we would need to introduce a decent gate driver too, maybe a complementary bipolar pair.Would be very interesting to see that if you feel like trying it.

author: temperance
author_rank: Super Contributor
timestamp: May 21, 2023, 03:16:38 pm
content: QuoteIsn't that exactly what I did by buffering the op amp such that the pole created by the buffer MOSFET combination is way above the unity gain frequency of the op amp. Indeed, in such case you don't need any compensation. You can add some compensation if you want to limit the slew rate. Or just take a much slower op amp.In general, this is called dominant pole compensation.QuoteNow I'm confused. I presented such a circuit here:https://www.eevblog.com/forum/beginners/constant-current-load-stability/msg4864031/#msg4864031And demonstrated a quick and dirty working circuit here:https://www.eevblog.com/forum/beginners/constant-current-load-stability/msg4865513/#msg4865513Best regards

author: MrAl
author_rank: Super Contributor
timestamp: May 21, 2023, 09:16:22 pm
content: Hi,Oh ok very good

author: johhnyboyer
author_rank: Newbie
timestamp: August 16, 2024, 11:07:11 am
content: @ temperanceQuote from: temperance on May 15, 2023, 03:15:47 pmI've looked at this quite a bit and I like it. There are a couple of things that I don't understand.a) Later on in the thread you said "the value I've chosen for R3 (by some ruff guess) seems a little high. 33R would be more appropriate"Here I assume you mean R1 and not the current sensing resistor on the low side.b) Also later on in the thread you said "R2 must be a 1..3W resistor depending on the input signal."I can't see why this 4K7 resistor can't be a plain 0603. Current shouldn't be more than 5-10mA?c) I still don't understand the purpose of the two diode sets (D1-D3 and D4-D5)Thanks!-- john

author: temperance
author_rank: Super Contributor
timestamp: August 29, 2024, 08:12:29 pm
content: a) Later on in the thread you said "the value I've chosen for R3 (by some ruff guess) seems a little high. 33R would be more appropriate"Here I assume you mean R1 and not the current sensing resistor on the low side.Seems to be a mistake. That must be R1 as you stated. This resistor sets the quiescent current in the totem pole buffer. An other option is to make the bias voltage (D1...3 adjustable)b) Also later on in the thread you said "R2 must be a 1..3W resistor depending on the input signal."I can't see why this 4K7 resistor can't be a plain 0603. Current shouldn't be more than 5-10mA?An other typo it seems. That must be R5 in the snubber network. The snubber network cancels the inductance present in the drain connection. Omitting the snubber will result in oscillations because the drain inductance forms a tuned circuit together with the MOSFET output capacitance.c) I still don't understand the purpose of the two diode sets (D1-D3 and D4-D5)D1...3: they generate a fixed bias voltage for the totem pole buffer. A more fancy version would be to replace R4 with a current source and replace the diodes with trim pot.D4...5: they allow the voltage across R2 to go below the negative saturation voltage of the op amp. They might not be required for a rail to rail output amplifier.-The input of the op amp must be able to work with voltages very close to GND.-The op amp input off-set voltage translates into a current off-set equal to Vos / Rsense-The MOSFET must be a type with a high threshold voltage because the totem pole driver keeps the gate at minimum 0.6 V. Something above 4 V will do fine. See data sheets for gate source versus drain current characteristics.-Don't use modern MOSFET's but old types like an IRFP240/250 or use something like this:https://www.littelfuse.com/products/power-semiconductors/discrete-mosfets/n-channel-linear.aspxI hope this helps to get it to work properly.