Current source feedback capacitor - Page 1
Forum section: electronics / projects

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 05:03:49 pm
content: I've been having a few issues regarding oscillations on the output of op amps that are used for constant current sources. there doesn't seem to be any rhyme or reason behind it either, for the most part I've ordered the op amps and actually tested them in the exact same circuit to see if they are suitable or not, which is obviously less than ideal. there are two suggestions that are always provided: adding a resistor to the output of the op amp, and adding a capacitor between the output and the inverting input.http://tinyurl.com/yxjyktlfI have used 1k resistor (which is the max I can use in order to drive the darlington pair)and a 100nF capacitor which doesn't seem to do much.after adding both the oscillations were better but still far from good enough. I was wondering if a larger capacitor , for example 1uF would be a better choice as it passes more AC and provides a better feedback?I don't have any suitable capacitors to test right now (wrong value or wrong footprint) but I'm not sure if increasing the capacitor is a bad idea because op amps tend to have issues with driving capacitive loads. is there a way to calculate the values rather just trial and error that I'm missing out? if not, what are the general ball park values that I should test?

author: NiHaoMike
author_rank: Super Contributor
timestamp: May 16, 2019, 05:11:28 pm
content: Add a resistor between the shunt and inverting side of the opamp so that the opamp isn't trying to drive a heavily capacitive load.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 05:17:17 pm
content: Quote from: NiHaoMike on May 16, 2019, 05:11:28 pmwouldn't that defeat the purpose of the capacitor which is to provide quick feed back?Also I think this is way too many extra components to stabilize an op amp and feels like wrong design.

author: Benta
author_rank: Super Contributor
timestamp: May 16, 2019, 05:46:42 pm
content: Which opamps? Are they unity-gain stable? Decoupling (I know, but still...)? You provide far too little specific information.

author: Kalvin
author_rank: Super Contributor
timestamp: May 16, 2019, 05:54:54 pm
content: Quote from: OM222O on May 16, 2019, 05:17:17 pmNope. Replace the wire between the 1 ohm sense resistor and the 1 uF capacitor with a 10 kohm resistor (for example). Then you can also reduce the capacitor value from 1 uF down to 10 nF or less in order to speedup the control loop response.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 05:58:03 pm
content: Quote from: Benta on May 16, 2019, 05:46:42 pmTLV9002 specifically is notorious! behaves completely out of whack no matter what. Also the MCP6V01 is sometimes stable and sometimes not!on the other hand MCP6002 and the MAX4238 pretty much work fine all the time. they are all advertised as unity gain stable and have around 1MHz GBWP.the behavior is also not consistent and some values of the shunt resistor cause more oscillations than others.the question is not specific since the problem varies with seemingly similar parts (tlv9002 and mcp6002 are very similar, MCP6v01 and MAX4238 are also quiet similar). decoupling is also taken care of. as I mentioned before I'm not sure if there is a way to tell if there will be problems before purchasing the op amp. I can't make it dedicated to a specific value of shunt resistor either as I frequently use universal shunts in my designs and cover a range of 10uA to 1A using that method and I want stability across all ranges, not just one!

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 06:01:37 pm
content: Quote from: Kalvin on May 16, 2019, 05:54:54 pmthe 1ohm shunt can be as large as 100k on the smallest current range (10uA) does the ratio of the resistances matter or is the 10k that you mentioned just a part of the feedback loop and not important in value?

author: Kalvin
author_rank: Super Contributor
timestamp: May 16, 2019, 06:22:39 pm
content: Quote from: OM222O on May 16, 2019, 06:01:37 pmI would sat that the 10 kohm resistor is part of the compensation loop. You should evaluate loop's performance and stability with 100 kohm sense resistor value, too. If may turn out that you need to tweak the 10 kohm resistor value for best performance when increasing the sense resistor value.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 06:47:28 pm
content: the main goal was to avoid fiddling around with components and just trying out random valuesso far nobody has posted an equation or solution to check whether there will be loop stability problems or not. I did a bit of search but pretty much every video uses gain of the op amp which in this case is not easy to measure?

author: Benta
author_rank: Super Contributor
timestamp: May 16, 2019, 07:04:47 pm
content: Quote from: OM222O on May 16, 2019, 06:47:28 pmYour issue is really extremely odd. I've built more opamp/transistor current sources than I can count and have never had problems like this.Could you say something about the oscillations? frequency, amplitude/measuring method/probe...

author: mikerj
author_rank: Super Contributor
timestamp: May 16, 2019, 08:11:02 pm
content: Quote from: OM222O on May 16, 2019, 05:17:17 pmIt certainly isn't "too many components", I'm puzzled why you would think this? Just look at the schematic and ask yourself how much of the signal being fed back by the 1uF capacitor is actually going to make it to the op-amp inverting input when you are shunting it to ground with a 1 ohm resistor?If you are going to change that shunt resistor by 5 orders of magnitude then you have a problem since you are going to end up with a very large resistor value isolating the cap from the shunt (megohms) and a correspondingly small capacitor, making the circuit performance more dependant on parasitics.Why don't you just simulate the the circuit and look at the open loop frequency response, so you can check gain and phase margin?

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 09:45:13 pm
content: Quote from: Benta on May 16, 2019, 07:04:47 pmHere is a video using the TLV9002 which is the worst one by far:https://streamable.com/ioakxthe scope is AC coupled and it's set to 20mV/div.the 1A range was so bad that it would end up at about 700mA instead of 1A so I excluded it for this test.the ranges tested in order are: 100uA,1mA,10mA,100mA and 10uA.As you can see 100uA and 1mA are fine, 10mA has 40mV pk-pk oscillations, 100mA is fine again but 10uA has some weird triangular looking oscillationand as mentioned before 1A is excluded as it was a total failure! in the meanwhile replacing it with the MCP6002 (has the same footprint and I had a few on hand) fixed the issue all together, only the 1A range had slight oscillations, but nothing too bad! I made another board and tested the MAX4238 and MCP6V01 (again, pin compatible) and this time MCP6V01 had some issues on a few ranges and the MAX4238 was finethe problem is not consistent at all and I'm not sure what I'm doing wrong here. In the original design I didn't have a base resistor for the darlington pair, so I cut the track and bodged a 1K resistor to the TLV9002. no improvements. I then bodged a 100nF cap from the output to the inverting terminal and again, almost no change.here is the schematic if it helps:Fets are digital N channel fets and are controlled by an MCU, but on the second board which I mentioned, I just used jumper pins to eliminate any effects they could have, but the results were the same, so they can't be to blame in this case. I thought maybe buffering the 1V input is causing some sort of delay / phase shift so I tried it with only one side of the TLV9002 but it was just as bad. it really seems op amp dependent rather than whatever else is on the circuit which is very frustrating!

author: OM222O
author_rank: Frequent Contributor
timestamp: May 16, 2019, 09:48:36 pm
content: Quote from: mikerj on May 16, 2019, 08:11:02 pmI tried using ltspice but the zip folder of spice parts provided by T.I didn't want to play nicely. I'm also not sure how to simulate for the open loop frequency response? if you can guide me a bit, I might be able to do it. thanks.

author: mikerj
author_rank: Super Contributor
timestamp: May 17, 2019, 07:05:15 am
content: Linear Technology have a really useful video showing exactly how to do this step by step.

author: Benta
author_rank: Super Contributor
timestamp: May 17, 2019, 07:40:50 pm
content: After seeing your schematic, a lot of things become clear.The opamps are working correctly (anything else would have surprised me), but your circuit is not in the least doing what you think.You are doing a lot of no-nos.The simple opamp/transistor current source (which you showed in your first post) is supposed to be used with the load placed between supply and collector of the output transistor. This always works!Your circuit places the load at the emitter of the transistor (I have surmised that "Force" is your load). In series with your load, you have the current sense resistor of 1 ohm. And on top of that, you have a feedback resistor of ~200 kohms between load and sense resistor.I can hardly imagine a setup that's more prone to instability than this, adding on top that the load is an unknown.Re-design needed.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 17, 2019, 09:41:57 pm
content: Quote from: Benta on May 17, 2019, 07:40:50 pmThat is correct but the tests were carried out with the force terminals shorted together, so effectively a pcb track if you wish. Therefore it's not a load related issue. I can't place the the load between Vcc and collector because base current will not flow through it which is taken into account at the emitter. If I want to do that, I have to use a fet which can cause oscillations due to gate capacitance ... besides the load is always only purely resistive, so I can't see how placing it between collector and the shunt can cause problemsIt also doesn't explain the difference between op amp behaviours and across some ranges only. If that was causing issues, I would assume all ranges would have issues, not just 10uA,10mA and 1A?Edit: I also remembered the maximum amount of feedback resistance between the active shunt and the inverting input is only 100k, not 200 (all resistors are in parallel). this concept of universal shunt is also nothing new (Dave did a video about it) and can't be blamed in this case, since the inverting input has "infinite" impedance anyways. 100k in series with infinite is not going to cause issuesBefore suggesting re-design, consider the fact that 3 out of the 7 op amps I tested have worked without an issue on all ranges and only some exhibit weird effects. I'm more interested in knowing WHY this happens and HOW to fix it for future reference, rather than this specific implementation since different op amps have fixed this issue. Thanks

author: D Straney
author_rank: Frequent Contributor
timestamp: May 18, 2019, 03:14:16 pm
content: (Edit: fixed formatting, added more about the current sense ranging)As a EE who does a lot of analog, it pains me to see some of the misconceptions or unexplained rules of thumb going around here - hope I can clear it up to everyone's satisfactionLoad connectionFirst off, this is unrelated to the stability as of right now, but yes, in most cases (unless you have specific requirements and know what you're doing) you really should put your load from the positive supply to the collector. There's two problems with putting it in series with the emitter here:1. It cuts into your headroom available, and you'll only be able to put a very small voltage across your load. Let's say your op-amp can reliably drive to within 100 mV of the +5V rail (you seem to be using all rail-to-rail output ones, which makes sense for single-supply low-voltage). With 5V-0.1V = 4.9V on the op-amp output, let's say you drop another 0.1V across your 1K base resistor (there's calculations involved here but I'm just going with gut feel for a ballpark estimate) to put 4.9V-0.1V = 4.8V on your transistor's base. Because you're using a Darlington transistor, you now have two Vbe voltage drops, so 4.8V - 2*(about 0.7V) = 3.4V. So you can put 3.4V on the high side of your load; now since the low side of your load, the current sense resistor, is being forced to 1V by your circuit as shown, the load can have a maximum of 3.4V - 1.0V = 2.4V across it.Maybe this isn't a problem for your application and you only need 1V max across the load, but I'm just illustrating the calculations involved. On the other hand, if you put your load from +5V to collector, the high side of your load would be at 5V, and the low side of your load would be, at lowest, 1V (current sense resistor) + (about 0.7V) + (about 0.4V) (Vbe for output transistor and Vce for "pre-driver" transistor, that keeps them out of saturation) = 2.1V. The largest voltage you can now put across your load is 5V - 2.1V = 2.9V. Not a huge improvement, but the real gains come if you use a supply higher than +5V. Because you now aren't limited to what the op-amp can drive, you can put any voltage you want (up to what your transistor can take). If you use a 100V supply, you could even put 100V-2.1V = 97.9V across your load!Hopefully a diagram will explain better how I counted the voltage drops: see "voltage overhead.jpg" (for some reason the standard editing tools aren't showing up)2. The other reason not to put your load in series with the emitter is that it will appear in the feedback loop, and now has the potential to affect the stability of your op-amp more directly. I can get into the math if you ask, but as this is just a sidenote would rather not right now. If your load is going to be a fixed, known resistance then this could work out ok; however, if this is a "general-purpose" current source designed to drive all kinds of different loads, then it'll likely cause problems at some point.As for the base current adding to the sensed but not the load current: yes! That's a tradeoff which given everything else, is worth it because of points #1 and #2 above. What kind of accuracy are you looking for? The amount of base current which "sneaks in" depends on your transistor's beta though, and if the beta is high enough it really doesn't matter - this is why ballpark error calculations and keeping overall requirements in mind is important: if you have the extreme-audiophile mentality of "do the best possible even if it doesn't make a perceptible difference to my application", then you can very easily make one specification unnecessarily good at the expense of causing very real problems with other specifications which you do care about. Thedatasheetis your friend, do the numbers!In your case, the MJD6039 shows a minimum beta of 1,000 at a collector current of 1A (which gives you an output error of -0.1%), and "typical" beta of maybe 200 at 40 mA (see the plot on page 4). It's hard to tell for your 10uA range, because the plot doesn't go that low, but let's say the beta gets down to 100 at some point: that means the base current would add 1% to the sensed current, and your load current would have an error of -1%. If you're only looking for +/- 10% accuracy, then this shouldn't matter; if you're looking for better than 1%, then find a different transistor! Additionally, at the lowest range, the current through the MJD6039's internal base-to-emitter resistors may matter too: figure 12 shows a 60-ohm Vbe resistor across the output transistor, which with a conservatively-low Vbe of 0.6V, still means that resistor adds 10 mA (!) to the emitter current.That piece was important, because it showed that if even you did connect the load in series with the emitter, it seems that it shouldn't be able to put out any less than 10 mA with the transistor on, because that internal Vbe resistor will require a minimum of 10mA emitter current! If your circuit can actually put out 1 mA emitter current in real life, then what's likely happening is that the transistors aren't actually being switched on (no collector current), but the op-amp is driving the entire emitter current itself through the Darlington's Vbe resistors.The way to correct this is to pick a different transistor. Personally I'd use a Darlington made out of two individual transistors; use a high-current (maybe 2A or so) one for the "output" and a much smaller one (maybe 100 or 200 mA) for the "pre-driver". If you can get a minimum beta of, let's say, 20 out of the first and 100 out of the second, then you have a total beta of 2,000, and your emitter current will only cause a -0.05% error in your output current. Check the beta curves to make sure they don't get really low at low currents, like the huge parabola in figure 7 of the MJD6039's datasheet. I'd recommend a couple transistors, but would have to spend a lot of time picking through datasheets first!(You also could use a MOSFET, and make up for the capacitance by using a large gate resistor and making the control loop slow; however, a lot of the available switching MOSFETs aren't happy with linear operation because of the many-paralleled-mini-MOSFETs construction, and will show thermal runaway if you leave them in linear mode: seethis appnotefor more info.)StabilityNow, the main problem of stability! First, let's look at the very simplest case - a current source without the "extra components":There's a couple potential sources of instability here.1. Driving an emitter-follower (your darlington transistor is essentially an emitter-follower amplifier driving the current-sense resistor as a load) with a voltage source results in negative impedance weirdness because of all sorts ofvalid but a bit hard-to-follow math. I don't think this is an issue here though as your 1K base resistor should be (the good kind of) overkill.2. The control loop involving the op amp itself could be unstable. That's what I think is happening here.If you just have a typical inverting or non-inverting op-amp circuit which gives some voltage gain, then the stability is relatively simple - the only parts involved in the loop are the op-amp itself, and some attenuation from the feedback resistors. As long as the op-amp is unity-gain stable, then there's no problems. However, when using it as a current source here, you're adding in all kinds of extra stuff to the loop. Now instead of...Op-amp -> Feedback resistor divider...your loop looks more like this:Op-amp -> Driver transistor -> (Range selection circuitry ->) Current-sense resistorThe driver transistor piece is particularly problematic: the 1K base resistor and the transistor's base capacitances form a sort of low-pass filter, except it's more complicated than just a singe pole in the frequency response. Either way, adding extra delay to the loop causes the phase to drop faster and can easily make the loop unstable on its own. (If you're not familiar with basic control-loop frequency analysis yet, then it's worth reading up on, as it's very useful.) Also, the combination of transistor beta and current-sense resistor value change thegainof the loop; if you look at figure 2-27 of theMCP6V01 datasheet, you can see thatincreasingthe gain of the loop by 10 dB would put the loop's crossover at 5 Mhz, where the phase has already crossed -180 degrees, and you'd have an oscillator!Your range-switching circuit also adds all kinds of extra capacitances to various places because of the MOSFETs - some of these may not matter but some likely will. Even if you bypass the drain-to-source with a jumper wire, it only removes the on-resistance: the capacitances will still be there. I don't know what MOSFETs you're using, but when you're on a higher current range, the 180K||180K and minimum 100pF Cgs of Q2-2 will make a low-pass filter at 18 kHz, which I can almost guarantee will cause problems, especially in combination with the Cds of the last couple stages, and the similar low-pass filters (180 kHz and 1.8 Mhz) added by the 9K and 900-ohm resistors. See "ranging.jpg" if you're not sure what I'm talking about.The easiest way to stabilize the loop (ignoring the ranging circuit issues), as suggested before by multiple people, is to add a resistor between the current sense point, and the op-amp's inverting input - see "stable current source.jpg". The values to use aren't totally arbitrary though - thereasonthis works, is because it essentially forms a "bypass" for the loop. In the back-of-envelope approximations, capacitors are essentially open circuits at DC, and short circuits at infinite frequency, right? So let's look at the very-low-frequency case: the impedance of the capacitor is way above the impedance of the resistor, and so both components might as well not be there (resistor "disappears" because inverting input is high-impedance) - the circuit now looks like the "no compensation components" version, which regulates DC current the way you want it to. Now let's look at the very-high-frequency case: the impedance of the capacitor is now waybelowthe impedance of the resistor, and so the resistor (and the rest of the current source circuitry) might as well not be there - the capacitor is essentially creating a short back to the inverting input, and creating a unity-gain buffer, which is inherently stable. It's not acting as a well-regulated current source at this frequency, but that's ok.So what this resistor and capacitor combination are doing, is bypassing the current-feedback parts of the circuit and turning the amp into an (inherently stable) unity-gain buffer at high frequencies. Because all the instability-causing phase/gain weirdness added by the transistor, etc. is at "high frequencies" (for unknown values of "high"), if you turn the op-amp back into a pumpkin, errr, I mean, a unity-gain bufferbeforethe loop response gets weird/unstable, then it can still (a) regulate current at DC/low frequency, (b) not oscillate (be stable at high frequency).How to choose the R and C values? The frequency where the op-amp will start transitioning from current-source mode to unity-gain-buffer mode will be where the impedance of the capacitor becomes comparable to the impedance of the resistor. The formula is the same as for a low-pass filter: f = 1/(2*pi*R*C). For example, if you picked a 10K resistor and 10nF capacitor, the transition would start happening around 1.6 kHz. Choosing this frequency is a tradeoff between current-source response speed, and stability. The lower you set this frequency, the slower your current source will respond to setpoint changes, but the more stable it'll be. I'd recommend starting with something stupidly low (10K and 100 nF for 160 Hz, maybe) and making sure it's stable there before continuing. You can then try and model the loop stability in LTSpice, or just keep bumping up the phase by reducing the capacitor (by a factor of 2 each time, maybe) until it becomes unstable, and then back off to the last couple values. I'm not against a little bit of "try it and see" on challenging-to-simulate (for non-experts) circuits, as long as you understand thereasonsfor everything.Now, why does this circuit work fine for some people and not for others? And why do some op-amps work while others are unstable? For one thing, as I explained before, the external components are what create the instability, and so the exact components and component values will decide what's stable or unstable. Using a different driver transistor with lower capacitance, for example, would cause less loop delay and be less likely to make it unstable. A single transistor vs. a Darlington would also change the loop response, as would using a different base resistor, and different current sense resistors. Using an op-amp with a lower GBP would also be less likely to be unstable. There's no guarantee that two op-amps with the same GBP have the same loop response though: look at the gain and phase plots (TLV9001: figure 9, MCP6V01: figure 2-27, MCP6001: figure 2-11, MAX4238: page 5) of your different op-amps and you'll see that they have different loop characteristics. The TLV9002 in particular has a large 1.2k output impedance, which easily could affect the loop response when driving the transistor. By choosing the right resistor and cap for stability though, you should be able to use any of these op-amps.Also, remember to re-arrange your current-sense ranging so that the MOSFETs don't add a bunch of low-pass filters to your loop!This all may sound overly complicated, but hey, that's the way it is - when things seems simple in electronics it's actually just because you're sitting on top of a stack of approximations a mile high

author: OM222O
author_rank: Frequent Contributor
timestamp: May 18, 2019, 05:25:36 pm
content: Thank you so much!A few clarifications: I have since switched to the BUB941ZT which is a beefier darlington pair, but unfortunately the datasheet is even more scarce. no capacitance values, no BE resistor values, etc. also handling the heat is not an issue if I decide to go down the mosfet path since the 1A range is rarely used, and even then at very short pulse times, but I would like to stick with the current design. the collector has also been connected to the supply rail (9v battery) so I can choose a better LDO and not cause a bunch of noise on the analog circuit when the transistor turns on.The voltage requirements are also not that important in this case and the 2.4v mentioned is more than enough. This circuit is meant to create the "force" section of a milliohm meter wich can measure upto 200k or so since it was easy to add a few more resistors and get the extra range. The ADC that reads the value is the ADS1219 24 bit sigma-delta ADC with internal reference of 2.048V and if the voltage ever gets higher than that, the next value up of shunt resistor will be selected and vice versa. the ADC is accurate (not resolution!) to +-10uV and I don't want to introduce errors with the means of base current, but I can try cutting and moving a few tracks when I get the PCBs for the 3rd revisionRegarding lower ranges: there is an 8k resistor from the base to emitter in series with the 60ohm one, but I'm not sure if I'm making a mistake or not. I checked the actual current (not just voltage across shunt / shunt value) and yes, it is providing 10uA,100uA, 1mA and 10mA accurately (ignoring the oscillations) so even if the amp is directly driving that current it still works fine for my application.I have also included footprints for the extra feedback resistor and capacitor on the PCB so I can easily replace them with different values (not to mention bodge soldering isn't fun). I will aslo stick with the MAX4238 since it provides the least amount of error and is known to be stable even without extra components, but I can see why the TLV9002 and MCP6V01 failed so bad (the phase margin being so low compared to others) and again, thanks for the detailed explanation.The mosfets that I use for range switching are the cheapest dual N channel logic fets I could find that pass 1A, not much thought was put into them, but I can replace them if they are causing instability. The part number is: N3018SDI'm also going to include the full schematic and PCB layout in case it helps, please let me know if I'm doing something stupidly wrong and need to redesign.I'm also not sure how to re-arrange the ranging mosfets to avoid them adding low pass filters to the feedback loop ... I'm sorry if this sounds dumb but I can't see any other place to put them (except between the resistors and ground, which adds the RDS-on to the shunts and throws off their accuracy which means buying much more expensive fets with low RDS-on. In all implementations of the universal shunt, the fets are placed in the exact same location

author: D Straney
author_rank: Frequent Contributor
timestamp: May 19, 2019, 03:33:21 am
content: Ok, the application makes sense now! Keeping the existing configuration seems reasonable given the low voltage range needed and the nicely resistive loads being used. It's obnoxious that the Darlington's datasheet doesn't say much besides an emphatic "VERY RUGGED BIPOLAR TECHNOLOGY": I'm only about 30 but it somehow inexplicably makes me nostalgic for better-spec'ed transistors back in the 70's. What I was getting at with the internal-Vbe-resistor values, is just to be aware that the op-amp may be supplying the current directly on the lower ranges instead of the Darlington - if the amount of emitter current required to hit the setpoint and "satisfy" the op-amp creates a voltage drop across the second internal resistor that's below the second transistor's turn-on Vbe, the second transistor in the Darlington won't actually turn on and all the output current will be coming from the op-amp. That's probably ok though as the MAX4238 seems like it can drive a good deal of current, so the Darlington will just step in to help it out at some point.Good call on keeping the power vs. control supplies separate.Range switching:No, that's not dumb, it's not trivial figuring out exactly how to do the switching here. I didn't have anything better off the top of my head before or I would've said something - can see the attraction of not having to stick anything directly in series with the current sense. Here's the options I can think of:1. Keep it the same, but make the loop really, really slow. 90K and ~800pF Cgs puts a pole at 2.2 kHz, which will fuck up the loop phase around that point. If you can put that unity-gain-buffer transition frequency at maybe 100 Hz it might be ok. The limiting factor here is settling time: how long do you want to have to wait for a reading? If the loop response for the current source is mostly defined by a single pole due to the stability R and C (it's not actually, but it's not a terrible worst-case approximation), then it's nice and easy to estimate. A low-pass filter / RC circuit is also just a single-pole system, and in the time-domain it has an exponential approach to its final value: Vout = Vin*(1-e^(-t/RC)). By calculating different values of e^(-x) you can see how many "RC time constants" you need to wait to get within a certain percentage of the final value. For example, e^(-4.6) = 0.01, showing that 4.6 time constants gets you to 1% error. If you're aiming for 0.01% error, then 7 time constants will get you there. If the current source should be able to settle to that precision in, let's say, 100 ms, then that means you can make RC = 0.014, which means the transition-to-unity-gain-buffer frequency could be as low as 11 Hz (because 1/(2*pi*0.014) = 11.1). So in a vague ballpark sense, if you put that RC frequency at 100 Hz, it may be reliably stable, and should settle to 0.01% within about 10 ms or less.2. If you need faster current source settling times than what approach #1 can give you, use higher-resistance/lower-capacitance MOSFETs for the ranges < 1A. The 22 mOhm MOSFET is good to use for the 1A range, but you could use higher-resistance/lower-capacitance MOSFET for the lower ranges: the lowest range is where the capacitance matters the most, because it has larger resistance (the two parallel 180K resistors) in series with it. Ciss is the parameter to watch here: that's the combination of Cgs and Cgd (and Cgd is usually much smaller than Cgs) - don't trust the electrical characteristics table, because different MOSFETs are specified at all kinds of different drain voltages, which makes the non-linear capacitances vary: look at a plot like Figure 10 for the DMN3018 and see what the 1V Ciss is.3. You could use two sets of MOSFETs: one set (low-resistance, high-capacitance) to select the shunt for the current flow, and another set (high-resistance, low-capacitance) to select the shunt to sense from. This is probably unnecessarily complex though, given that approaches #1 (and #2 if necessary) seem pretty reasonable.Other misc. thoughts:* I have to admit I don't entirely understand why what seems to be the ADC's "current sense" differential input (AIN2, 3) is sensing between 1.024V and shunt+, instead of between shunt+ and gnd?* To be honest, there's a good chance the final reading probably isn't going to give an effective 24 bits of resolution due to the accuracy of your shunt resistors and probably various other things (input impedances of the ADC, temperature coefficients of resistors/ADC's voltage reference/copper traces, noise on the supply lines, maybe internal reference tolerance without special calibration step, etc.). It sounds like cost is (understandably) one of your concerns, so I'd bet you wouldn't lose any actual accuracy by using a 16-bit ADC instead: the ADC itself may lose a bit or two to various forms of error, but even so you'll still be getting a resolution of < 0.01%, which is probably better than the initial tolerance + thermal drift of the current sense resistors you're usingThe guys in the metrology section would have better advice about this than me.* Be generous with the decoupling caps; unless the datasheet specifically recommends a single one, on the ADC I'd put one each of those 100nF's on both DVDD and AVDD, and probably one of the 1uF's on each as well. This is where things get into a bit of the "black magic" territory, and it's better to have overkill but no problems, than have hard-to-track-down problems later caused by subtle supply voltage interaction effects. The ADC is the part where noise is going to matter the most (digital supply noise causing noise in the analog section and distorting your readings), so I'd worry about it much more than the microcontroller, for example. Also worth putting a 0-ohm 0805 resistor in series with both AVDD and DVDD, between the decoupling caps and the common +5V - this will leave you the option of adding a resistor or ferrite bead later for noise suppression if necessary.* For the battery input, you can make it pretty robust by adding a series diode (to prevent reverse-polarity problems when somebody touches the terminals backwards by mistake) and fuse. I'd also put either a "good-sized" (maybe 100uF) aluminum or tantalum cap after the switch, just going by gut feel here - this helps in two ways: (1) keeps the +9V supply from sagging too much when the current source turns on at its full range, due to the battery's internal resistance, (2) the "high" (few ohms) ESR of this capacitor will damp any resonances due to stray inductance in the battery leads, etc. when the switch turns on. The low ESR of ceramics is great for supply decoupling, but it also means that if you add some inductance and apply a voltage step, you can get some nice large ringing as well (can over-voltage regulators, etc. if not careful).For choosing a capacitor value to hold up the battery voltage during a 1A pulse, you can do a worst-case calculation: since I=C dV/dt, dV = I*dt/C, and if you assume the battery is supplyingnoneof the current during the pulse and it'sallcoming from the capacitor (which is why it's a worst-case!) then you can pick a capacitor value that gives you a minimal voltage sag (<= 1V?) for a 1A pulse of whatever length you use.

author: OM222O
author_rank: Frequent Contributor
timestamp: May 19, 2019, 02:21:43 pm
content: The absolute fastest response is not important in this case and I will order a few different fets instead of the DMN3018 with lower capacitance and reasonable resistance (I think FDS6930B would be a suitable replacement). just in case that makes a big difference. As you mentioned using a 10k resistor and 100nF for the feedback of the unity gain buffer, the frequency will be about 160Hz which is pretty good.Approach #2 also seems reasonable but it will increase production time (I'll be making them by hand) significantly as well as reducing the volume discount of DMN3018sI might try it later but it's not a priority. using different mosfets for shunt selection vs feedback requires a lot more space on the PCB than I currently haveRegarding the ADC connections, I can get single ended readings of any nodes, and it was important to me to know the 1.024V output since it has a 1mV initial tolerance but low drift. I also need to monitor shunt+ to detect when the load is present (since I want the device to be mostly automatic). the 10uA range is always on and if a load is connected, the differential reading between the shunt+ and 1.024 drops to almost 0 which is a neat way of detecting load without wasting a bunch of battery.About the ADC: I searched for 16 bit ADCs first and the cheapest was the ADS1115. then I said: oh well, let's just see what the 24 bit ADCs go for. the price difference between ADS1219 (24 bit) and ADS1115(16 bit) was less than 0.5$, even less so in volume! so that was a no brainer for me. the added precision is really nice at such a small difference. The resistors are quiet expensive too, the cheapest one is 0.14$ in volume. I only cheaped out where it didn't affect accuracy since I hate it when chinese take a good concept and cheap out so much that the final product is not worth it at all. I've included the BOM so far in case you're interested in the exact parts used.Also surprisingly I have had no issues with the ADC (after destroying 5 of them that is) and they work surprisingly well! especially with the RC filter in place which takes care of high frequency noise and the ADC being sigma delta which takes care of the rest of the noise. I will check the VDDs with a scope to see if there are any weird droops / noise sources but I doubt I'll find anything. the board is also really small and each chip has at least a 100nF decoupling cap, which will help out with that issue. the MCU is also put into deep sleep (even the clock is stopped!) while taking ADC readings and the data ready pin wakes up the MCU after the conversion to take the result. I'm not sure how many samples I'll be taking but there will be an averaging too.I'm actually planning on making the power button a soft power (add a pull down resistor to the EN pin of the LDO and connected the Vin directly to VBAT) depending on the quiescent current. I will leave a 1206 footprint so I can add a 47u tantalum (just something I have on hand) and see how it goes.Edit: I forgot to mention that I'm not using an external oscillator for the MCU clock either. I tried my best to have no noise sources while taking ADC readings.

author: D Straney
author_rank: Frequent Contributor
timestamp: May 20, 2019, 04:42:26 pm
content: Yeah if you're not looking for a super-fast settling time then might as well get the volume discount and go for approach #1 there. Makes sense with the inputs, the dual-1nF-capacitor on the two inputs threw me off, looked like a differential thing.Seems like a good way to autorange: the way you phrased that though, I've got to check, are you using the ADC's shunt+ reading for the actual resistance calculation? If you are, then awesome, ignore the rest of this paragraph! If you're not, then you can give a nice bump to your accuracy by not trusting the current source to be perfect: if you do resistance=(measured voltage)/(ideal current), then all the errors of the current source (op-amp offset and drift, input bias*10K, etc.) will show up in your measurement. On the other hand, if you measure the exact voltage coming off the current shunt, then the current source accuracy doesn't really matter as it only has to be somewhere around the right value, and the only remaining errors will be from the shunt resistor(s) themselves and the ADC.Ooh, nice trick on shutting down the uC's clock during the conversion. Glad you've got the uC digital noise taken care of, but the other possible source of analog noise is from the ADC's own digital section, which will still be doing things during the conversion: especially because while you can reduce uncorrelated white noise by averaging, averaging won't get rid of noise caused by things like spikes on AVDD at certain parts of the conversion process. Probing VDD seems like a good idea, but just for the future I'd at least personally add some extra caps there just as cheap insuranceMay not actually be necessary, but easier than proving that they're not necessary.I'm surprised the price difference was so small, but hey, if you can spare the extra $0.5 and want to, then go for it! However there is a difference between added resolution and added accuracy. Not trying to be a dick here, just don't want you to have any illusions about suddenly having an 8-digit meter on your handsIf you've done all the accuracy calculations already then skip this paragraph too, just laying it out in case you haven't yet. Looking at your BOM (thanks for sharing), it's easy to do some sample calculations with the resistors (which seem like exactly the right kind to use for this, by the way):1A range: 1% initial tolerance, although this can be calibrated out, but what about thermal drift? +/- 10C is a reasonable swing even if you're using this at room temperature, plus maybe another 5C for heating during the pulse (at full load) and 50 ppm/K -> +0.075%, -0.05% rangeOther ranges: 0.1% initial tolerance, and as these are 25 ppm/K parts the range due to estimated thermal drift is now about +0.038%, - 0.025%The ADC's input bias current (+/- 5nA) will create a +/- 0.5mV offset with the 100K source impedance into shunt+ (0.05% of full-scale, 0.5% at the very bottom of the range). Its 10 pA/K drift will create an 0.01% offset worst-case (at the very bottom of the range, again).Other sources of fixed error are ADC's gain error (+/- 0.01%), and the voltage reference initial tolerance (+/-0.15%). For non-calibrate-able error there's also the ADC's internal reference 110 ppm (0.01%) long-term drift. I'm leaving out the ADC's internal reference drift (because it's tiny near 25C), the ADC's gain error drift, and the ADC's input offset because those end up being way smaller than the other errors.Overall, it looks like you can get worst-case initial error of +/- 1.2-1.7% (1A range) or 0.26-0.76% (other ranges), and non-constant errors of +/- 0.1% (1A range) or 0.06% (other ranges).A 47uF tantalum sounds good for the power, and I'd stress again the usefulness of a series diode and small fuse (although by increasing the source impedance of the battery you may also want to bulk up the tantalum's value at that point). Having reverse-polarity protection on all my power inputs has saved me tons of times from my own stupidity, and if you're putting them out into the wild with other people then who knows what they'll do with it. On the subject of protection, it could also be worth putting some 1K series resistors between sense+ and sense- and the ADC inputs; in case of external ESD / somebody sticking a charged cap into it by mistake / etc. it'll at least limit the current through the ADC's input protection diodes a lot and give it a much better chance of surviving. The error added by the bias current through those resistors will be infinitesimal compared to the other errors calculated above.Also one more thing: some vias at the gnd side of R3 could help - for the 1A range, it'll help spread the high return current to the battery across both the gnd planes, and keep that extra gnd resistance from affecting your measurement as much. Although if you're careful about where the battery- connection is and reserve the bottom gnd plane for signals only (by making the only bottom-to-top gnd plane connection at R3's gnd side), it could also have the effect of making a Kelvin sense for your current shunt to the ADC. I haven't done the numbers and so don't know if the effect is actually significant or not, but if you're aiming for some serious precision, then copper has an absolutely awful temperature coefficient!Anyways, apologies for the wall of text, this is what happens when I'm waiting for an annoyingly-long test to run at work and need to keep the brain active somehow...

author: OM222O
author_rank: Frequent Contributor
timestamp: May 20, 2019, 08:22:00 pm
content: I will add an extra 1uF capacitor to the ADC supply rail and test to see if it reduces the noise or notI am also taking into account the inaccuracies of the 1.024V reference and don't assume a perfect current sourceI know I will not be getting 400nV accuracy like the datasheet advertises but based on test results from version 2, the 10uV digit was absolutely solid (no jumps / noise) and I went based on that as my accuracy, but the results were much better than thatI think the absolute amount of uncertainty was about +-2uV (almost an order of magnitude better).Regarding the ADC inputs: the mux is extremely felixable! it can do 4 single channels or 2 differential channels (only between pins 0 & 1 or 2 & 3 or 1 & 2) which is fantastic. It also doesn't make much difference if I take a differential reading or single ended for the load detection: If I take a single ended reading of shunt+ I should compare and see if it's above lets say 1V. If I take a differential reading between shunt+ and 1.024V then I should check to see if it's less than again lets say 24mVThe ADC inputs are all protected via 1k resistors (RN1 & RN2), then they have a 1nF X2Y (feed through) capacitor which suppresses noise to ground and a 100nF capacitor which suppresses differential noise (both are C0G caps and the X2Y is capacitance matched) although I screwed up the resistor network purchase and there is no matching (they are 1% tolerance) but I didn't have issues with differential noise in the few prototypes I have made and I really don't want to re order 250 resistors if they're not causing issuesFor the reverse polarity I actually plan on using a P-Channel fet (DMP3099L-7 ) since I also have a bunch of them ordered from V2 (it was used as soft power but the new LDO already has that option) which means I can re-use the same parts and it also adds battery life since there isn't a 0.7V diode drop. win-win if you ask meThe error calculations were very helpful since I didn't bother with them and wanted to do a check after I was happy with the general design (first version was awful! version 2 was better but still had some issues. V3 is almost there but I can still see a few issues with it) so thank you for doing them. it at least confirms I'm on the right track and not totally off! for the resistors I honestly couldn't get anything better unless approaching insane territory (>1$ per resistor) which would obviously blow the budget so I'm happy with these. I would have liked a better 1ohm resistor however they only come in massive packages since I chose a high power rating, >2W to be exact to give some margin, I don't like to run a 1W resistor at 1W, even if it's a pulsed load) and they are less optimized for tempco / absolute tolerance. I can calibrate out the constant errors using a milliohm meter (funny how it's always so much easier if you had one of the things you were making, to help you with making it) which I don't have. maybe someone can calibrate one unit for me and I'll be able to use that for the rest, but that will have to wait for later.the grounds will be heavily stitched with vias all around the edges of the board (not present in the pictures I uploaded since they are the last step and I'm still refining the PCB design). the screw holes also use vias (I will enlarge them a bit more) and are connected to ground which will further help with grounding.I really appreciate the time you put into these posts and it feels nice to have confirmation that I'm not doing things totally wrong from an experienced engineer. Best of luck with the tests and I hope you have more of themthat way I will be able to get more valuable information

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 21, 2019, 05:23:03 am
content: Hi,I have had a look at this circuit in LTspice.First I have to make a model of the Darlington transistor. Since the internal base emitter resistors are unknown, I have to guess the values and measure the current gain until the curve matches.This is close enough to analyze the full circuit.I have substituted MOSFETs that are in the supplied LTspice library.I should get collector of 1mA in this configuration, but the collector current is only 437uA.The reason is that you need about 0.5mA of base current to turn on the Darlington.I have attached the LTspice model.Check this thread for stabilizing a current sink:https://www.eevblog.com/forum/projects/dynamic-electronic-load-project/Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 21, 2019, 06:50:32 am
content: Thank you Jay_Diddy_B but you had 2 major errors:1) not all the current comes from V1some of it comes from the base of the darlington pair which is exactly load is placed at emitter, not collector (please read the previous posts)2) the LT1013 is not even remotely similar to the op amps I was using, i.e: chopper and rail to railif you probe at the 1ohm shunt resistor, 1mA is flowing through it:Also the fets don't seem to be logic level. I don't think this simulation is valid but gives me a good starting point. again thanks for the effort!Also I'm not sure what V4 does in this case, can you please explain a bit in more details?

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 21, 2019, 10:18:05 am
content: Hi,It was not clear where the load was. (It is case of a picture or schematic is worth a 1000 words).The current that is regulated is the emitter current of the Darlington transistor.The op-amp can be replaced by a zero-drift op-amp like the LTC2050. This is a RRIO chopper stabilized part with 3 MHz of GBW.The op-amp characteristics should not show up in the circuit performance. C1 and R8 set the position of the dominant pole.It doesn't matter that the Si4412DY have a higher Gate threshold voltage. I am driving them 5V. They should be fully enhanced. I get representative capacitors without having to resort to third party models.AC analysisVoltage source V4 is used to measure the control loop gain. You plot V(b)/V(a) to get the Bode plot.(Try changing R8 or C1)You can use this to measure the phase margin.I have attached revised LTspice models.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 21, 2019, 03:02:33 pm
content: I tried it and even without R8 and C1 it never passes -180 degrees which I assume is the point at which the op amp starts to oscillate?worst case was about -165 degrees at about 13MHzbut with the suggested values of 10k and 100nF it seems to never go below 80 degrees:My intention is to also eliminate the op amp characteristics should not show up but I'm not sure if there is a way around the phase margin of the amp?I'm not sure how to interpret the graphs but I assume if at any point the phase is lower than phase margin of the op amp I will have oscillations and the components add a pole to gain back some phase?

author: D Straney
author_rank: Frequent Contributor
timestamp: May 21, 2019, 06:23:01 pm
content: Good loop analysis going on here.Quote from: OM222O on May 20, 2019, 08:22:00 pmOops yeah my mistake, I completely missed that resistor network somehow. Wouldn't worry about matching, even if one is +1% with +5 nA and the other is -1% with -5 nA, the error is still only 0.1 uV.Quote from: OM222O on May 20, 2019, 08:22:00 pmGreat, even better!Quote from: OM222O on May 20, 2019, 08:22:00 pmYeah I'd agree on all of that: the parts you have seem like the right choice for what you're doing - going an order of magnitude better in accuracy would need a whole next level of complexity and cost in parts (plus calibration!).Quote from: OM222O on May 20, 2019, 08:22:00 pmHa, glad to hear it. No more long tests for the moment, unluckily / luckily, but sounds like it's all going well and the design's solid! Just one last note, on the stability: what you're trying to avoid is not the phase dropping below the phase margin of the op-amp (that's more of a "derived" parameter, when using the op-amp closed-loop with a gain of +1 I think), but instead you're trying to keep the loop's phase from getting too close to 0 degrees (around the whole loop) or 180 degrees (ignoring the negative feedback). This article probably explains better, although you can ignore the "Limitations" section for the first pass:https://en.wikipedia.org/wiki/Barkhausen_stability_criterion

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 22, 2019, 12:53:38 am
content: Hi,I have modified the model a little so that it will step through the four current ranges and produce a Bode plot for each range.I have attached the LTspice model.For this opamp these values of C1 and R8 are pretty good.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 22, 2019, 01:37:44 am
content: I tried running the simulation with all 6 ranges and the spice model of max4238 which I got from maxim website. with a capacitor value of 1nF the test would not get past run 1 and would be stuck on run 2!I increased the capacitor to 100nF and it finished very quickly. I'm not sure what that means.does taking way too long to finish a run mean an error in the circuit?I also tried increasing the points per decade to 1000 and the frequency range to 100Meg and the test again got stuck for a long time and I canceled it. I'm not sure if I'm doing something wronganyways, here is the result I received:I'm still not sure what should I look for on this graph? in the AC analysis what is the indication of oscillations? a phase of 180 degrees? what is the frequency range that I have to simulate over?The schematic and maxim file is attached.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 22, 2019, 10:30:12 am
content: Hi OM2220 and the group,First the V4, injection source should be moved to the output of the opamp:The requirement for a low impedance on one side and a high impedance on the other side was not met when the value of the current sense resistor is high.If I do this:I have replaced the opamp with an ideal opamp, gain 120dB, infinite GBW.I get these results:If I take the idealization further and replace all the parts with idealized models I have:The results I get are:This can be useful to see how the real components impact the loop response.I have attached the LTspice models.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 22, 2019, 10:49:37 am
content: That fixed the simulation problems but the main point still remains:I have no idea what these numbers mean, which defeats the purpose of the simulationWhat are we looking for here? what is the frequency range to simulate over (i.e: why only 10Hz to 1Meg, not 1GHz for example?)What does V(b)/V(a) show? aren't we just adding an AC source to the output of the op amp?a small explanation as to what this all means would be very very helpful since regardless of how much I searched, this makes little sense to me. thanks!

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 22, 2019, 01:25:23 pm
content: Quote from: OM222O on May 22, 2019, 10:49:37 amLet me take a much simpler circuit:This is an non-inverting amplifier with a gain of 2.I have added a disturbance source V3. The op-amp will try an maintain the output at 2V, 2x the voltage on the +ve input.If I look at the signals V(a) and V(b) with respect to ground I see:That most of the disturbance signal appears on V(b), it is trying to reject the disturbance.There is a very small amount of the disturbance on V(a).If the opamp had unity gain, equal amounts of the disturbance will appear on V(a) and v(b).Note that the phase shift between v(a) and v(b) is 90 degrees.The gain is the amplitude of the at v(b) divided by the amplitude of the signal at v(a). Hence the expression:Gain = v(b)/v(a)This is a single frequency measurement take in the time domain.If I move to the frequency domain, I make this measurement at many frequencies:This is loop gain.Since it is the 'loop' gain it can be measured at several place in the loop.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 22, 2019, 04:33:08 pm
content: This makes a lot more sense now! so if I plot and for each range I look at the point where the gain is 0db (i.e gain = 1) and the phase margin is not near -180 degrees, then my circuit is fine, but if it is near or below -180 degrees at that point, then the circuit oscillates. correct?

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 23, 2019, 03:01:48 am
content: Quote from: OM222O on May 22, 2019, 04:33:08 pmYes.As shown in the examples above the phase axis is phase margin. You should have a phase margin greater than 45 degrees when the gain is 0dB.Gain margin is the negative gain (attenuation) when the phase margin is 0 degrees. It should be -6db or more attenuation.If you have a single dominant pole both of these conditions are met.In the example I gave the dominant pole comes from the opamp.The opamp gain phase response is given in the datasheet:The gain is -4dB at 1MHz.The simple circuit, in my previous message, measures -9dB at 1 MHz. The divider, R1 and R2 provides -6dB of loop gain.There is a 1dB difference between the model and the datasheet.If I introduce capacitor C1:There is now a pole at the frequencyF = 1/(2 x pi x (R1 in parallel R2) x C1)= 31.8 kHzIf I measure the response:I get -6dB at 31.8kHz, 0db because the RC filter is at 31.8kHz and -6dB from the divider for a total of -6dB.In this case the circuit behavior is determined by the passive parts, not the opamp.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 23, 2019, 05:22:13 am
content: I ran the analysis with the final values of the components and I'm pretty happy with the results (phase is about 94 degrees on most ranges and about 80 degrees on the 10uA / 6th range)also attenuation is better than -46db when the phase is at 0 degrees (I was not aware of the -6db rule / gain margin before). Again the schematic and the maxim part are attached. can you double check the results so I can be sure I haven't made a bone head mistake somewhere?Thank you!

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 24, 2019, 04:38:29 am
content: Hi OM2220 and the group,I have been thinking about the differences between the idealized model and the full model. I have arrived at the following conclusions:Ideal ModelThe loop gain has a large variation depending on the current range. This is not desirable.Darlington Transistor GainThe current gain of the Darlington Transistor falls with lower currents:In this applications, this reduction in gain at low currents helps.If I reintroduce the Darlington transistor and measure the loop response I get:You can see how the gain is compressed at low current by the Darlington transistor.To be continued ….Regards,Jay_Diddy_B

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 24, 2019, 04:49:31 am
content: OpampIf I reintroduce the opamp. I am using the LTC2050 that is included with the LTspice library:The LTC2050 is sufficient close to an ideal opamp in this application that it does not have any impact in the loop gain.To be continued …Regards,Jay_Diddy_B

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 24, 2019, 05:06:12 am
content: MOSFET SwitchesOnly the MOSFET switches are left.When the MOSFET switches are off, the parasitic component is dominated by Coss. Coss is the output capacitance:If I build a simple AC model to explore Coss I get:This is a single pole at 1kHz.C= 1/(2 x pi x F x R)C= 1.6nFCoss = 1.6nFThis matches the Coss from the Si4412DY datasheet:To be continued …Regards,Jay_Diddy_B

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 24, 2019, 05:22:03 am
content: CossIf I replace the ideal switches with a short or capacitor on the 1A range I get this:This is a major deviation from the ideal result. The Coss has a large impact on the loop gain.I have only added the Coss for the low current switch. If I add all the capacitors I get:There is very little difference.ObservationThe Coss of the MOSFETs on the low current range is the most important.To be continued ...Regards,Jay_Diddy_B

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: May 24, 2019, 05:43:32 am
content: Smaller MOSFETIf I select small MOSFETs, higher RDSon, but smaller Cosson the lower current ranges I can get better performance from the circuit.The Coss of the 2N7002 MOSFET is 100pFIf I use these MOSFETs for the lower current ranges, I get:This is a good result. The circuit is very well behaved on all the current ranges.I have attached the LTspice model.Regards,Jay_Diddy_B

author: OM222O
author_rank: Frequent Contributor
timestamp: May 24, 2019, 05:17:48 pm
content: the element by element analysis was extremely useful!From now on I don't think I'll have any issues with my designs since I learned a lot from this thread!Thank you all for explaining it in such details and saving my butt!