compensate an oscillating constant current load - Page 1
Forum section: electronics / beginners

author: nemail2
author_rank: Regular Contributor
timestamp: August 30, 2021, 04:22:21 pm
content: HeyI have built a basic adjustable constant current load but unfortunately I have issues with oscillation.Attached you'll find the schematics of the control loop, could someone please have mercy and try to help me with compensation of this load?Input voltage should range from 0-50V but something like 24V or even 12V would be ok as well.Settable current should range from 0-500mA.Opamp is a TI 4197 and MOSFET is a IRFP3710PBF.I can upload scope shots of the current situation if needed. But the opamp output currently goes completely haywire.I've also attached a scope shot of how the output of the opamp looks if ISET is set to 30mV (which would be 30mA at 1 Ohm shunt). Note that C18 has already been removed for testing purposes...THANKS!!!

author: magic
author_rank: Super Contributor
timestamp: August 30, 2021, 06:05:31 pm
content: The usual brute force solution is to increase C18 and/or R1 rather than remove itHow good is this opamp with capacitive load? Some opamps could go bonkers simply because of the capacitance of the FET, even with direct unity gain feedback and no exotica.BTW, you didn't shove a second opamp in the feedback path of the first, that'sBut I don't get that widespread fashion for MOSFETs in dummy loads. Particularly at low current and power, a darlington would do as well. Less capacitance, full current capability down to ~1V input. It may even have a specified SOA rating for DC, something that's rare with FETs. Yes, you get base current error, but it usually is small - less than 1%. Sometimes a single base resistor entirely suffices for compensation.

author: mikerj
author_rank: Super Contributor
timestamp: August 30, 2021, 07:45:46 pm
content: The op-amp may not be happy driving the gate capacitance of the power MOSFET. A lowish value (20R-50R) resistor between the op-amp and the gate (on the transistor side of the compensation cap) would help if this is the cause.

author: David Hess
author_rank: Super Contributor
timestamp: August 30, 2021, 08:35:59 pm
content: The OPA4197's open loop output resistance of 375 ohms into the 4000+ picofarad load of the IRFP3710 is going to cause 45 degrees of phase lag at 100 kHz which your 1k/1000pF compensation network is not going to overcome. Did you try larger values for C18 and R1?The OPA4197 may never be happy driving such a heavy capacitive load. Decoupling it using a series resistor at the gate of the power MOSFET will help but lower performance further. I would not use less than the open loop output resistance.A better solution may be to add a high current buffer to help drive the power MOSFET.

author: nemail2
author_rank: Regular Contributor
timestamp: August 30, 2021, 09:51:16 pm
content: Thanks yall!I at least "kind of" solved it by putting a 220R resistor in between C18 and the gate of the MOSFET.First I tried to increase C18, which didn't help (it actually made it worse) and then here and on another forum the advice came along to put a resistor in between C18 and the gate and as mentioned, that solved it.I chose to use a MOSFET instead of a BJT because I didn't want the voltage drop so I could go down to very low input voltage (that was one of my main goals).Quote from: David Hess on August 30, 2021, 08:35:59 pmso if I understand this correctly, I should use at least 375 Ohms between C18 and the gate of the power MOSFET? Currently there's only 220 Ohms as I mentioned and it "seems" to work for now, but of course I didn't test every possible kind of power supply and circumstance.By lowering performance you mean reducing the speed of the load, how fast it reacts? For my untrained eye it seems to be "good enough for austria" right now but just for kicks - a high current buffer would be just a classic MOSFET driver IC?Thanks again!

author: David Hess
author_rank: Super Contributor
timestamp: August 31, 2021, 01:10:56 am
content: Quote from: nemail2 on August 30, 2021, 09:51:16 pmThere is no right value, but I usually start off with adding a series resistor equal to the open loop output resistance because it can make the initial analysis easier.QuoteAdding the series resistance slows down control of the power MOSFET, but without it the output resistance plus the capacitance of the power MOSFET adds 90 degrees of phase lag to the compensation network which makes compensation extremely difficult. Adding the resistor adds some phase lead making it much easier to compensate even though it slows down control of the MOSFET. Sometimes you will see voltage dividers in feedback circuits which have a small capacitor across the top resistor; these are also adding phase lead to make compensation easier.To get higher performance, the open loop output resistance needs to be lowered so that the operational amplifier can drive the heavy capacitive load of the MOSFET easier, which means adding some sort of power buffer between the output of the operational amplifier and the power MOSFET's gate. Then the gate series resistance could be reduced to 5 or 10 ohms or perhaps be left out depending on the capabilities of the buffer.Something else which I forgot to mention is that if the operational amplifier, or buffer, is driving a heavy capacitive load, then decoupling at the supply pins becomes more important. Lack of sufficient decoupling can result in oscillation also.

author: Vovk_Z
author_rank: Super Contributor
timestamp: August 31, 2021, 02:42:16 am
content: TS may also try another MOSFET, e.g. classical IRFP260n, which is more suitable for DC mode (and possibly more stable). It has a larger DC SOA.Quote from: nemail2 on August 30, 2021, 04:22:21 pmFor such a low rated dissipated power (25W) it may be more suitable to use a TO-220 case MOSFET with lower Q and C. It'll help with stability.

author: magic
author_rank: Super Contributor
timestamp: August 31, 2021, 06:31:39 am
content: For 0.5A you need RDS(on) numerically up to twice the minimum input voltage. 25mΩ is good for pulling 0.5A from 12.5mVIf that's what you want then fair enough, although some logic level MOSFET could be better choice for 5V drive. (Or boost the supplies to 10V). Chances are that your circuit can't make full use of this FET as-is.The input capacitance figure in the datasheet is quite high at 3nF and specified at Vds=25V. Capacitance only increases with less Vds (5nF at 1V is shown further down) and with some FETs it can get really bad when Vds<Vgs.A trick I have heard about is to add some DC current load (maybe just a resistor) on the opamp's output to bias up its output stage and boost its transconductance. This is supposed to improve stability of those rail to rail outputs somewhat. Never tried itQuote from: David Hess on August 31, 2021, 01:10:56 amAnd layout. Have some ground connection from the FET's source resistor to the opamp going close to the gate drive trace.I think David didn't explicitly answer your question about gate drivers so I will: nope, classic gate drivers are ON/OFF devices for SMPS applications.

author: perieanuo
author_rank: Frequent Contributor
timestamp: August 31, 2021, 08:46:13 am
content: a little bit off topic, what's ic3d doing?you also can filter r4 with some small cap(s) like 0.1/0.01uF if you don't need speed (in fact, using digital control for regulating means you are slow already in the control loop...)good practice in shunt sensing is adding at least the 0.1u if the process is slow, you also may got interference from the environment, you may use software integration but the cap don't hurtif you don't trust me, trust ti, see ina219 datasheet for reference

author: Terry Bites
author_rank: Super Contributor
timestamp: August 31, 2021, 01:54:04 pm
content: As pointed out, a series resistor between C18 and the gate is a good idea to isolate the gate capacitance from the opamp. See this articlehttps://www.electronicsweekly.com/blogs/engineer-in-wonderland/current-sink-stability-2015-10/I built a 20A Current source a while ago. Note the additional compensation C2,R6. The values suit my purposes. Its a bit of suck it and see for the correct values, but it works wonders in my application.Current sources are great whe you want to genarate fixed current in a fixed load. Else they are tricky beasts

author: Kleinstein
author_rank: Super Contributor
timestamp: August 31, 2021, 03:38:51 pm
content: To avoid oscillation with a difficult (inductive) load, it may be a good idea to add some RC series element in parallel to the load. As a crude guess I would start with some 100 Ohms and 100 nF.The IRFP7310 may not have a suitable DC SOA . So a different MOSFET is a good idea if used for more than 40 V. The RON should be somewhat smaller than the shunt resistance, but no need to be very much smaller. The voltage drop is limited by the shunt anyway.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 31, 2021, 04:01:07 pm
content: Note that you get more phase shift with an R+C, not just a C (C18). The gate resistor also has some relevance, everything kind of works together here, it's all one big dysfunctional family around the MOSFET's nonlinearities.Mind to test with inductive and capacitive loads. A sink that's happy into 0.1uH (short leads) might not be happy into 1 or 10uH (long leads, say an inductive load through a transformer or something, Idunno). Or maybe you want to test a transformer for saturation, or a solenoid coil, and now you need stability into some ~mH too. So, it's worth trying a wide range.Remember to test at many voltages too, as that's how the MOSFET capacitance varies.Typically what helps is an R+C across the load, maybe an R+C from drain to gate as well. Or even a small amount from drain to the op-amp (which would have to be +in side, so you'd need a series resistor from ISET to +in, for the same reason R1 exists).The key being all the R+Cs have a lossy component that tends to dampen oscillation, giving more leeway for impedance variations, more phase margin, etc. So the FET's capacitance might be varying up to several nF, but it's not enough to push it into instability, just that it has more or less ringing, at whatever frequencies.BTW, note that the outputshouldring somewhat, for an inductive load; the output is probably dominant capacitive (with very high resistance, it's a CCS after all!) so it'll tend to ring following a step change. You don't need to dampen that so much (but it will likely help, i.e., an R+C across the output), just make sure it doesn't ring up on its own (negative resistance!).Likewise, check capacitive loads of various magnitudes, preferably with low-loss (film or ceramic) types, and some combinations with inductors.BTW, as far as MOSFET choice goes, I haven't seen much better than the good old 50N06 and friends (so like IRFZ46, uh BUZxx something also I think?, etc.). Or IRFP2xx and friends for higher ratings. The low-density process gives DC SOA up to fairly high voltages (even IRF740 seems to behave), and there's very little cheaper per watt. They're also available D2PAK for compact, momentary applications (I've designed a current-limiting fuse around one, 30V 10A rating with up to 7ms "fault" duration).(The IRFP3710 looks like one of those classic (HEXFET) designs, but it doesn't give DC SOA so you're kind of on your own there. The TO-247 of course gives better power density than TO-220s, which is nice.)In high voltages, FQA9N90C is hard to beat on price per watt (even compared to vintage IRFPxxx). It's a newer part, but offers full DC SOA (as many other SuperJunction type MOSFETs seem to have, and even some IGBTs, astonishingly enough!).Tim

author: nemail2
author_rank: Regular Contributor
timestamp: August 31, 2021, 11:06:02 pm
content: Quote from: David Hess on August 31, 2021, 01:10:56 amThanks for the thorough explanation, always learning from you! Would something like T2 in the schematics work as a power buffer?Quote from: Vovk_Z on August 31, 2021, 02:42:16 amGranted! Is there a way to search for DC-specified FETs in a parametric search? I'm always having issue with this task (usually looking at Mouser)...Quote from: magic on August 31, 2021, 06:31:39 amfor this specific task I wanted to be able to pull up to 500mA from 0.8V so with my shunt being 1 Ohm, the RDS(on) of my MOSFET could be up to 600 mOhms. I guess I was too lazy for the (simple) math and just went bonkers with the MOSFET. On the other hand, now it is possible to draw 500mA even from 0.5125V, which isn't too bad to be able to do either... soSadly the RDS(on) to V(gs) doesn't seem to have a chart in the datasheet of the MOSFET. I really don't get it why manufactures rarely provide this specific chart. I'd have to test whether I can really go down to 0.5125V @ 500mA, that should tell me whether the MOSFET is switching completely on, I guess..?Regarding the layout: I have attached the current layout, seems to work fine so far...Quote from: perieanuo on August 31, 2021, 08:46:13 amIC3D is just terminated because unused. Thanks for the advice regarding filtering R4, I'll look into that!Quote from: Kleinstein on August 31, 2021, 03:38:51 pmThanks, will look into RC filtering as well! Regarding the DC SOA I already mentioned. I have a hard time properly searching the parametric searches for DC SOA specified MOSFETs. Any advice would be appreciated. Regarding RDS(on) as mentioned: 1 Ohm shunt already quite limits the minimum voltage for pulling the full 500mA so I didn't want to limit that much more using a too high RDS(on)n MOSFET...Quote from: T3sl4co1l on August 31, 2021, 04:01:07 pmThanks, always learning from you as well :-) will try to test all that, although this load mainly was built for testing a small lab PSU and a battery boost converter (1.5V to 3.3V) and for that it currently seems to work fine. But I understand that inductive stuff often drives things crazyAlso: when talking about R+C (C18) and a gate resistor, would that then be an R before C18 (after the output pin of the opamp) plus a gate resistor after C18 before the gate of T1?I had this fancy, not too expensive heatsink which I wanted to utilize for this, that was the main reason why I went with this TO-247 MOSFET. Also, as you said, heat dissipation is easier with those bigger packages. I have tested it up to 12W with no airflow and it only reached around 60 °C with absolutely no airflow. That's the heatsink I'm talking about, if anyone is interested:https://www.mouser.at/ProductDetail/Ohmite/CR201-50VE?qs=EU6FO9ffTwcqprZ3FIt4RQ%3D%3D

author: nemail2
author_rank: Regular Contributor
timestamp: August 31, 2021, 11:08:41 pm
content: Also I was wondering whether the following would be good ideas:- add a pulldown resistor to the MOSFET gate so if a voltage source is connected to the input of the load while it is turned off, the gate doesn't float somewhere or do something undefined which would draw undefined amounts of current from the source? or would a relay at the output be a better choice?- what about a weak pulldown on the input of the load to negate noise which it might be picking up? like 100k or something?thanks!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 01, 2021, 05:22:46 am
content: R after C18.R in series with amp output, I mean you can but I don't think there would be any useful effect for R > 0Ω is all.Tim

author: magic
author_rank: Super Contributor
timestamp: September 01, 2021, 06:12:22 am
content: Quote from: nemail2 on August 31, 2021, 11:06:02 pmFig. 1 - typical output characteristics. Id vs Vds for a few values of Vgs on a "typical"/average part.

author: nemail2
author_rank: Regular Contributor
timestamp: September 01, 2021, 06:34:21 am
content: Quote from: magic on September 01, 2021, 06:12:22 amright but not V(gs) directly against RDS(on). IIRC some MOSFETs provide that curve in the datasheet. or at least some RDS(on) values for different V(gs) values. But I guess here it is not the case as this MOSFET seems to be meant for 10V driving in the first place...

author: magic
author_rank: Super Contributor
timestamp: September 01, 2021, 06:44:16 am
content: But why care about RDS(on)? You look at 0.3V and know that with 4.5V gate voltage the FET will likely pull several amps, which meets your spec.If you still want to know RDS(on), calculate it from the sloped part of the curve on the left. That's the region where the channel is not saturated yet and Id increases linearly with Vds due to resistance. For example, 4A at 0.2V → 50mΩ at Vgs=4.5V.editBTW, it hopefully goes without saying that you can improve low voltage operation by reducing the shunt resistor to 0.1Ω or less. The limit is precision of the opamps and resistors and how much accuracy you need.

author: nemail2
author_rank: Regular Contributor
timestamp: September 01, 2021, 07:20:12 am
content: Quote from: magic on September 01, 2021, 06:44:16 amtrue, could have thought about that myself, thanks for pointing that out (calculating RDS(on)). I'm only a hobbyist and all the formulas and rules/mathematical laws don't always come right up to my mind so sometimes I need someone putting the obvious right in front of my eyesyes, a smaller shunt would allow for low voltage operation but as I only need around 500mA @ around 0.5V to 0.8V I went for 1 Ohm so I didn't have to go crazy on DAC output voltage resolution and opamp precision. Although I didn't do any math or thorough capabilities checking. That 14 Bit quite precise DAC + the OPA4197 might be even able to work similarly well with a 0.1 Ohm shunt. Even the ADS1115 should be able to sense the voltage drop precise enough to display the measured current in 1mA resolution... might give that a shot as well!

author: Kleinstein
author_rank: Super Contributor
timestamp: September 01, 2021, 09:18:28 am
content: For the DAC it is easy to divde down the ouput voltage for a lower shunt. For the amplifier there are higher precision options than the OPAx197 and it may be worth the extra effort, if more accuracy is wanted. This is especially true for higher current as the shunt can become expensive if it has to work with higher power consumption.IT may help to use separate OPs instead of a quad chip, so one could use different OPs if needed.A point still not in the circuit is a protection again windup, when the current sink is first turned on and only later the ouput is connected. The MOSFET would be initially all the way on and it takes some time to get back into regulation. So there could be a large initial current spike.Ideally there would be something to turn off / reduce the current, when the ouput voltage gets too small. E.g. limit the setpoint to the current sink to something like a 1/2 or 2/3 of the output voltage minus a little (e.g. 10 mV) to cope with offsets. This would avoid driving the MOSFET all the way to saturation. At too low a voltage the circuit would switch over to a kind of simulated resistance (e.g. 2 times the shunt), so it would not try to reach the impossible ( < R_on + shunt).

author: Zero999
author_rank: Super Contributor
timestamp: September 01, 2021, 09:51:44 am
content: The IRFP3710 has a huge gate charge. Choose a MOSFET with as lower capacitance, as possible and is still capable of dissipating enough power. I had a quick search and the BSC22DN20NS3G seems ideal, but even the old school IRF510 is better suited to this, than the IRFP3710.https://www.infineon.com/dgdl/BSC22DN20NS3+Rev2.2.pdfhttps://www.vishay.com/docs/91015/sihf510.pdf

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 01, 2021, 10:10:13 am
content: filtering R4 is what other people said after.the unused ic should be treated like this: input pins NC or routed to gnd, the output leave it alone.IN+ pin 12 routed to something in circuit is not ok especially with pin 14 routed to something.to put it simple, test with 0.1uF parallel with R4 and post results

author: nemail2
author_rank: Regular Contributor
timestamp: September 01, 2021, 10:27:54 am
content: Quote from: Kleinstein on September 01, 2021, 09:18:28 amyou are right, I may take a look into that. even if I'm currently happy with the current capability of the load (as it is purpose-built for me), this would seem to be a nice evolution of this project and a higher current load always comes in handy.Quote from: Kleinstein on September 01, 2021, 09:18:28 amyes, I'll look into that. currently the current is only limited by the shunt while the MOSFET is completely switched on. that probably should be good enough for most cases but current spikes are not nice so I'll try to implement an appropriate solution for this.Quote from: Zero999 on September 01, 2021, 09:51:44 amunderstood, given the count of voices against my MOSFET choice, I'll look for a better one for this purpose.May I renew my question on how to quickly find MOSFETs which are suited and specified for DC operation?Quote from: perieanuo on September 01, 2021, 10:10:13 ami will test and report! may take some time, though, as I only have a few hours every day or so for playing with electronicsregarding opamp termination i tried to follow the TI technote:https://www.ti.com/lit/an/sboa204a/sboa204a.pdfas this is a single supply opamp, connecting the unusied IN+ pin to the voltage divider seemed reasonable (i wanted to spare myself an additional divider just for termination).

author: Vovk_Z
author_rank: Super Contributor
timestamp: September 01, 2021, 11:26:06 am
content: If there is a possibility I may offer to use another opamp. Possibly this one is not very stable in that particular configuration, but some other will be more calm.I used several types: LM358/LM258 (jelly bean) and several more precise: AD820, AD823. They were quite ok. Not super stable (it is impossible), but it was quite easy to silence them.I prefer not to use quadro opamps because it shortens choice a lot, so I prefer to use dual (or single) opamps.

author: David Hess
author_rank: Super Contributor
timestamp: September 01, 2021, 07:16:21 pm
content: Quote from: nemail2 on August 31, 2021, 11:06:02 pmA single transistor could be used in class-A but would require a large load current. The typical solution in the past was an integrated buffer like the LT1010 or a 4 transistor "diamond" buffer.

author: nemail2
author_rank: Regular Contributor
timestamp: September 04, 2021, 09:56:42 am
content: Before changing anything else in the circuit, I noticed that the voltage measurement through IC3C and the ADS1115 is a bit wonky if no voltage source is attached. The display of the load constantly flaps between 9mV and 13mV so I first measured the output of IC3C and found some funny business going on (see SDS00002.png).I then added a 10k resistor between pin 8 of IC3C and the base of T2 and then the base of T2 looked like SDS00003.png.After that, I added a 10nF ceramic capacitor between the base of T2 and pin 9 of IC3C and now the base of T2 looks like SDS00007.png.That 8.6 something Hz is so slow, I was even able to see it on the BM786 bar graph.Obviously I have absolutely no idea what I'm doingso if anyone has suggestions where this could be coming from and how to filter it out, I'd be gratefulThe inputs of IC3C are quiet so it seems the opamp is acting up a bit. If I apply voltage to the load's input, things smoothen out and everything is hunky dory.thanks once again!

author: magic
author_rank: Super Contributor
timestamp: September 04, 2021, 12:20:53 pm
content: What's the point of T2 if it's just some few-kΩ RC filter being driven?I think you may have a small problem here because T2 bias drops to basically zero when the output is close to ground. A CMOS rail to rail output (i.e. what's in the chip) is probably the best solution for close to ground operation.

author: nemail2
author_rank: Regular Contributor
timestamp: September 04, 2021, 02:15:55 pm
content: Quote from: magic on September 04, 2021, 12:20:53 pmwell that's a valid point. T2 is part of a protection circuit someone has come up with a while ago to not exceed the ADCs input voltage no matter what. also it helps a bit at outputting true 0V to the ADC, i think. in this case, i could leave it out as the opamp itself has only got 5V max output voltage due to its supply voltage. also the series resistor to the ADC input helps if voltage exceeds the limits (the ADS1115 has internal clamping diodes). Also it seems that I don't even need IC3C at all and could simply connect the voltage divider from the input directly to R37.so i did that an bodge-bypassed IC3C, removed T2 and R35 and now the output of the voltage divider R30/R32 is directly connected to R37. unfortunately that changed diddly-squat - display is still flapping between 9-13mV with nothing connected, but now if I connect a voltage source to the load, some offset seems to be always there, of around 5mV. IIRC there was no offset before, as soon as a voltage appeared at the input.hmmmmscratching my head, life is difficult if you have no clue what you're doing

author: Terry Bites
author_rank: Super Contributor
timestamp: September 04, 2021, 03:00:57 pm
content: I just noticed T2+IC3c configured as a follower, ditto IC3b+T11- these are notoriously unstable. So you're right to be rid of them.In between samples isn't the contol loop open? It will probably ring everytime it is opened and closed. I'd consider an analog contro loop "disciplined" by the digital loop.

author: jaycee
author_rank: Regular Contributor
timestamp: September 05, 2021, 12:07:25 am
content: I thoroughly recommend looking up Jay_Diddy_B's previous posts on electronic loads. Back when I was simulating one to build (never got around to that!) they were invaluable. Several things of note:* Add snubber networks across the output* Give the opamps a -ve rail. This helps them discharge the MOSFET gate capacitance quicker and improves bandwidth* Dont simply "slug" the opamp with a capacitor from output to -ve. Add an R-C network that improves the phase/gain response. Simulate this in SPICE using AC measurements.* Dont just use an old slow opamp like the LM324. You want well defined bandwidth.edit: Found the thread -https://www.eevblog.com/forum/projects/dynamic-electronic-load-project/

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 06, 2021, 06:51:03 am
content: maybe ti is right, it's their productbtw, M+- rails are already connected (so what they point is useless, you can't disconnect the v rails for unused opamp)putting in non-symmetric scenario 1/2V+ on IN pin i found this doubtful as principle (too many unknowns, like some pick'and place putting wrong value or bad soldering or offset problems or imprecise resistore+offest), so leaving nc the input leaves no marge for that type of errortheir scenario is good for teching imho, in real life, NC is better.maybe the connection output>>IN- is interesting to apply in one-rail supply scenarioi'll stick to NC's because if i need to 'prototype' that unused amp, i don't bother with non-useful components and tracks, some opamp with non-connected inputs/outputs will never ever fry, that's only legend. but will fry if some output or input is played withthanks for pointing their recommendation, first time i see this