High side switch with P-channel MOSFET

Hello,

I'd like to switch 12V to an external module, I'm intended to use a high side switch. The current consumption of the module is relatively small, around 200-300mA. Basically the arduino board will be supplied through a fuse, and I'd like to switch the voltage after this fuse to the module.

I found this example on the forum for high side switching with a P-channel MOSFET.

Example
PFetSwitch

Wouldn't a series resistor to the gate terminal needed?

Without that there is nothing to limit the current flowing from Gate to the GND when the NPN is turned on. I know that this current is just a short pulse until the Gate-Source capacitor is discharged and the FET is fully turned on, but couldn't this pulse damage the NPN transistor? (e.g. a 2N3904 with 200mA CE current rating)

Thanks in advance.

No, the gate is completely isolated(*), no (DC) current flows to/from it.

What you might want is a collector resistor on the NPN and a 12V zener across the
FET gate/source to prevent any overvoltage spikes on it.

(*) A layer of silicon dioxide separates the gate from the rest of the device.

I don't think you'll need the gate series resistor. The 2N3904 should be able to handle that with no problem.

However, I think the pulldown resistor on the NPN base should be a much higher value, like 100k, and it should be placed to the left of the base series resistor. The original configuration is a voltage divider, which you don't need. Actually, some might argue that the pulldown resistor isn't needed at all.

1 Like

I don't think you need a resistor because the amount of energy stored in the gate capacitance will be far below the energy required to damage the transistor. If you really want to go into this then check the data sheet for the transistor and look for a peak maximum current for the collector. If you still want to add a resistor then it should limit the current to this value from 12V.

I don't think you need the base pull down resistor at all, when the Arduino output goes low it will pull any stored charge out of the base.

I didn't mean continous gate current, just the current "pulse" during the turning on process. But as @ShermanP and @PerryBebbington said, it should work without the series resistor.

I thought for the base pull-down because of the explanation in the linked post:

"I would still add a pull-down resistor on the NPN’s base. The IO on the Arduino defaults to input (High Impedence). At this time, the base of the NPN would effectively be floating. You would get random switch-ons until the Arduino is powered up and booted and the IO pin has been set to OUTPUT and driven low."

That's true for a MOSFET, but a bjt requires current into the base to turn on and a pin configured as input won't supply any current.

At power up time, the Arduino pin is high Z.

The transistor is therefore OFF.

The MOSFET is therefore OFF.

Change the base to GND resistor to 100k.

Heh, heh, now I'm the guy who is always critical on that point, but that is only in respect of delivering the full gate voltage to a FET.

The base voltage of a BJT is about 0.7 V; you do not need more, and the current bleed from the base from a pull-down is in this case, negligible even with two 10k as shown.

Do you need a pull-down? Most likely not as there should not be any source of leakage current to feed the transistor base, but perhaps "just in case".

Do you need to "pull any stored charge out of the base"? no, because we are not using this for PWM for which is it unsuitable, only for switching on and off occasionally. The transistor is in saturation, so it will not turn off rapidly in any case. The quoted post was not about PWM, just switching car lights.

Do you need a series resistor to the gate? No, a BJT will handle current pulses perfectly well up to hundreds to milliamps, not the 40 mA limit for the ATmega. 10k base drive at 5 V - 500 µA, β of 200 would limit the collector current to 100 mA, well within the limits for most transistors.

We can't go back and comment on that old locked post now, but that is actually somewhat nonsensical. :grinning:

@Paul_B, I know the NPN will still work fine in the divider configuration, but I just think it's best to get in the habit of not using dividers unless you really need one for some reason, whether bipolar or FET.

And I'll just say that I personally wouldn't use the pulldown at all here. When the Arduino is powered down, the GPIOs are clamped by the protection diodes, so the base isn't actually floating. It's only when it powers up initially that they are tristate. But even then, there's just no current source that I can see that would turn the NPN on.

With no gate resistor installed there is no limitation in NPN's collector current. So add the resistor in order to exactly do that and everything will be fine.
Depending on your load and associated wiring you may add a free-wheeling diode parallel to your load.

But if you press the reset button the MOSFET probably won't change state until the pinMode is set to output again, and in particular if you upload a sketch it will be floating and may or may not change state during the lengthy process. Far better to define a MOSFET as off when the pin floats using a pulldown.
Some logic-level MOSFETs start to conduct a bit even at 0.5V gate, so the protection diodes in the Arduino may not prevent it leaking when the power's off.

Which is what I said, but with a 10k collector resistor, it would only take a Megohm of leakage in the circuit between 12 V and the transistor base, to turn it on.

What has the FET's gate resistor possibly to do with the previous discussion?

Haven't seen the OP for some hours, but I saw no suggestion of the particular "module" being inductive. :roll_eyes:

But were we not talking about the BJT, not the FET?

I don't understand this at all. Do you mean C-B leakage, or some other path?

I struggle a little bit with your question because I don't get it well translated into my native language. But in case you refer to a thread running in parallel ("gate resistor") it is exactly the same question - and so my answer.

No, except the symbol used in the schematic above - which I would use for an inductor... :wink:

Huh, sorry for the misleading schematic, it was just an example. As I mentioned, an external module has to be supplied, with an ~1m long supply wire. So the wire itself will have some inductance, but I don't think it will cause any problem, especially considering that the switch off speed will be relatively slow with only the gate pull-up resistor (passive drive). However I'm thinking to replace 10k pull-up with a 4.7k.

I try to summarize the suggestions into an LTSpice model, and do some simulations perhaps.

  1. Base pull-down increased to 100k.

  2. There is topic running right now about gate resistors. Based on content I decided to go with a relatively slow value.

  3. Added a diode parallel with the supply (it will be a TVS diode with 15V breakdown voltage) to protect the load and also the mosfet gate (when it is switched off) from any voltage peak.

  4. I will probably use a IRFD9120 P channel Mosfet, but I couldn't find it in LTSpice, so I used a replacement with similar Gate Charge value (which is critical regarding switch on-off times)

The circuit:

Simulation with varying R2 (1k, 4.7k, 10k).
As expected, the turn on is not really affected by R2 value, it takes about 200ns.

However the turn off time is quite affected, also the continous ("wasted") CE current will be higher).

1k --> 13 us --> 12 mA
4,7k --> 50us --> 2,55 mA
10k --> 100us --> 1,2 mA

I think the 4,7k is a good compromise.

I was being very broad! Moisture on the board! Who knows! :grinning:

If you are using a BJT (common transistor) in the circuit shown, rather that a microcontroller controlling the FET, the 220 Ohm series resistor to the FET gate is entirely unnecessary as is the reverse diode unless the load is actually inductive.

Note that a TVS diode may not be appropriate as a freewheel diode for inductive loads. TVS diodes do a good job protecting against low energy, high voltage pulses, but they're fairly flimsy devices when it comes to more prolonged dissipation.

The linked topic had some content about gate resistors and how they can damp ringing if some stray inductance is in the gate circuit. I think it won't harm and the turn on process is fast enough (~200ns) for my application, even if 220 Ohm is applied.

I thought of the TVS diode to protect the circuit from any voltage peak coming from the power supply, not for freewheeling.

@anon35827816 You are right, for a freewheel diode I'd use a standard rectifier diode.

Not to mention that, as far as I know, for freewheeling purpose, the diode should be parallel only with the load, because the switch (in this case the p-channel mosfet) should be protected against any induced voltage after switching off an inductive load.

I prefer Shottky diodes for this purpose due to their speed. In fact, in most situations I prefer Shottky diodes, and for rectifiers fast-switching diodes like the UF4007.
I agree that the use of the diode here is not as a freewheel diode, so my comment was a bit off topic.