Skip to content

ImpressiveTaste/pi-power-button

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-power-button - 3 seconds delay

Details

This software allows to turn on and off your raspberry. For turning off the raspberry you will need to hold the button for 3seconds. This makes unintentional turn offs or static current not turn off the raspberry randomly.

Installation

  1. Clone this repo: git clone https://github.com/ImpressiveTaste/pi-power-button
  2. Optional: Edit line 9/10 in listen-for-shutdown.py to your preferred pin (Please see "Is it possible to use another pin other than Pin 5 (GPIO 3/SCL)?" below!)
  3. Run the setup script: ./pi-power-button/script/install

Uninstallation

If you need to uninstall the power button script in order to use GPIO3 for another project or something:

  1. Run the uninstall script: ./pi-power-button/script/uninstall

Hardware

A full list of what you'll need can be found here. At a minimum, you'll need a normally-open (NO) power button, some jumper wires, and a soldering iron. If you don't have a soldering iron or don't feel like breaking it out, you can use this prebuilt button instead.

Connect the power button to Pin 5 (GPIO 3/SCL) and Pin 6 (GND) as shown in this diagram:

Connection Diagram

Is it possible to use another pin other than Pin 5 (GPIO 3/SCL)?

Not for full functionality, no. There are two main features of the power button:

  1. Shutdown functionality: Shut the Pi down safely when the button is pressed. The Pi now consumes zero power.
  2. Wake functionality: Turn the Pi back on when the button is pressed again.

The wake functionality requires the SCL pin, Pin 5 (GPIO 3). There's simply no other pin that can "hardware" wake the Pi from a zero-power state. If you don't care about turning the Pi back on using the power button, you could use a different GPIO pin for the shutdown functionality and still have a working shutdown button. Then, to turn the Pi back on, you'll just need to disconnect and reconnect power (or use a cord with a physical switch in it) to "wake" the Pi.

Of course, for the GND connection, you can use any other ground pin you want.

About

Scripts useful for the Pi power button

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 77.2%
  • Python 22.8%