Skip to content

A small python program that shuts down a RaspberryPi after connecting GPIO pin 3 to GND

License

Notifications You must be signed in to change notification settings

Felix-Franz/RaspberryPi-GPIO-Shutdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

RaspberryPi GPIO Shutdown

A small python program that shuts down a RaspberryPi after connecting GPIO pin 3 to GND.

Download

Just download or copy the code of this little software: Download
Save it anywhere on your pi.

Requirements

You only need python and RPi.GPIO.
If you are running Raspbian everything should be installed! If python is not installed you only need to do this:

sudo apt-get update
sudo apt-get install python

To install RPi.GPIO run following commands:

sudo apt-get update
sudo apt-get install rpi.gpio

If that doesn't work use this. If 0.6.2 is not the latest version copy the download link from here: https://pypi.python.org/pypi/RPi.GPIO

sudo apt-get install python-dev gcc
wget https://pypi.python.org/packages/c1/a8/de92cf6d04376f541ce250de420f4fe7cbb2b32a7128929a600bc89aede5/RPi.GPIO-0.6.2.tar.gz
tar -xvf RPi.GPIO-0.6.1.tar.gz
cd RPi.GPIO-0.6.1
sudo python setup.py install
cd ..
sudo rm -rf RPi.GPIO-0.*

Run it!

Just navigate with your terminal to your downloaded file and run

python GPIO_Shutdown.py

Replace the GPIO_Shutdown.py with your filename.

You may need to run it as root:

sudo python GPIO_Shutdown.py

Connect pin3 to the GND pin next to it (for example with a paperclip). Then the RaspberryPi starts to shutdown.
If you are not sure about what pin is the right one, just look at the RaspberryPi Website.
Be sure to use the right pin, using the wrong one may cause a damnage of your RaspberryPi!

Additional configuration

If you want to use another pin than pin3 just change the 3 after GPIO_Pin in the file It may look like this:

...
GPIO_Pin = 5
GPIO.setmode(GPIO.BCM)
...

Run on startup

To run it automatically after the startup of RaspberryPi, you just have to add following line above exit 0 to /etc/rc.local.
You have to replace path_to_file with your own path to your downloaded file. python /path_to_file/GPIO_Shutdown.py &

Uninstallation

Just remove your downloaded file and the line in /etc/rc.local
If you do not need python anymore use: sudo apt-get purge python



I hope this helped you a bit.
Have fun with this small software.

About

A small python program that shuts down a RaspberryPi after connecting GPIO pin 3 to GND

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages