Driving mosfet with opamp

Status
Not open for further replies.

Swanepoel

New Member
Hi,

Recently I watched an old EEVBlog episode (#102) where Dave discusses and builds a basic constant current load. To try it out, I quickly built the circuit on a breadboard and got curious to fully understand how it works. For the op-amp I used the LM2904 and for the mosfet a STP60NF06, then I also used a 0 to 9V rail. I made a quick schematic (not showing my exact components) below:


If I understand it correctly then basically the op-amp drives the mosfet to allow a current to flow through the 1 ohm resistor (R1) to ground. The voltage across the resistor is then also seen at the inverting input of the op-amp. The op-amp will drive the mosfet until its two inputs are equal, so by increasing the voltage on the non-inverting input the op-amp will drive the mosfet harder allowing a larger current to flow.

So now for the part I am having trouble with, when I increase the voltage (up to Vcc - 2V) on the non-inverting input and measure the output voltage I can't get it to go higher than about 5.8V. From my understanding of the datasheet the output voltage should swing to Vcc-1.5 for this op-amp and I should be able to see 7.5V on the output. To test this I built another circuit but without the mosfet and sure the maximum output from the op-amp is 7.8V. So why am I not getting it when driving the mosfet?

The gate-source current should be small enough that the op-amp would have no problem driving it to the maximum swing right?
 
What you're forgetting is that the op-amp output always has to be Vgs higher than the actual output voltage of the circuit. Since your rail voltage is what limits your op-amp output swing, that means having the MOSFET reduces your swing by Vgs on top of the MOSFET's swing limit. Check the MOSFET datasheet for Vgs.

So although your MOSFET could swing as to the rail, it has requirements to do so that cannot be achieved by your op-amp.
 
Last edited:
IF the TS is talking about the output voltage of the opamp, as opposed to the voltage across R1 or the voltage at the Q1 drain, then I understand his question.

dk refers to "the output voltage of the circuit", but that is too ambiguous to have meaning. If dk also is referring to the opamp output (IC1 pin 1), then I disagree with his explanation.

If the opamp output saturates at 7.5 V and the FET Q1 Vgs is 3.5 V at Id = 4.0 A, then 4 A is the max output current. If the input from R2 requests more than that, U1a will saturate and there will not be enough Vgs to make the FET conduct more than 4 A.

Are you certain about the FET part number and pinout?

I recommend that we all refer to specific device pins or identifiable circuit nodes when discussing voltages.

ak
 

Well, I thought it was pretty obvious when I said output of the op-amp vs actual output of the circuit.
 
Thanks, but I am still a bit lost, maybe I can rephrase my question:
When I apply close to 0V at pin3 of the op-amp then I read about 3V between pin1 and ground, I take it this is the Gate-Source threshold voltage and just switches the mosfet on with very low current flow from Drain to Source (and producing close to 0V on pin2). As I increase the voltage on pin3 the voltage between pin1 and ground keeps increasing up until it saturates at about 5.8V. In my second test circuit without the mosfet (replaced with 1k resistor) and R1 at 1k the same op-amp saturates at 7.8V. So my question is why can't I drive pin1 to 7.8V when the mosfet is connected?

That's exactly how I understand it, but for some reason I can't drive the op-amp output all the way to 7.5V which limits my Id.

Are you certain about the FET part number and pinout?
Pretty sure yes.

Just out of curiousity, there is no need for a current limiting resistor between op-amp pin1 and the mosfet gate right?
 
A gate resistor isn't needed here for current limiting, but could be useful to suppress high frequency oscillations due to connecting wire inductance and gate capacitance.
 
A gate resistor isn't needed here for current limiting, but could be useful to suppress high frequency oscillations due to connecting wire inductance and gate capacitance.
True, but -

Opamps in the LM324 / LM358 class have relatively slow output stages. The maximum rate of change is so slow that the MOSFET gate ringing that is a consistent problem in switching power supply design or anything else with a high speed gate driver (like Linear Tech's hot-swap controllers) almost never occurs with these parts as drivers. No harm in adding it here, but no great need to do so.

ak
 

WRONG. The MOSFET doesn't turn on based on the voltage between gate and ground. It turns on based on the voltage between gate and SOURCE. What you are saying is only true if MOSFET source is connected to GND, but it's not. You have a resistor between source and GND. (Think about it: why would the MOSFET as a lone device care about anything that is not directly across it's three pins? How would it even know that the far end of the resistor is connected to ground?)

By placing a resistor between source and ground, you have made a source-follower configuration which has negative feedback, even if you directly applied a voltage to the gate without the op-amp there. The ground voltage is no longer equal to the MOSFET source voltage. As the MOSFET turn on more based on some Vgs, more current flows in the resistor which makes the source voltage rise due to the voltage drop in the resistor. If the gate voltage stays the same, and the source voltage rises then Vgs decreases which slowly turns the MOSFET off a bit until it finds an equilibrium. THis is the negative feedback in a source-follower.

With all this in mind, if the MOSFET turned on enough so source = Vcc, then we must have:
Vgate = Vsource + Vgs = Vcc + Vgs_sat
(where Vgs i_sat is some gate-source voltage high enough to saturate the MOSFET).

But we have a problem...your op-amp can only provide a Vgate of Vcc at best (if you you had a rail-to-rail output op amp to make things simpler to talk about). This means that to get the MOSFET to reach the rails in a source follower circuit, the MOSFET must saturate at Vgs = 0V, but we know that if Vgs = 0V then the MOSFET is off. Contradictory.

If you got lost, then figure it out yourself the way you tried to in your response EXCEPT forget about the MOSFET saturating due to a voltage between gate and ground. It's the voltage between GATE AND SOURCE that turns the MOSFET on, and obviously the MOSFET can't turn on if gate and source is 0V. Remember, it's the GATE-SOURCE voltage that turns the MOSFET on. Not the gate-ground voltage. Do not ignore the voltage drop in the resistor.
 
Last edited:
May I ask how you are taking your measurements?
If you are using a multimeter then it's possible that the circuit is oscillating and therefore the meter is giving misleading reading. If you have an osciloscope available, I think it would be worth probing the circuit with that and seeing if it's doing what you expect.
 
No offense, but this is not the problem. The OP thinks absolute gate voltage is what controls a MOSFET and not the Vgs and is failing to recognize the role of the source resistor.

That's exactly how I understand it, but for some reason I can't drive the op-amp output all the way to 7.5V which limits my Id.
No, you arent understanding what he is saying because he just described why you are seeing what you are seeing. Vgs is the key, ignore the gate voltage relative to ground. Pay attention to the gate voltage relative to source, Vgs.
 
Last edited:
No offense, but this is not the problem. The OP thinks absolute gate voltage is what controls a MOSFET and not the Vgs and is failing to recognize the role of the source resistor.
No offense, but this is not the problem.

As stated in posts 1 and 5, The OP is discussing the opamp output voltage on pin 1, not anything else in the circuit. The interesting clue is that when he disconnects the FET, the opamp output voltage jumps up to a positive saturation value that is consistent with the data sheet. The question is why the opamp does not hold this value when connected to the FET and its input is intentionally overdriven.

ak
 
My mistake, I must have missed that multiple times. Never mind me then.

Has the OP tried just testing by increasing the source resistance with the mosfet? Because 1 ohm is pretty low so maybe something is jus getting loaded down. What is the OP getting on the FET source voltage when he is getting his 5.8V on the opamp's output pin? And what power supply is being used?
 
Last edited:
What is the internal impedance of your 9V source? The greater the load current the lower the opamp supply voltage will be and hence the lower its output maximum.
 
Alec_t has a good point.
Measure the 9V supply voltage when you are seeing 5.8V at the MOSFET gate.
 
A gate resistor isn't needed here for current limiting, but could be useful to suppress high frequency oscillations due to connecting wire inductance and gate capacitance.
Thanks, will leave the resistor then for the moment.

Does it do the same when there is no supply connected across IN and GND?
I disconnected the load and the op-amp output jumped up to 7.8V, which makes sense since no current through R1 means no voltage at pin2 so the output is driven to maximum. I could go your way and use a 0.1ohm resistor but wanted to connect a voltage display (like Dave) across the 1ohm resistor. Why would it anyway limit the output of the op-amp though?
Like the Tiny Load, looks like you had fun building it too! I am pretty much on the same mission... good idea to have some led or indication that it's running!

WRONG. The MOSFET doesn't turn on based on the voltage between gate and ground. It turns on based on the voltage between gate and SOURCE.
Ah sorry for that one, you are correct, in that first sentence I meant to say between pin1 and source.

Interesting, haven't thought of that. I used a multi-meter but I have an oscilloscope to which I can hook it up, will give it a try...

That made a difference, replacing the 1ohm with a 2.2k I can drive the op-amp output to 7.8V. Problem is I need the 1ohm as it's used as a sensing resistor with a voltmeter connected over it, why does it work for Dave and throbscottle with even less load?
Source voltage is about 1.6V when the op-amp output pin is at 5.8V at which stage the power supply also confirms about 1.6A current drawn.
 
What is the internal impedance of your 9V source? The greater the load current the lower the opamp supply voltage will be and hence the lower its output maximum.
Alec_t has a good point.
Measure the 9V supply voltage when you are seeing 5.8V at the MOSFET gate.
Solved!
I measured Vcc on my ciruit while increasing the voltage on pin3 and it dropped to 6V by the time pin1 reached 5.8V! Since my power supply still indicated 9V on it's output I measured directly over it's output and it still read 9V on my multi-meter. So I was seeing a 3V (at about 1.6A) drop over my power supply leads! Changed the leads and voila I can now drive the op-amp almost all the way to 7.8V!

I feel a bit stupid and apologies for wasting you guys time with my faulty leads. It was still a valuable learning experience and thank you for all the help and support! Now I can continue adding some cool features to my constant current load project!
 
Happens to all of us. Everyone here has had connector problems before.

First two steps of troubleshooting:
1. Check that the power is on.
2. Check the connectors.
 
Last edited:
It's not a waste of time, it's a chance for everyone to learn something - even the most knowledgeable.
I was once given some excellent advice by an employer - "The only stupid question is the one you don't ask".
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…