To install this facility, first wire a push-to-make button between pin 22 on the RPi GPIO header and the 3.3v supply (available at pin 1 of the header); also put a 1K resistor between pin 22 and ground (for noise immunity). Pin 22 connects to RPi GPIO 25, which is WiringPi pin 6. The utility uses WiringPi numbers. If you want an indication that shutdown has taken place, wire an LED to ground through a 1K resistor from pin 13 on the RPi header (RPi GPIO 27, WiringPi number 2).
To install the software, you will need to connect the RPi to the internet and to log in, either with a local keyboard and HDMI monitor, or through SSH. Once you are at the command line (press escape 3 times if you are on a local HDMI monitor and RpiDATV is running):
1. Download the software by typing:
Code: Select all
wget 'https://github.com/philcrump/pi-sdn/releases/download/v1.0/pi-sdn' -O /home/pi/pi-sdn
Code: Select all
ls -l
Code: Select all
chmod +x pi-sdn
Code: Select all
sudo ./pi-sdn 6 2
4. To load the utility automatically on start-up, get back to the command line and edit /etc/rc.local:
Code: Select all
sudo nano /etc/rc.local
Code: Select all
sudo /home/pi/pi-sdn 6 2 &
The & at the end of the new line is very important as it stops the rc.local script hanging waiting for your shutdown.
5. Reboot and test your script.
Phil and I would be grateful for any comments on the utility or the installation instructions.
Dave
G8GKQ
Edit: Added 1K pull-down and code snippets