Shut-down button and Indication for DigiThin

The place for discussion about the RPi add-on RB-TV modulator card developed by G4EWJ and supported by the BATC Shop
Post Reply
Site Admin
Posts: 1678
Joined: Sun Mar 22, 2009 1:21 pm

Shut-down button and Indication for DigiThin

Post by G8GKQ » 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:

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 '' -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.


Edit: Added 1K pull-down and code snippets

Posts: 209
Joined: Wed May 28, 2008 10:46 am

Re: Shut-down button and Indication for DigiThin

Post by G4KLB » Tue Nov 10, 2015 2:09 am

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 (148.67 KiB) Viewed 2733 times
Sdown2.jpg (228.3 KiB) Viewed 2733 times

Post Reply

Return to “DigiThin”