pi power off button
6th September 2024
You can make a shutdown button without the need for a running script by adding this to /boot/config.txt:
dtoverlay=gpio-shutdown
The default pin for the above is pin 5 (GPIO3). which is shorted to ground
If you plan to use I2C then you will need to change the shutdown pin to something else.
For example to change the shutdown pin from the default GPIO 3 to GPIO 26 (physical pin 37), add this to /boot/config.txt
dtoverlay=gpio-shutdown,gpio_pin=26