Shut-down button and Indication for DigiThin
Posted: Fri Nov 06, 2015 2:53 pm
Some users have reported corruption of their DigiThin installations possibly due to powering down the Raspberry Pi while it is still running. Phil M0DNY has now come up with a solution. It allows the RPi to be shut down tidily by pressing a front panel button, and then provides an indication that the shutdown is complete. Details of his software are here: https://github.com/philcrump/pi-sdn
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:
Check that the file pi-sdn has been downloaded by typing
2. Make the pi-sdn file executable:
3. You can check the file works by typing:
Press the shutdown button, the RPi should shutdown and then the LED should extinguish.
4. To load the utility automatically on start-up, get back to the command line and edit /etc/rc.local:
and add the following line just before the si570 (or exit 0) line:
Save and exit by pressing Ctrl-X, Y, Enter
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
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