Page 1 of 1

Shut-down button and Indication for DigiThin

Posted: Fri Nov 06, 2015 2:53 pm
by G8GKQ
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:

Code: Select all

wget 'https://github.com/philcrump/pi-sdn/releases/download/v1.0/pi-sdn' -O /home/pi/pi-sdn
Check that the file pi-sdn has been downloaded by typing

Code: Select all

ls -l
2. Make the pi-sdn file executable:

Code: Select all

chmod +x pi-sdn
3. You can check the file works by typing:

Code: Select all

sudo ./pi-sdn 6 2
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:

Code: Select all

sudo nano /etc/rc.local
and add the following line just before the si570 (or exit 0) line:

Code: Select all

sudo /home/pi/pi-sdn 6 2 &
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

Re: Shut-down button and Indication for DigiThin

Posted: Tue Nov 10, 2015 2:09 am
by G4KLB
Many thanks Dave,
Have tested on two model 'B's and on A Pi 2
Works fine on all three, very handy :D

If you have the post above open at the same time as the SSH window you can copy the text/commands, just click back on the SSH window, pressing the right mouse key will paste it. So didn't have to do any typing. :D :D
Sdown1.jpg
Sdown1.jpg (148.67 KiB) Viewed 7849 times
Sdown2.jpg
Sdown2.jpg (228.3 KiB) Viewed 7849 times