Building a Simple High Side Driver
If you’ve ever tried to switch anything that draws considerable current using a microcontroller, chances are you chose to use a low-side driver. Low-side drivers typically connect one side of the load directly to constant power, and one side to an N-channel MOSFET. This solution is very easy and cheap, as the output of a microcontroller (or a gate driver, or a button, or anything that can supply enough voltage to switch the MOSFET) can be used to control the load.
While low-side switching is incredibly commonplace and functions perfectly for most applications, sometimes a system requires that the connection to power is interrupted, rather than the connection to ground. So, for this, a P-channel MOSFET is used. However, a P-channel MOSFET requires that it is able to be pulled to supply voltage in order to turn off. This can be difficult to control with a microcontroller, as the GPIO pins can only go to the logic level of the microcontroller (typically 3.3 or 5v). If the load requires 12 volts, it will be impossible to shut the MOSFET off as the gate can never reach higher than the logic level.
One simple way to solve this problem is to use an N-channel MOSFET to pull the gate of the P-channel MOSFET down, and a pullup resistor to pull the gate high. This way, the logic-level of a microcontroller can turn on the N-channel, which in turn pulls the gate of the P-channel MOSFET down. When the gate is pulled down, the P-channel MOSFET turns on, and the load receives power.
I wired up a version of this on a breadboard, and indeed, when I press the button, the light turns on! However, if I were to replace the light with a load that requires any reasonably low amount of voltage (i.e. not enough to destroy the transistors), I could increase the voltage of the supply and still be able to control the switching with a microcontroller. Pretty neat!