To use GPIO shutdown for the Raspberry Pi, add following lines in the file /boot/config.txt
- Only one signal can be used (only one gpio-poweroff)
- When gpio-poweroff and gpio-shutdown is used, the gpio-shutdown can only shutdown the Pi, not start
- When only gpio-shutdown is used, the gpio-shutdown can also start the Pi
edit file: sudo nano /boot/config.txt

# signal power off with green led
dtoverlay=gpio-poweroff,gpiopin=16

# signal power off to GPIO GP1 pin
dtoverlay=gpio-poweroff,gpiopin=18

# shutdown Pi when joystick button is pressed
dtoverlay=gpio-shutdown,gpio_pin=26,gpio_pull=up

# shutdown Pi when GPIO GP0 on Hat is set to low
dtoverlay=gpio-shutdown,gpio_pin=17,gpio_pull=up