High Side MOSFET as a switch for Raspberry pi (again)

Thread Starter

niels_a_olesen

Joined Jul 1, 2021
3
Hi

Apologies if this question have been asked before. I haven’t been able to find the specific answer I’m looking for
I’m looking to power cycle a Raspberry Pi using a MOSFET, rather than a relay. I’m aware that, for high side switching, I need a p_Channel MOSFET and some sort of device for pulling the gate to ground (like in the attached figure)

My problem is that I (as a mechanical engineer) get completely lost when trying to select the correct type of MOSFET. There are so many, and I’m not sure if I read the specs right. Could anyone point me in the correct direction?

The RPI uses 5V DC and up to a little less than 1A (when running full steam)

Also, I’ve seen different variations of the attached circuit. For instance, I’ve seen one where a diode is placed in parallel with the MOSFET. I assume that is only necessary when used in connection with high-impedance devices (motors, solenoids etc – flyback current ???). Is that correct?

I’ve also seen an example, where a 20K resistance was placed between the micro-controller and the transistor. Is that necessary?

Thank you in advance

High_side_MOSFET.png
 

dl324

Joined Mar 30, 2015
15,439
The circuit is more complicated than it needs to be. Since Arduino outputs are 5V and you're switching 5V, you don't need the transistor inverter.

1666280690870.png
For this circuit, you need to invert the Arduino output. Q1 is a logic level device that can handle 4A. Don't know if what you intended to use is appropriate because you didn't give a part number.

If you choose to use the transistor, you need to use a current limiting resistor on the base. A 2N3904 could probably sink enough current from the Arduino output to damage it.

Snubber diodes are only required for inductive loads. In those cases, a diode is required if the MOSFET isn't avalanche rated.
 

k1ng 1337

Joined Sep 11, 2020
701
MOSFETS have a body diode that is effectively a flyback diode for reverse currents (close to a short circuit when the FET is on or off). It will offer protection to some degree as part of the package and cannot be avoided.

That being said, I don't think you have to worry about voltage spikes. The Pi has significant protection circuitry of it's own. If you have a scope, hook up some shunt resistors and see if you can witness a voltage spike and if it's beyond your FET maximum rating, add a Schottky diode in parallel to the body diode.

Here is the NDP6020 datasheet. It's logic level and can handle modest currents. Notice the Zener body diode. They even list some it's characteristics.
 

Attachments

Last edited:

Thread Starter

niels_a_olesen

Joined Jul 1, 2021
3
Thanks @dl324 for the answer – that was most helpful!

AO3401 seems to be the right choice for the application indeed. It appears I can also use it in connection with the transistor, in order to not invert the Arduino output (I prefer this, because - in some instances - my entire setup will reboot, and with a logic high requirement for the switch, I can better control the order at which things are switched on – there may be several RPI’s involved)

Thanks also for explaining the reason for the current limiter resistor on the base of the transistor. That makes sense

I wonder if you know of a hole mounted version of the AO3401? I will probably have to make my own PCB, and I’m not sure I can manage very small surface mounted components

Thanks again
 

k1ng 1337

Joined Sep 11, 2020
701
Thanks @dl324 for the answer – that was most helpful!

AO3401 seems to be the right choice for the application indeed. It appears I can also use it in connection with the transistor, in order to not invert the Arduino output (I prefer this, because - in some instances - my entire setup will reboot, and with a logic high requirement for the switch, I can better control the order at which things are switched on – there may be several RPI’s involved)

Thanks also for explaining the reason for the current limiter resistor on the base of the transistor. That makes sense

I wonder if you know of a hole mounted version of the AO3401? I will probably have to make my own PCB, and I’m not sure I can manage very small surface mounted components

Thanks again
The FET I posted comes in TO-220 package. Should be plenty for your Pi. dl324 doesn't show a series resistor at the output of the microcontroller so you should consider one. The idea for one is if the microcontroller output impedance is low, there may be a current spike when the FET latches on. Many users recommend a small value resistor to take care of any spikes and oscillations (10-100Ω). I'm yet to have a problem not having one but I always add one to be safe. Same with flyback diodes etc. since they are cheap insurance for costly devices.
 

dl324

Joined Mar 30, 2015
15,439
So all these experienced users recommending series resistor is bunk?
Without knowing who these experienced users are and seeing some specific examples, I'm not inclined to give them the benefit of the doubt. CMOS outputs all tolerate shorts when they're switching.
 

BobTPH

Joined Jun 5, 2013
6,073
As. I understand it, a gate resistor is needed to avoid ringing when switching at high frequencies. That would not be the case here. I have never used one myself.
 

BobTPH

Joined Jun 5, 2013
6,073
If the node is impedance matched then sure. So all these experienced users recommending series resistor is bunk?
If the node is s impedance matched, the gate will see 2.5V and probably not turn on.

You want outputs to be zero impedance and the inputs to be infinite, not matched.
 
Top