raschemmel:
that's only because he chose a crappy mosfet with a high RDSon
RDSON has absolutely nothing to do with this circuit. It is an irrelevant metric.
raschemmel:
that's only because he chose a crappy mosfet with a high RDSon
RDSON has absolutely nothing to do with this circuit. It is an irrelevant metric.
Would your application be happy with PWM ?- saves a lot of dissipation....
regards
Allan
Hi,
Quote
Schematic should label the 2 ohm resistor as a Current Limit/Sense resistor
Why? If you see a voltage divider hanging off a LM317 regulator output and connected to the ADJUST pin, does that need to be labelled "feedback network" for you to understand what it's for?
Hmm.. if the 2R is a current sense resistor, then how is it used without the gnd of the circuit connected to the gnd of the arduino?
Where do you connect the load that you are putting the controlled current through?
Post # 28, can you answer my questions, please.
Please an new circuit diagram showing us all the asked for items.
Tom.. ![]()
I have not kept anything meaningful to myself. I have stated repeatedly that the MOSFET is not being used as a switch, the feedback to the op amp driver keeps it in the linear region. The datasheet graph you cite is IRRELEVANT because the MOSFET is not being saturated. Almost everything that I have read that you posted since our feud began has been wrong because of this very fundamental misunderstanding of the circuit.
I have been very consistent in stating the reason why the MOSFET is at risk of dissipating too much power, and I will repeat it here for emphasis: The MOSFET is not being used as a switch, the feedback to the op amp driver keeps it in the linear region.
The first place I saw this circuit topology was in Dave Jone's EEVblog #102 - DIY Constant Current Dummy Load for Power Supply and Battery Testing video, and there's probably about a million other Youtube videos and blog posts doing variations of the exact same circuit. He brings out a white board with this circuit on it less than two minutes into the video, and after shortly discussing an alternate circuit he analyzes this circuit. OP's is a trivial variation on Dave's circuit that will have nearly identical performance.
I mentioned in reply #30 that EEVBlog made a video about it, and the key words "constant current load" and "dummy current load" were mentioned in other replies of mine. If you aren't familiar with what kind of circuit those words refer to, either say so or do a web search.
The math that I did in response to Dwight's post was merely verifying a particular fact that I found mildly surprising enough to remark about. I did not think it would be important to someone that can't get "the MOSFET is not being used as a switch" into their head, so I didn't feel like wasting time typing it up. If you feel it will be helpful, I have attached my handwritten calculation for your study.
3rd time's the charm: The MOSFET is not being used as a switch, the feedback to the op amp driver keeps it in the linear region.
I'll admit I did not look at the specification for the
transistor before making my statement. My bad.
The maximum power would still be at 2.5V, on the
2 ohm load, for the source of 5V.
It would never be able to reach 5V on the load because
the on resistance of the FET is only slightly less
than 2 ohms Looking at Fig2 of TC=175c.
The maximum power is still 3.125W in the FET.
He would never be able to get the full 5v across the
2 ohm resistor because the FET wouldn't go below
about 1 ohm ( 3A at 3V with 5.5V gate ). It would
hit a constant current someplace before the load
went over about 3v.
With 10 volts the compliance of the transistor is no
longer an issue. The FET would only be below
its compliance driving 2.5A.
Now, the power is 5v time 2.5a or 12.5W.
Still, these are typical and the FET may move
from constant resistance to constant current at a
slightly lower drain source voltage or require a
slightly higher gate voltage.
This is all with a gate drive limited to 5.5v.
This is right at the limit of what the LM324 can output
with 12V supply. ( 5.5V gate to source and 5V on the 2 ohm
resistor ).
So, yes, after looking at the specification of the transistor
I would say that my calculations are correct. If the
transistor wasn't compliance limited first,
with 5v source 3.125W or less.
With a 10v source 12.5W.
In electrical engineering, the maximum power transfer theorem states that, to obtain maximum external power from a source with a finite internal resistance, the resistance of the load must equal the resistance of the source as viewed from its output terminals. Moritz von Jacobi published the maximum power (transfer) theorem around 1840; it is also referred to as "Jacobi's law".[1]
There, I did my homework.
Dwight
From Reply #46
Vin where i attach the device under test - to which i am applying the load to with the circuit - so far been testing with 5 and 10 v.
Poorly worded but implies that the load "-" terminal is the point labeled Vin and the load "+" terminal is the +10V (or 5V), such that he mosfet sinks the load current.
I wouldn't choose 2 ohms for a current sense resistor when the standard current shunt values are 0.1 ohms and less.
@Dwighthinker,
With the LM324 running off 12V , when you say a gate voltage of 5.5V, are you specifically referring to a PWM duty cycle that yields 5.5V on the gate ? (since the maximum is 12V)
Hi,
Daves circuit, unfortunately he does not acknowledge the fact that gnd of the controller and gnd of the 2R (well 1R in hs case) are connected. (Sloppy)
Tom... ![]()
We need to see a picture of this constant current source showing us all connections.
When we are talking about the FET's power dissipation, the FET is the load
to be calculated and the 2 ohm resistor is the source resistance.
It still applies Jacobi's law.
The maximum power in the FET is when the FET's resistance is
equal to the 2 ohm resistor.
You can handle the math from there.
Dwight
raschemmel:
From Reply #46@Dwighthinker,
With the LM324 running off 12V , when you say a gate voltage of 5.5V, are you specifically referring to a PWM duty cycle that yields 5.5V on the gate ? (since the maximum is 12V)
The first stage is unity gain. It would be 5v to the next op-amp.
The next op-amp's output would be the result of the gain of the op-amp
plus the voltage on the 2 ohm resistor.
The most the op-amp can put out is 10.5v ( the conservative value from the LM324 specification ).
I suspect with no load it is higher.
For the 2.5V case at the 2 ohm resistor, I was in error that the voltage of the gate-source
would be 5.5V. The curves say that it would be less. Still, it would not put the FET into
resistance limit or current limit. It would be near the knee in the curve but still not there.
With 2.5V, the voltage of the op-amp could go to 12-1.5-2.5= 8v, if needed ( most likely less )
More than enough to support 1.25 amps through the transistor.
Sorry about that error. I should have drawn it out but tried to do it in my head.
I'm not perfect.
Still Jacobi's law applies.
With the input at 10v, the resistor would be at 5V maximum, applying Jacobi's law.
The gate to drain voltage maximum could then be
limited to 12-1.5-5 = 5.5V available for gate to source.
This is still enough with 10v at the drain to supply 2.5 amps to the resistor.
Again calling the 2 ohm resistor the source resistance the maximum power
on the FET is still based on Jacobi's law.
In that case the voltage across the resistor is 5v so 10-5 =5v.
5*2.5=12.5W.
Dwight
I'm not sure where the 0.1 ohm came in.
The 2 ohm resistor is both the load and the current sense
resistor. Nothing wrong with that.
Why add a extra resistor in series to get a current measurement.
It is not needed.
As for the grounds being connected, I hope the OP has
sense enough to connect them, even though it is not
clearly shown in the drawing.
Dwight
So then "Constant Current Load = ACTIVE LOAD
So, in other words, this is a computer controll:ed (current) regulator ?
@Jiggy-Ninja,
I am trying to understand your calculations now. I took Differential Calculus at DeVry in 1992 when I was 43 . HS math for me was 1967 (do the math-25 years previously) Learning college math at 43 when you sucked at HS math when you were 18 is an uphill battle. Fortunately DeVry taught me Algebra (again). I'll let you know how it goes...
I found this while researching active loads.
and this...
@Tom,
btw,
still don't get why the Davies circuit (Reply # 55) has no Vin.
BEFORE
AFTER
BTW,
Does anyone think the 10 nF caps on either side of the 1 k resistor should be connected to GND instead of to the analog in line ?
Just out of curiosity, how do you hold the control signal "equal" to the resistor voltage ?
How do you know what duty cycle to output to arrive at that ?
I thought you just calculated what voltage you want to be across the resistor and then read increased or decreased the duty cycle to obtain the "Target Voltage". (ie: Let VR = 2.5V, loop in adjust loop until VR = 2.5V)
Is that how it works ?
Jiggy-Ninja CCL Calculations.pdf (722 KB)
Jiggy-Ninja CCL Calculations-2.pdf (781 KB)
Hi,
Does anyone think the 10 nF caps on either side of the 1 k resistor should be connected to GND instead of to the analog in line ?
Yes, because they are LP filter for gate volts.
I thought you just calculated what voltage you want to be across the resistor and then read increased or decreased the duty cycle to obtain the "Target Voltage". (ie: Let VR = 2.5V, loop in adjust loop until VR = 2.5V)
Is that how it works ?
My thoughts exactly, a pot to another analog input to give a set point.
Tom.... ![]()
A 50% PWM of 5v will be 2.5v when passed through a low pass filter.
The first op-amp is just a buffer.
The second op-amp provides the gain to turn the FET on by
comparing the voltage across the resistor to be 2.5v and
drive what ever output to get that minus the open loop
gain of the op-amp.
The FET will be running in the linear region and drop the needed
voltage to keep the resistor at 2.5v.
This is a straight forward current regulator.
Am I missing something?
The capacitors at the output of the op-amp are feed back
capacitors and would not be useful if connected to ground.
They are there to keep the op-amp from oscillating.
I'd have put them a little closer to the op-amp negative input where
they'd have more effect. The impedance of a 2 ohm resistor
means the capacitors need to be large and it
tends to saturate the op-amp, rather than stablizes it.
Dwight
Somewhere in this thread OP says he removed 1 k resistor because it was oscillating.
I was getting oscillations on the output so took at the 1K to the gate of the MOSFET and replaced it with a direct connection Oscillations gone
I think he may have removed those two caps as well.
If caps are wired correctly then are they the correct value ?
@Jiggy-Ninja,
I am trying to understand your calculations now. I took Differential Calculus at DeVry in 1992 when I was 43 . HS math for me was 1967 (do the math-25 years previously) Learning college math at 43 when you sucked at HS math when you were 18 is an uphill battle. Fortunately DeVry taught me Algebra (again). I'll let you know how it goes...
Fortunately it's only a polynomial equation, pretty much the easiest type to integrate or differentiate.
raschemmel:
So then "Constant Current Load = ACTIVE LOAD
So, in other words, this is a computer controll:ed (current) regulator ?
Yes, that's right.
AFTER
The DUT needs to be something capable of supplying power, like a battery or power supply. You can have other things connected to it if you wanted, but at least one thing needs to be a power supply.
Just out of curiosity, how do you hold the control signal "equal" to the resistor voltage ?
How do you know what duty cycle to output to arrive at that ?I thought you just calculated what voltage you want to be across the resistor and then read increased or decreased the duty cycle to obtain the "Target Voltage". (ie: Let VR = 2.5V, loop in adjust loop until VR = 2.5V)
Is that how it works ?
Feedback to the op amp does that automatically. Put any voltage to the noninverting input, and the output will adjust the MOSFET gate voltage so that the feedback to the inverting input is the same as the noninverting (provided the necessary output is within the amp's output limits, of course). The loop is already closed to the op amp, there's no need to add another closed control loop to the microcontroller. The only purpose of the sense line to the microcontroller would be to detect faults (like the MOSFET leaking when it should be off) or to verify that something's actually been hooked up to the output (If there's nothing, the setpoint doesn't matter you're getting 0 amps).
Well I already know the first amp is a voltage follower and the second is a comoarator despite your previous statement to the contrary since tgere is no feedback resistor. What I was askng is how does the code choose the duty cycle ?
As I asked, do you code for a setpoint of 2.5V because an analog read by itself does nothing.
The code needs a setpoint. I'm asking how do you choose that ?
Your calcs determined "C=V/2" | where V = Vin
Max PWM duty cycle is 255 so each analogWrite count = 5V/255 (0.019607V = 19.607 mV)
If you have a volatage divider to measure Vin, you can convert the measured voltage to the real (pre-divider) voltage and then divide it by (2 * 0.019607 V) to obtain PWM control signal "C" value in PWM counts to use for the analogWrite command.
If you wanted 2A of current flow, put I * 2 = 4V on the op-amp + input, that would drive the mosfet gate up till the current through the 2R resistor = 2A and the V at the top of the R and the - input = 4V, 2A through 2R = 4V, the op-amp would be balanced at that point. The current in the 2R also flows into the drain terminal.
Did I jabber that correctly?
raschemmel:
Well I already know the first amp is a voltage follower and the second is a comoarator despite your previous statement to the contrary since tgere is no feedback resistor. What I was askng is how does the code choose the duty cycle ?
As I asked, do you code for a setpoint of 2.5V because an analog read by itself does nothing.
The code needs a setpoint. I'm asking how do you choose that ?Your calcs determined "C=V/2" | where V = Vin
Max PWM duty cycle is 255 so each analogWrite count = 5V/255 (0.019607V = 19.607 mV)
If you have a volatage divider to measure Vin, you can convert the measured voltage to the real (pre-divider) voltage and then divide it by (2 * 0.019607 V) to obtain PWM control signal "C" value in PWM counts to use for the analogWrite command.
Yes, not counting op-amp offsets, C = V/2 with the 2 ohm resistor.
Each value is 9.804 milliampere. 1 ampere would require 102 to the PWM analogWrite().
The load could be the power source, such as a controlled discharge connected to the drain,
for battery cycling. It might be a charging with a power source and battery as well.
The OP didn't really say what the purpose was??
Although, it should be noted that at full input, the resistor has 5v across it.
That is 5^2 / 2 = 12.5W. You'd want at least a 20W resistor.
Since it is an open ended drive, the analogRead() might be for slight errors in gain
and offset, as well as symmetric offset out the output driver into the resistance
of the filter.
Dwight
raschemmel:
Well I already know the first amp is a voltage follower
Correct. Which also means it's completely pointless, since it's buffering the signal into another input of the exact same type as itself.
second is a comoarator despite your previous statement to the contrary
No it is not.
since tgere is no feedback resistor
The feedback voltage comes from current flowing through the 2 ohm resistor. Notice how the top of the resistor is connected directly to the inverting input? Ignore the 470 ohm resistor and mentally replace it with a wire, it is meaningless at this level of analysis.
Note: to distinguish between everything unambiguously in this post, I will refer to the the drain of the MOSFET as OUT, the 2 ohm resistor as SENSE, and the input to the op amps as CONTROL.
An op amp acts as a comparator when there is no feedback or positive feedback. This circuit has proper negative feedback coming from the current sensing element connected to the inverting input. Figuring out what setpoint gets what current value is just a matter of knowing the IV characteristics of the SENSE element. Since it's a resistor, the IV is a trivial proportional relationship, V = 2*I.
I've just dragged out my "The Analysis & Design of Linear Circuits" textbook and it shows that the proper way to analyze an op amp circuit with negative feedback using the ideal op amp model is to assume V+ = V-, and assume that the output voltage and current will be whatever value is necessary in order to maintain that equality at all times. Obviously, no op amp is ideal so if you calculate voltages and currents that the op amp is not physically capable of producing the actual behavior will not follow the calculations. In that case, you need to redesign.
In this circuit, V+ = VCONTROL, and V- = VSENSE. The gate of the MOSFET will be controlled by the op amp to control the current through the MOSFET so that the voltage across the this equality is maintained at all times. From the following relationships, VCONTROL = VSENSE and IOUT = VSENSE / RSENSE, a trivial substitution shows that IOUT = VCONTROL / RSENSE.
No connection to the microcontroller is necessary for any control functions. However, reading the output voltage still has value. The MOSFET is a valve, it is only capable of restricting current through it, it cannot pull anything extra that the DUT is not capable of providing. Reading the output current with the microcontroller can allow it to detect when the current is lower than the commanded level. It can also detect a fault like what OP has, when the MOSFET becomes leaky and cannot completely turn off. With the 50 mA leakage OP was getting, the controller would read an analog value of about 20 even when the current is commanded to be 0.
It's not an ideal method of fault detection though. It has no way of detecting if there is a fault with the feedback SENSE resistor, for example if it overtemps and changes its resistance value. The best thing would be to have a separate independent shunt sensing the OUT current, amplified by a proper differential amplifier.
As you can see from the AFTER schematic, I already guessed 20W for the resistor.
@Jiggy-Ninja,
Ok, I understand your explanation of the feedback via the control loop instead of a resistor. I've never seen that before but what you said makes perfect sense. Your comment about the error due to leakage begs the question of whether or not the OP had code to report the error via serial out, Panel Indicator lamp or LCD, (ie: "Control Loop Error ! 50 mA ")