Pi Zero W Safe On/Off Switch

A way to use a push button to call up a service to safely shut the Raspberry Pi down without having to SSH into it.

Pi Zero W Safe On/Off Switch

Sid over at hackster.io devised a way to use a push button to call up a service to safely shut the Raspberry Pi down without having to SSH into it. I discovered this little trick will turn your Pi back on also! Now you'll have a headless Pi with a on/off switch.

Pi-Zero-on-off-switch-side

  • Install Git Server sudo apt-get install git
  • Boot your Pi and clone the git git clone https://github.com/shivasiddharth/pi-shut
  • Install it sudo chmod +x /home/pi/pi-shut/installer.sh
    sudo /home/pi/pi-shut/installer.sh
  • Wire the push button so the top right lead plugs into the top 3rd hole from the left and bottom left lead plugs into the bottom 3rd hole from the left (your SD card will be on the left and facing up)
  • Start the service with sudo systemctl start on-off-pushbutton.service
  • Wait a minute or so for it to register ...
  • Push the button and verify your connection is lost in Terminal and the green blinky goes out.

Pi-Zero-on-off-switch-top

  • Remove the SD card, get out the soldering iron and have fun ...
  • Insert your SD card, boot and SSH in terminal to confirm your Pi is up and running.
  • Push the button you just installed to verify Terminal loses connection and the green blinky goes out.

I advise finding some 5 or 6mm pushbuttons with long leads so you can fold one down and run it through the GPIO header. As you can see in the picture I had to get creative and use some twisted 28 gauge vape coil wire to make it work.

I see a better soldering device for me in the near future ...