News:

Let's find out together what makes a PIC Tick!

Main Menu

Need help driving MOSFET

Started by JohnB, Oct 05, 2025, 03:58 PM

Previous topic - Next topic

JohnB

Im using an N Channel enhancement mode MOSFET to switch a resitive load.  The gate is connected to a standard PIC output and I have a 10K resistor to ground from the gate.The PIC is running from 5V supply but the resitive load couuld be connected to a supply greater than that of the PIC.

The switch leaks current in the Off stste when the source voltage is above that iof the PIC.  How can I ensure the load is truly switched off when the load's voltage source is higher than the PIC's?
JohnB

trastikata

#1
Quote from: JohnB on Oct 05, 2025, 03:58 PMThe switch leaks current in the Off stste when the source voltage is above that iof the PIC.

Can you explain the topology, Source above Gate voltage in N-channel MOSFET does not make sense for switching circuit.

JohnB

#2
I think I have answered my own question, I need a P-Channel MOSFET with NPN transistor, collector to gate and base to PIC.
JohnB

trastikata

#3
Don't forget the current limiting resistors for the NPN.

GDeSantis

#4
Check out this video.  It might help.

https://www.youtube.com/watch?v=3PkpOeHTnfo

midali

#5
  It's necessary to be careful to VGS(th) of the Mosfet . Make sure  that this value (see the MosFet datasheet) is below 4V so it will work properly .It does  no depend on drain voltage ( in the case of N-MosFet ) .
  If you want to drive a rezistive load with pwm waveform, pay a attention to gate-to-source-capacitance.
  The higher resistive load, is required higher drain current (ID) of the MOSFET, which also means a larger gate capacitance . In this case, a gate driver is needed to properly drive the MOSFET.
  However, if you only use it to switch the load on and off, you can drive almost any MOSFET directly from the PIC, as long as it fully turns on below 4 V ( VGS(th) < 4V).

top204

#6
For a higher voltage switching with MOSFETs, it is always required to use a pre-switcher. Unless the MOSFET accepts TTL logic on its gate, and has the pre-switcher built in.

Many years ago, I created a set of circuit diagrams to help me in a similar fashion, and so I could remember them, and I still use them as a reference. I have attached them.

Remember, the pre-switcher can be be a lower voltage/lower current MOSFET, that switches the MOSFET connected to a higher voltage/higher current. Just make sure the Gate current on the final MOSFET will not exceed the capabilities of the pre-switcher MOSFET. It's the same priciple that we used to use with standard transistors, where a low power transistor connected to the base of a higher power transistor, so it could be switched with the correct bias voltage.

The pull-up and pull-down resistors can be changed to suit the MOSFETs used and alter the current draw when not switched, and it is always better to do some experimenting with them. Also, remember the feed resistor to the pre-switching MOSFET, because thay can pull a larger current when first switched on, and the resistor will help act as a current load. I've tried using the calculations for the Gate/Drain/Source current and voltage draws etc, but MOSFETs are so complex and different to each other, I have always found it better to experiment with different values with a variable current load attached, and do some measurements.

david

The symbol for the Nch driver MOSFET isn't quite right as the body/substrate diode is forward conducting.
Also, the use of a Pch driver like that will not work very well as the device is working as a source follower with limited swing on the series pass MOSFET's gate.
If using an Nch MOSFET or NPN BJT to translate a logic signal up to high voltages (>20V) then you also need to watch the gate-source breakdown of the series pass device.  This can be done with the addition of a second resistor as shown.  Note that the driver device must be able to withstand the main supply voltage when off.   If using pwm then the drive impedances need to be considerably lower to overcome dynamic capacitances.

Cheers,
David

charliecoutas

Also, when driving a MOSFET with a PIC output, check the Gate Threshold Voltage carefully. It usually means that the MOSFET will start conducting, but usually only a very small current. You need to look further in the data sheet to see how much Drain, Source current will flow for a given gate voltage. Don't ask how I know this!

Sorry if it's been covered earlier, just arrived at the museum at Bletchley after a 5.30am start, still a bit bleary...

Charlie

Fanie

#9
Quote from: charliecoutas on Oct 06, 2025, 07:45 AMAlso, when driving a MOSFET with a PIC output, check the Gate Threshold Voltage carefully. It usually means that the MOSFET will start conducting, but usually only a very small current. You need to look further in the data sheet to see how much Drain, Source current will flow for a given gate voltage. Don't ask how I know this!

Charlie

Correct Charlie.
The the Gate Threshold Voltage should be well within the drive voltage, or the FET will operate in linear mode.

A driver is usually only required when you do continuous fast switching and that is again to drive the gate up and down against the FET's capacitance, without a slope, the larger the slope, the more the FET is in linear mode and heat is generated as a result, or the poor FET never is switched on properly.

John, select a (Logic Level) FET with the Gate Threshold Voltage less than 4V (out of 5V) and if possible reduce the on/off switching rate.
The pic will drive the FET without problems.

For instance, in the bakery I drive 2kW elements off 250VDC, the Gate Threshold Voltage is around 4V (if I remember right) directly from the pic, and I limited the switching on/off time to half a second.  The FET's run cold, although they are on a aluminum angle iron heat sink which is where the PCB is mounted on too.

I checked the FET I use.. Infineon_IPW60R070P6
Gate threshold voltage V(GS)th 3.5 - 4.0 - 4.5 V VDS=VGS, ID=1.72mA

Fanie

#10
Quote from: JohnB on Oct 05, 2025, 03:58 PMThe switch leaks current in the Off stste when the source voltage is above that iof the PIC.  How can I ensure the load is truly switched off when the load's voltage source is higher than the PIC's?

Keep the Pic pin an output and drive low when off.  Use a 2k2 (2.2mA) to pull down rather than a 10k (0.5mA), will only work when you power up to prevent the gate to switch on.
Make sure the Pic's 0V and the Fet's source (emitter) are connected together and the connected together must not carry large currents or you can have a voltage drop.

Fanie

Like in so...
Driver.jpg

okmn

Quote from: JohnB on Oct 05, 2025, 03:58 PMIm using an N Channel enhancement mode MOSFET to switch a resitive load.  The gate is connected to a standard PIC output and I have a 10K resistor to ground from the gate.The PIC is running from 5V supply but the resitive load couuld be connected to a supply greater than that of the PIC.

The switch leaks current in the Off stste when the source voltage is above that iof the PIC.  How can I ensure the load is truly switched off when the load's voltage source is higher than the PIC's?

Does using a cheap optocoupler increase the cost?

dr-zin

I admit first:  I'm not a big fan of using enhancement MOSFETs for driving loads, but Fanie's diagram above is quite close.  You need a current limiting resistor (maybe 220 ohms) between the Pic output pin and the FET gate pin.  Also, at the junction between the two [resistor and gate], you need a bypass resistor (as shown in Fanie's diagram) of 2.2k-10k ohms to bleed off the charge from the gate when the PIC switches off. Lower resistance shuts off quicker, higher resistance wastes less energy.  The drain pin can go to any positive voltage above 5VDC up to the limit of the transistor.  An additional current limiting resistor may be required between the load and V+ power source if the load can't handle the current coming from V+.  Also, if driving an inductive load like a motor or relay, a flyback/freewheeling diode must be connected in reverse across the load (cathode lead to V+ side, similar to a zener diode) to protect the FET, and possibly the PIC output pin.

As mentioned above, you need an FET that can be saturated by TTL (5VDC or lower), or you get only partial transistor turn-on and an amplifier instead of a switch.  Heat and other bad stuff is the result then.  For small mA loads, you can use a 2n7000.  For larger current loads, you need something beefier, like an IRFZ44N, which can handle 40+ amps (with heatsink, of course).  Good luck!  --Paul

dr-zin

Duh- I didn't mention that the other side of the bypass resistor should be connected to gnd (0 volts) to bleed off the charge for an n-channel MOSFET gate to supply low-side switching, which seems to be your objective.

Fanie

#15
Dr-Zin, the 220R resistor (and bypass cap) is usually only required when you use a driver that can drive 1,5 to 2 Amp and say 15V to a FET gate.  The pic's output is limited to 20mA or there about.

Most FET's already have a reverse polarity diode built-in for protection.

Gate protection (zener/transzorb...) is usually required when transistors or other components are used to switch the gate to protect from spikes that can possibly exceed the 20V gate limit.  The pic does not have that problem, and if such mysteriously happen then the pic will have silently gone to pic heaven.

The only thing to make sure is that the pic's 0V is connected close to the source (emitter), because if you have a longer piece of track where the load current flow through and the pic's 0V is connected there, you can get a voltage drop which could bring the gate drive voltage too low for the FET to be switched on fully.

The IRFZ44N will not work directly with the pic, it's Gate Threshold Voltage required is too high, the IRLZ44N will.

Also take into consideration that some FET's can not handle the on power surge of a cold resistor element.  For this you select a higher current FET and pass the surge stress to the supply.  Consider a 120A FET in TO220 case, do you think those pins can carry 120A ?  No, they cannot, but they are supposed to handle the initial surge current, almost like a motor starting up. Notice that different FET technologies have different capabilities.

Google max current for TO220 pins


ken_k

For a low component count galvanically isolated a Photovoltaic MOSFET driver can be used. Many different types are available.
VOM1271.pdf

Driving the LED input illuminates the photodiodes generating a galvanically isolated voltage source. As a consequence one can drive high-side and low-side FETs N-channel or P-channel.
The outputs of two VOM1271's can be placed in series to produce an output of 16 volts enabling FETs with a high gate voltage to be driven from a 3 volt micro. The outputs of two or more may be paralleled for more drive current.

The input diodes have a forward voltage drop of <= 1.6V so in many cases two or more diodes can be wired in series, good for a 5V PIC.

The down side is a slow turn on, not a problem in some cases.

The other down side is the input LED requires >= 10mA.

See Fig 9 of the enclosed PDF the right hand drawing show an N-channel device, only one resistor would be required to connect it to a PIC output.

I have used this type of device in the past and have various types in stock, dual packages are handy.

They great for driving something hundreds of volts from ground.
This class of device is found in solid state relays.





charliecoutas

Fanie, you said "Most FET's already have a reverse polarity diode built-in for protection." Yes but that's not why it's there. It won't replace the backward diode you need for, say, an inductive load, relay coil etc.

The diode you mention, the "intrinsic" diode is across the Drain/Source connections such that an N type MOSFET will conduct if its drain goes negative with respect to its source. It's part of the structure of the device, in some cases it's a nuisance in other case (full bridge say) it's good.

Charlie

JohnB

I never expected this could lead to so much discussion and very interesting.  It turned out that my original N channel solution was fine except I had used the wrong pad layout when laying the PCB.  Thats the trouble with SOT23 devices they do not all have the same layout.
JohnB

dr-zin

Fanie, your point about the IRLZ44N is fair; my mistake.  Good catch!
I agree with Charlie that using the source/body diode to suppress serious inductive kickback will only lead to heartburn.  John's original query specifies a resistive load, so it may not be relevant to him, however.

My opening salvo indicated that I'm not a fan of using MOSFETs.  I avoid them unless I need their advantages (low Rds or an environment conducive to thermal runaway).  BJTs normally fill the bill perfectly for driving loads, they turn off easily, and drive voltage is a non-issue, as even a darlington pair can easily be driven by a 3.3V PIC. An NPN is also cheaper and easier to source.  My preferred answer.  --Paul