How To Use My Raspberry Pi Safe Shutdown Board

by Doomy on

In this guide, I will walk you through how to wire up my Raspberry Pi safe shutdown board using either an Adafruit’s PowerBoost 1000c or Helder’s RetroPSU. The process is very straight forward and only requires five wires leading to the safe shutdown board from the PSU and Raspberry Pi. Safe shutdown is essential to portable projects like The Gameboy Zero builds of SudoMod.com. This guide assumes you already know your way around a Raspberry Pi’s hardware and software, specifically its config.txt.

Disclaimer: This post was written for informational purposes only. I assume no liability or responsibility for damaged equipment or for any injury you may incur attempting to replicate this project. LiPo batteries can go boom. Be careful and always check polarities before plugging them in.


Raspberry Pi Safe Shutdown Board for Adafruit’s PowerBoost 1000c and Helder’s RetroPSU

$10.00

A simple safe shutdown solution for your portable Raspberry Pi project


BOM


Decide which GPIOs you want to use

This step is subjective to your own project. For the sake of this write up, I will use one of my recent projects as an example where I am using GPIO 27 for Shutdown and GPIO 11 for Power Off.


Using The Safe Shutdown Board with Adafruit’s PowerBoost 1000c

Raspberry Pi Safe Shutdown Board PowerBoost 1000c

Connect the PowerBoost 1000c in the following way:

  • Using the 22-24 gauge wire, connect “BAT” from the PowerBoost to one leg of your switch
  • Using some more 22-24 gauge wire, connect the middle leg of the switch to the “SW” of the safe shutdown board
  • Connect the “GND” pads together using the 22-24 gauge wire
  • Using the thinner wire, connect “EN” on the PowerBoost to the “EN” pad on the safe shutdown board

Now connection the PO and SD pads to your Raspberry Pi’s GPIOs:

  • Continue using the thinner wire for “PO” and “SD”. You can also use breadboard wires if you don’t want to solder directly to the GPIO pins on the Pi
  • The “PO” pad from the safe shutdown board connects to whatever GPIO you have setup in your /boot/config.txt file for the “gpio-poweroff” line
  • The “SD” pad connects to the GPIO for the “gpio-shutdown” line

Using The Safe Shutdown Board with Helder’s RetroPSU

Raspberry Pi Safe Shutdown Board RetroPSU

Connect the RetroPSU in the following way:

  • Using the 22-24 gauge wire, connect “BAT+” from the RetroPSU to one leg of your switch
  • Using some more 22-24 gauge wire, connect the middle leg of the switch to the “SW” of the safe shutdown board
  • Connect the “GND” pads together using the 22-24 gauge wire
  • Using the thinner wire, connect “EN” on the RetroPSU to the “EN” pad on the safe shutdown board

Now connection the PO and SD pads to your Raspberry Pi’s GPIOs:

  • Continue using the thinner wire for “PO” and “SD”. You can also use breadboard wires if you don’t want to solder directly to the GPIO pins on the Pi
  • The “PO” pad from the safe shutdown board connects to whatever GPIO you have setup in your /boot/config.txt file for the “gpio-poweroff” line
  • The “SD” pad connects to the GPIO for the “gpio-shutdown” line


Setting up your /boot/config.txt

In order for this safe shutdown board to work properly, we need to tell the Raspberry Pi which GPIOs you’ve decided to use. You can do this by adding these two lines to your /boot/config.txt file:

dtoverlay=gpio-poweroff,gpiopin=11,active_low=1
dtoverlay=gpio-shutdown,gpio_pin=27,active_low=1

Make sure to change your GPIO pins to match your project.


Test your setup

With everything powered down and connected according to the steps above, it’s time to flip the switch to the on position. The Raspberry Pi should start to power on. Once it’s fully up to whatever OS you’re running, typically RetroPie, flip the switch to the off position. If everything was done correctly you should now see the Pi running its power down routine and ultimate power off completely.

One of the coolest parts of this circuit is it not only powers off the Raspberry Pi completely but also the PSU you’re using. No more worry about waking up to find a dead project because the PSU trickled your battery dead!


Troubleshooting

With custom projects, it’s difficult to provide a “one size fits all” troubleshooting script but I will try my best to cover the typical errors.

The Raspberry Pi powers on for a few seconds then powers off
Check to make sure you “PO” and “SD” GPIO wires aren’t reverse

The Raspberry Pi won’t shut off once powered on via the switch
Check to make sure you’ve connected your GPIOs correctly but also make sure you’re calling the correct GPIOs in your config.txt.

I get a thunderbolt icon when running my Pi
You might not being using thick enough gauge wires on your power lines. This isn’t synonymous with my safe shutdown board but all the same double check your gauges.


Acknowledgements

I have to thank Helder for walking me through his RetroPSU, while I struggled to get this circuit to work with the various resistors values to match. Check out Helder’s projects over at his website: https://www.heldergametech.com/

Finally, the person who really made this project possible is Gerrit Gazic. If it wasn’t for Gerrit taking time out of his busy day almost 4,000 miles away, I doubt it would have been completed. Thanks to the power GitHub and Discord, Gerrit helped me through breadboarding and trying a ton of different resistors, diodes, and even MOSFETS to nail down what was needed. More than anything though, he encouraged me to keep pushing forward. Please check out his incredible work over at GitHub: https://github.com/geaz

Discussion