yet another constant current load Q - Page 1
Forum section: electronics / beginners

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 12:13:38 am
content: hi EEVbloggers,I'm an electronics noob, and I've spent 35 years writing software for a living, and I'd like to learn how the physical parts work.I have been playing with a variation of Dave's classic opamp+MOSFET based constant current design, and I'm stuck. I've attached a schematic.I'm using a DAC (which for now is just a controllable 0-5v voltage source) through a voltage divider to put 0-0.5v into the first opamp + input, buffering it to the second + input. I've confirmed that the buffer outputs 0-0.5v.The second opamp's output is attached to the MOSFET gate, and the -input attaches to the source, which goes through a 0.1R to GND. Vin is the power supply I (someday) will test.Q1: I note that the second opamp's output (at 7 in the schematic) is always at 4v when the +5v is on the opamp's V_{s+}. It doesn't vary no matter what I put on that input (at 5 in the schematic). That doesn't seem right to me.Q2: I know that the opamp will try to keep the + and - inputs at the same voltage. However, it's not very close. I'm measuring the expected 1/10th of the DAC at (5), but a constant 4.5-5.5mV at (6).I wonder if these issues are related? From my very limited understanding of opamps, I get that acting as a comparator, if + > - (which it is), then the output should be high, if the opamp is acting as a comparator. What do I need to do to make the opamp use the negative feedback?There are of course a zillion improvements I'm looking forward to making to this circuit, and I'm actively reviewing the various forum threads here and youtube videos. Pointers are welcome.thx in advance -- wylbur.

author: rdl
author_rank: Super Contributor
timestamp: May 22, 2020, 12:24:03 am
content: Do you have an oscilloscope? If not, making this circuit work will be a good excuse to buy one.

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 12:43:08 am
content: LOL @ excuse. I totally need excuses to buy more tools. Anyone know the Byrnes precision table saw?https://www.byrnesmodelmachines.com/tablesaw.htmlDo want.Anyway, yes, I have a Rigol DS1054Z. Where in the circuit should I attach it? I'm having a lot of fun with lxi-tools to get oscope screenshots from my computer, so please provide excuses-- wylbur.

author: MarkF
author_rank: Super Contributor
timestamp: May 22, 2020, 01:22:19 am
content: QuoteDo you have a load attached & powered at VIN?You will find that the op-amp will drive VGateof the MOSFET to the maximum voltage the op-amp is capable of in that case. Mainly due to the fact that with no current thru the sense resistor, the op-amp keeps driving the VGatehigher and higher trying to match the voltage across RSense. I added a 1KΩ to always have a trivial current thru RSensewhich at least allows you to turn the current setting OFF. This is a hack in lieu of something more elaborate.Also since you will be operating the MOSFET in its linear range, the voltage applied to the Gate is not going to vary much. Check the graphs in the datasheet for your MOSFET.QuoteFor this circuit, think of the op-amp as trying to keep the voltage across RSenseat the same voltage applied to the (+) terminal of the op-amp. This allows you to determine the value of the RSensebecause you will know the maximum current you want for your load and you know the maximum voltage you will apply to the (+) terminal of the op-amp.In my eLoad, I wanted a maximum load current of 2.5A and with a 0V to 5V control range and 10:1 voltage divider. This gave me RSense= V / I = 500mV / 2.5A = 200mΩ.The output voltage of the op-amp is not very interesting in this case. It will basically keep the MOSFET in its linear operating range during normal operation. With the exception of the answer to Q1 above in which the op-amp output will peak without a load applied.Here is my eLoad with the minimal required components highlighted in red.

author: MarkF
author_rank: Super Contributor
timestamp: May 22, 2020, 01:30:12 am
content: Also, I would recommend you power the op-amps with 12V instead of 5V.5V hardly gives the op-amp enough voltage range to drive the MOSFET.Check the how close the op-amp output can get to its power rail.You will be operating almost (if not at) its maximum output voltage.Beside, you WILL need a fan and heatsink unless you operate a very low current levels.

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 01:47:32 am
content: hi MarkF, I think I have been reading your replies on a similar question in a thread from a month or so ago. IIRC I got the idea for the IRFP250 from you. Thanks for the info! The TLC272 looks a little better than the LM358, that might be a next step for me. To your notes:Quoteyes, I've put my variable power supply on LOAD+ and have tested from 1-29v. Will build with the 1K resistor to Vinas you suggest.On the MOSFET data sheet, the relevant linear area is in the VDSgraphs in the leftmost region before they go flat, right? That seems like a very small voltage variation, and I haven't grokked why changing the input voltage from a DAC or something creates so much change in the resistance. For the IRFP250, all the variation seems like it's between 0-0.5v.I am guessing that's why we scale the voltage down? But then I get lost again: the control voltage is applied to the gate, but this difference is drain-to-source? What's that mean?Re 12v: roger, wilco. More info after I've built to your schematic. thx! -- wylbur.

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 03:53:37 am
content: Ok! That's much, much more fun.I followed your schematic with minor exceptions (I swapped your 620/5.6K dividers for 1K/10K bc that's what I have on hand). The circuit behaves as expected now. With the fan+heatsink I have, it's reasonably temperature-stable to about 20W, but at 25W across the load (source?) it starts getting pretty warm. I'll need a bigger heatsink bc I'd like this to work to 25W.I watched the gate and the sense lines w the oscope, and found that they both jitter around a central point at frequencies from 6-800kHz to in some current loads 6MHz. Their amplitudes are different (the gate jitters +-100mV while the sense line jitters +-50mV). I'm guessing that's the opamp doing its thing, right? Increasing and decreasing the voltage at the gate in order to try to keep the sense voltage on -in even with the input on +in. Image attached.Another question: I note that when there's 12v to the circuit and voltage on LOAD+ but 0v on the DAC, there's still a small draw, around 45mA. There's still 4.03v on the opamp's output (which becomes about 5mV on the sense/- input). I'm guessing that output means that the opamp still thinks that +input > -input?I could build a control circuit to force the gate voltage to 0, but that seems like a hack. Is there an elegant way to push the draw down further?I've got a bunch of data which I'll play with now. This is great! Thanks very much. I hope to hear lots about additional hacks, improvements, or warnings.Also: as you warned, I definitely need a bigger heatsink. At about 23-24W, the temperature on the heatsink starts to climb really quickly, it was 50C when I stopped testing. The heatsink I've got now is just a chunk of aluminum I salvaged from a seriously crappy TackLife power supply, the bottom of the Amazon barrel, which lasted <6 mos of fairly light use. A better piece of aluminum is coming next.yay! thanks very much -- wylbur.

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 04:00:28 am
content: sheesh, nvm: I just re-read and figured out the 1K resistor from the source to GND. Yep. That makes 0v control == 0A on the load.thx again -- wylbur.

author: MarkF
author_rank: Super Contributor
timestamp: May 22, 2020, 12:16:51 pm
content: A few comments:We scale the voltage (i.e. the 10:1 voltage divider) to reduce the voltage across RSense.Let's look at two cases for a load current of 2.5A:Op-amp (+) input max = Voltage across RSense= 500mVRequired RSense= 200mΩPower dissipation of RSense= 200mΩ * 2.5A2= 1.25WOp-amp (+) input max = Voltage across RSense= 5VRequired RSense= 2ΩPower dissipation of RSense= 2Ω * 2.5A2= 12.5WRegarding the voltage divider resistor choices:I re-used the same values in the voltage divider at the op-amp output and feedback.These values are on the high side to protect the op-amp somewhat in case the MOSFET fails.Most circuits you find will have 100Ω on the gate and 1KΩ in the feedback.My circuit came from Peter Oakes in which his load totally melted down when his MOSFET failed.I tried to limit the extend of a failure by limiting the current back into the op-amp. Not ideal.The scope screen capture looks more like noise on the power rails due to your micro-controller.Try putting a small capacitor (1nF or 10nF) on the (+) op-amp input.Note, this capacitor will limit the frequency of any signal you wish to generate with the DAC.I used aRA-T2X-64E heatsink. Same one Dave used in his load.Andthis fan. However, they are pretty noisy.If you're going to use a micro-controller, you might consider feedback to it for monitoring.https://www.eevblog.com/forum/projects/my-electronic-load/msg3021102/#msg3021102Some other resources:Jay_Diddy_B's load project. Notice, he feeds his control voltage into the (-) op-amp input and requires a dual +/- power supply.https://www.eevblog.com/forum/projects/dynamic-electronic-load-project/Dave's loadPeter Oakes's load

author: Vovk_Z
author_rank: Super Contributor
timestamp: May 22, 2020, 03:22:22 pm
content: Quote from: wylbur on May 22, 2020, 12:13:38 amThat is because if opamp offset voltage. You should give about 1-2 mV at the non-inverting input of LM358 to get rid of it.And, to it was stable - add 2-5 nF cap between opamp output and non-inv. input.

author: wylbur
author_rank: Contributor
timestamp: May 22, 2020, 04:07:28 pm
content: thx for the filtering suggestions, MarkF and Vovk_Z. No progress yet.To review, there are 2 opamps: first is a buffer, second is the one that drives the MOSFET. Here's what I've done:- there's already a 1nF cap between the second opamp's +input and GND (this is on MarkF's schematic)- I put 1nF and 10nF caps (one at a time) between the first opamp's output and the second +input, no change in the noisy signals (I think this is what Vovk_Z recommends)- I put 1nF and 10nF caps (one at a time) between the first opamp's +input and GND, no changeWhen I turned off all the power to the circuit (load, circuit power, control voltage), the noise on the oscope didn't change at all, and both leads were identical. I think that it's noise coming from all the stuff on the bench, does that make sense? If so, I should be bypassing or something on the power inputs?I'm sure I'm missing something obvious here, but I'm missing it. Advice welcome. thx again -- wylbur.

author: MarkF
author_rank: Super Contributor
timestamp: May 22, 2020, 05:32:56 pm
content: Yes, it looks like noise to me.And yes, you will want bypass capacitors in your final design.My circuit shows a 1μF capacitor after the power jack (left side).You may want anything from 1μF to 10μF on the power rails.Here is my PCB where I have two 1μF caps on the power rail.One before the voltage reference & op-amp and one before the fan.

author: wylbur
author_rank: Contributor
timestamp: May 23, 2020, 12:38:32 am
content: I've been playing with caps to filter the noise we have been discussing, and I've observed that the noise is probably not from the circuit we're building here. More on this below.None of the cap placements have affected the noise we observed. I've put them in all the places MarkF recommends, and I don't see a change on the scope or in the circuit behavior. I'm not entirely sure if this is a problem I need to fix, but I love tinkering, so if people have more ideas, I'd like to hear.I have found that the pullup resistor from the source to 12v seems to work best at 4.7K. By "work" I mean that the circuit does not allow current to flow thru the MOSFET when the control voltage is 0v but allows 1mA when 10mV are on the control voltage. The relationship between control voltage and current through the MOSFET is flaky below 50mV on control. I can imagine a lot of possible causes, but I'm guessing mostly it's bc the sense voltage is so small (<5mV) that the opamp doesn't really sense it consistently. Does that sound right?-- wylbur./* this is a distraction from the thread but for completeness */re noise: I've read this thread about the Rigol 1054Zhttps://www.eevblog.com/forum/testgear/rigol-ds1054z-internal-noise/I reviewed Dave's videos linked there, and a couple of other threads on this and other entry-level scopes, and I conclude that I shouldn't worry about it too much.My noise readings are consistent with the comments in that thread: with the test ogden proposed there, I get about 500uV/pp at 5ns/div. With the leads connected but shorted to themselves, I get 1.5mV Vpp; connected to the entirely unpowered breadboard & other parts, all my lights off, I get 10-25 mV Vpp. Lights on, that can go up to 70mV Vpp. This isn't the circuit's fault, it seems.

author: MarkF
author_rank: Super Contributor
timestamp: May 23, 2020, 09:35:26 am
content: Quote from: wylbur on May 23, 2020, 12:38:32 amMy 1KΩ, or your 4.7KΩ, pull-up on RSenseis there for ONLY one reason. It's to force the op-amp output to 0V when there is no sense current and the set current level is zero. The problem occurs when the Device Under Test (DUT) is disconnected or is turned off. In which case, the op-amp will set its output to max voltage and fully turn on the MOSFET. At which point, the DUT will see a brief short circuit when first turned on regardless of the set current level.Like I said before, this is a hack to at least allow you to turn down the current setting and have the MOSFET turned off when the DUT is first turned on. You may get the MOSFET turned off with 4.7KΩ. But, I used 1KΩ to raise the minimum threshold a little.This issue probably stems from the op-amp offset voltage.