Electronic – Mosfet usage and P- vs N-channel

mosfet

I'm trying to use an Arduino to enable/disable a 12V solenoid. I used an H-bridge and got that working fine. Then, I decided to simplify things and get a single mosfet instead of a multi-channel H-bridge and have gotten myself very confused. I'm trying to understand the proper way to use a P-channel (or N-channel) mosfet in this setting, and came across this sample circuit on google:

sample circuit

Why is there another transistor involved (the 2N3904), and why is there a diode across the load?

I understand that a P-channel is activated when \$V_{gate}\$ is brought high (above \$V_{source}\$ + \$V_{drain}\$), hence the pull-up, but why the extra transistor? Shouldn't the MCU (in this case the PIC) be doing the same thing?

Also – in the scenario when all I'm doing is turning a load on or off (like my solenoid), is there a reason to use an N-channel vs a P-channel?

Best Answer

Compare the actions of a P and N channel MOSFET in your circuit.

(I've left the junction transistor in to aid comparison.)

enter image description here

The PIC output does not like being connected to 12V so the transistor acts as a buffer or level switch. Any output from the PIC greater than 0.6V (ish) will turn the transistor ON.

P CHANNEL MOSFET. (Load connected between Drain and Ground)

When the PIC output is LOW, the transistor is OFF and the gate of the P MOSFET is HIGH (12V). This means the P MOSFET is OFF.

When the output of the PIC is HIGH, the transistor is turned ON and pulls the gate of the MOSFET LOW. This turns the MOSFET ON and current will flow through the load.

N CHANNEL MOSFET. (Load connected between Drain and +12V)

When the PIC output is LOW, the transistor is OFF and the gate of the N MOSFET is HIGH (12V). This means the N MOSFET is ON and current will flow through the load.

When the output of the PIC is HIGH, the transistor is turned ON and pulls the gate of the MOSFET LOW. This turns the MOSFET OFF.

The 'improved' MOSFET circuit.

We could eliminate the transistor by using a digital N MOSFET type - it only needs the 0-5V signal from the PIC output to operate and isolates the PIC output pin from the 12V supply.

enter image description here

When the PIC output is HIGH the MOSFET is turned ON, when it is LOW the MOSFET is turned OFF. This is exactly the same as the original P MOSFET circuit. The series resistor has been made smaller to aid the turn ON, turn OFF times by charging or discharging the gate capacitance more quickly.

The choice of device is basically down to your design needs although in this case the digital type N MOSFET wins hands down for simplicity.