To purchase a completed board or to get a BOM so you can make your own, visit the store page here.
Like the simple on/off circuit, this is based around the IRF7319 dual mosfet. This is not the only mosfet capable of performing the duty, but it has characteristics that make it well-suited. Also, like the previous circuit, the +5v leading to the Pi is switched on and off. This is compatible with any power source.
A momentary press of the power switch will latch the circuit on and provide power to the system. The circuit is stable once latched on.
From here we need a way to power the system off, and the first method is built into the circuit. Pressing and holding the switch for about 5 seconds will drain Capacitor C3 and disable the N-channel MOSFET M2, which in turn disables the P-channel MOSFET M1 and kills power to the system. Of course, this should normally only be done after the Pi OS has been properly shut down.
We need something more automatic though. The circuit needs to power off automatically once the OS shuts down. This is done using the M3 MOSFET. In my design, it consists of a P-channel MOSFET with its gate connected to GND using Resistor R5. This keeps the MOSFET active, meaning it begins draining C3 as soon as the circuit is latched on. This forces the system off after 5 seconds unless the gate of M3 is pulled high. This is where the PI-OFF pad comes in. In the circuit, the pad called PI-OFF is connected to the gate of a MOSFET, and connects directly to the TX pin on the Pi. This pin is typically used for serial data communication, but it has some characteristics that we will make use of here. Within a couple seconds of powering on, the OS automatically switches the TX pin to 3v3, and this pulls the gate of M3 high which disables M3. The TX pin remains at 3v3 until the OS has fully shut down. Once the OS shuts down, R5 pulls the gate down to ground again and enables M3. This causes C3 to begin draining and within 5 seconds the system powers off.
One additional great feature to have is the ability to shut the Pi off using a pushbutton switch. Even better than that is the ability to shut the system down using the same button that turns the system on. With a small addition, this circuit can be used for both the power-on and power-off. One diode is added between the momentary switch and the P-channel mosfet gate, and the other diode is added between the momentary switch and a GPIO pin. I recommend the BAT54C Dual Diode because of its small size. The PI-SENSE pad connects to a GPIO pin and is used to issue a proper shutdown command. This requires a software component (guide will be made when I finish the PSPi PCB) to look for a momentary press of the power button. The GPIO pin is pulled high to 3v3 with the internal resistor. When the button is pressed, the GPIO pin connects to GND and causes a voltage drop on the pin. The software detects this drop and issues the shutdown command. Once the shutdown completes, the remaining circuits explained previously come into play and cause a complete shutdown.
Advanced Feature 2:
It’s also possible to use the same GPIO pin for both the PI-SENSE and PI-OFF features. This is somewhat more advanced and doesn’t really add anything other than additional complication unless the TX pin is needed for another use.
Questions? Comments? Leave a reply or visit the forum.