Issue in driving opamp as comparator to drive mosfet

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. I have MCU operating at +5V, and need to drive a mosfet with Vgs = 10V-12V.
2. Freq to drive is 20Khz around ie 50us on and 50us off.
3. I was looking for low cost solution and MCU dircetly cannot give that much vgs to mosfet so I used opamp LM358 in between. as in ckt below.
Issue is I am getting triangular output?
There may be some freq limitation, but opamp datasheet says it has 1Mhz unity gain?
What I am doing wrong in it.
4. Attached is ckt output in simulation , same is seen in actual hardware.

Untitledv.png
 

MisterBill2

Joined Jan 23, 2018
18,176
hi VT,
Did you mean 10kHz, for 50u/50u.?
Check the Vout slew rate for the LM358 d/s.
E
The first thing to understand is that op-amps are intended for linear mode operation, and they are optimized for that mode. The next thing to understand is the meaning of the data published in the data sheets. While they are sometimes complex and a bit hard to understand, they are full of valuable information that should not be ignored.

For this application a suitable FET transistor used as a switch would have been a less expensive way to drive the device.
 

Wolframore

Joined Jan 21, 2019
2,609
If you need a comparator use a comparator. The internal capacitance of opamps which tame their linear characteristics slow them down. Inverters and comparators are not compensated. As opamps go the LM358 is pretty old and slow at 0.3V/us, it’s even slower than a 741.
 

Alec_t

Joined Sep 17, 2013
14,280
A typical op-amp or comparator cannot source or sink sufficient current to switch a big MOSFET on or off quickly. The MOSFET is therefore likely to be in a partly-on state for prolonged periods and overheat. Best to use a dedicated MOSFET driver IC.
 

DickCappels

Joined Aug 21, 2008
10,152
When I don't have the right gate driver on hand I use this. Unless your gate capacitance is massive this should work just fine past 40 kHz (I used it at 60 kHz for narrow pulses).
1589897935834.png
The grounded emitter 2N2222 needs 200 microamps to 1 milliamp of base drive.
 

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
But didnt datashhet says "Wide Bandwidth (Unity Gain): 1 MHz"?
1. If 1Mhz is not freq to which it can operate, then what parameter define what max freq opamp will work fine?
2. Otherwise why 1Mhz is mentioned?
3. Any low cost opamp/comparator which can work on this? If 8 pin posssible then its better, as I have already designed PCB for it , pin to pin compataible would be good
 

ericgibbs

Joined Jan 29, 2010
18,766
hi VT,
I did suggest you check the 'slew rate' of the output.
If it is 0.5V/uSec how long will it take for the output to rise to say 10V, when driven with a square wave input.?
E
AAA 348 15.16.gif
 

MisterBill2

Joined Jan 23, 2018
18,176
My experience has been that an LM311 is a good comparator, and it comes in the 8 pin package. But the output transistor has both the emitter and collector available so it is a bit more complicated to use. I have only driven logic gates with it, so I can't comment on driving a "big mosfet" transistor. And there are much higher speed comparators around, but they do cost more.
 
Use the circuit Dick Cappels posted. I have also used it and can tell you it works very well. Depending on the Mosfet you are driving, you may need to tweak the gate resistor.

Otherwise, use a proper gate driver IC. There are dozens available.
 

Papabravo

Joined Feb 24, 2006
21,159
Driving a MOSFET gate with an opamp is just about the worst idea I've heard in a long time. You want something that will move the charge on and off the gate in a jiffy. Opamps can't/won't do that. It's all about the poles - both of them. The more you know.
 

MrAl

Joined Jun 17, 2014
11,389
1. I have MCU operating at +5V, and need to drive a mosfet with Vgs = 10V-12V.
2. Freq to drive is 20Khz around ie 50us on and 50us off.
3. I was looking for low cost solution and MCU dircetly cannot give that much vgs to mosfet so I used opamp LM358 in between. as in ckt below.
Issue is I am getting triangular output?
There may be some freq limitation, but opamp datasheet says it has 1Mhz unity gain?
What I am doing wrong in it.
4. Attached is ckt output in simulation , same is seen in actual hardware.

View attachment 207568
Hi,

Contrary to somewhat popular belief, it is just fine to use an op amp as a comparator, but you have to pay close attention to all the specifications and make sure it will work for your application.

As i think you are finding out, it is not only the bandwidth spec that is important in this kind of application it is also the slew rate. When you expect the output to jump up or down to some level quickly you have to pay very close attention to the slew rate.
The slew rate is the time it takes for the output to ramp up (or down) to some specific level in a specific amount of time. This is the minimum time, and it does not matter what you apply to the inputs. You could input a difference of 100 thousand volts (if it could take that) and the output would still lazily ramp up to some voltage level taking it's good old time, according to the slew rate of the op amp.

For the LM358, the original spec was 0.5 volts per microsecond. That means that if you expect the output to jump up to 5 volts (for example) then you are going to have to wait 10 full microseconds for it to reach that level.
At 20kHz the half cycle time is 25 microseconds. This means the output would jump up to 12.5 volts (if it could) in 25us. That may be too long for a MOSFET driver.

But that's not the only factor. The other factor is the input capacitance of the MOSFET, which is often looked at as the gate charge. The op amp has to be able to drive the input with enough current to get the MSOFET to switch on and off fast and since the op amp may only be able to put out 20ma, that is probably not enough. 200ma would be better although that may not be enough either.

The best bet then is to either use a mosfet driver or use two transistors connected as a dual voltage follower. Using one NPN and one PNP with emitters tided together and bases tied together and each collector going to their respective power supply rails, you create a simple driver that can be used in non time critical applications. 20kHz might be ok to use transistors like that, although 100kHz would be pushing it.

Just to note, i have used the LM358 op amp since the 1980's both as op amp and as comparator.
In one comparator application it was used as a timer with long time constant to trigger a reset for a line tied converter used in solar panel application. If the unit lost the tie in, it would time out and then reconnect.
In a second comparator application i remember, one section was used as a zero crossing detector the other was used as a timer to time the time between the zero crossing and the time the triac should turn on in order to provide a "lamp dimmer" type of function.
Both of these applications worked great, but they were low frequency. The first was a very slow timer maybe 10 seconds long, the second was a mere 60Hz. As you get up in frequency and the output current also becomes a factor, you may have to use something else or provide a secondary driver stage.

MosfetGateDriver-1.gif
 
Last edited:

Wolframore

Joined Jan 21, 2019
2,609
0.5/μs means Δ5V takes 10 μs. 5V signal would max out at 100 kHz and a square wave (at 5V) would turn into a triangle wave at this point. It's just too slow!
 

MrAl

Joined Jun 17, 2014
11,389
Here is a test circuit and waveform at the gate.
The proposed simple driver is enclosed in red.
Gate rise/fall times are about 100ns each even with 100pf extra gate capacitance added to an IRF510 mosfet.
Note the reason for the other two transistors in the test circuit is to be able to test how the driver itself works with a drive impedance as high as 1k Ohms (R3). The driver itself is just two transistors and one resistor.
 

Attachments

Last edited:

MrAl

Joined Jun 17, 2014
11,389
The totem pole PNP/NPN transistor configuration is also explained in detail the TI App note I posted in #14.
Max.
I think the main differences between the TP and the dual follower is that the totem pole has a characteristic current spike on the power supply rail during the switching transient and is more complicated than the dual follower. The dual follower has also appeared in Motorola literature back in the 1980's.
There is also a version using two smaller mosfet voltage followers and that is the same as the bipolar except it uses small mosfets and therefore provides an even faster drive with higher current also. The fact that only one transistor can be on at a time means that the crossover current is reduced significantly which is even more important with a slowly rising/falling input drive.
 
Last edited:
Top