Skip to content

Control Raspberry pi with physically attached button. Wake, Power Off, and Restart (Double Press) . Python3 script runs as a service with easy installation.

License

Notifications You must be signed in to change notification settings

fire1ce/raspberry-pi-power-button

Repository files navigation

Raspberry Pi Power Button - Wake/Power Off/Restart(Double Press)

Information

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.

gpio layout

raspberrypi-with-button

Requirements

  • python3-gpiozero

Can be install via apt

sudo apt install python3-gpiozero

Install

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

Uninstall

curl https://raw.githubusercontent.com/fire1ce/raspberry-pi-power-button/main/uninstall.sh | bash

Default Behavior

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

Check if service is running

sudo systemctl status power_button.service

About

Control Raspberry pi with physically attached button. Wake, Power Off, and Restart (Double Press) . Python3 script runs as a service with easy installation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published