When Raspberry Pi is powered off, shortening GPIO3 (Pin 5) to ground will wake the Raspberry Pi.
This script uses pin GPIO3(5), Ground(6) with momentary button.
- python3-gpiozero
Can be install via apt
sudo apt install python3-gpiozero
This will install the script as service
and it will run at boot
curl https://raw.githubusercontent.com/fire1ce/raspberry-pi-power-button/main/install.sh | bash
curl https://raw.githubusercontent.com/fire1ce/raspberry-pi-power-button/main/uninstall.sh | bash
Button Press (Raspberry Pi is ON) | Behavior |
---|---|
Single | Nothing |
Double | Reboot |
Long press and releases (above 3 seconds) | Power off |
Button Press (Raspberry Pi is OFF) | Behavior |
---|---|
Single | Power On |
sudo systemctl status power_button.service