Raspberry Pi Hardware GPIO Shutdown

September 12, 2018

I found this snippet of knowledge from the Raspberry Pi forum the other day when searching for a easy way to shutdown a RPi from a simple push button.

Open /boot/config.txt in your favorite Raspbian editor and add the following line:

dtoverlay=gpio-shutdown,gpio_pin=7

You may need to add a pull-up resistor to the GPIO pin or add the instruction gpio_pull=up to the instruction. You can also leave out the gpio_pin and the system will default to GPIO3.

You can also monitor the RPi’s status by adding this line to config.txt:

dtoverlay=gpio-poweroff,gpiopin=27,active_low=1

GPIO27 will be high to indicate when the RPI is running or low when it is shut down.

There is more detailed information here:
https://www.raspberrypi.org/forums/viewtopic.php?t=221997
https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

Advertisements