Rpi GPIOI Shut Down Switch

Viewed 7 times

I am new to Raspberry Pi and am trying to use the headless shutdown module provided by Adafruit.

I downloaded the script of Adafruit-GPIO-Halt to my Raspberry Pi, installed it to the /usr/local/bin/gpio-halt file and even made a file on the system/system folder, following the steps on https://www.recantha.co.uk/blog/?p=13999.

However, the file in the systemd/system folder is getting saved with a .service.save extension and system prevents me from using the line sudo chmod 644 /lib/systemd/system/gpio-halt.service by saying, ‘Permission denied.’

I would like to set-up the code to run on start-up. I am using Raspbian Version 9(stretch). Please help.

 New contributor
  • 1
    If you want help post a link to the module, and describe in detail what YOU did, not a link to an old tutorial for an obsolete OS. – Milliways 2 hours ago
  • Hi @Atharv Goel, Welcome and nice to me you. Ah let me see, the headless Rpi shut down trick has many variations, yours is not that newbie friendly because you need to install the newbie scary Git thing, and compile a hard to understand C program. I would suggest you to try a more newbie friendly, no Git, no compile, just a short python script. / ton continue, … – tlfong01 31 mins ago
  • 1
    Are you just trying to shutdown with a button? I thought you were referring to a power module NOT code. – Milliways 27 mins ago
  • The secret Rpi shut down trick needs to short/connect two Rpi GPIO pins, using a manual switch, or just a paper clip. There is also a David Copperfield like magic variation using a tilt switch, then you don’t even need a paper clip, just TURN KEYBOARD UPSIDE DOWN and Rpi will switch off by itself. The trick is here: (1) Simple Shutdown Raspberry Pi Button by Using GPIO: instructables.com/id/…instructables.com/id/…. – tlfong01 22 mins ago
  • The tilt switch, a cheapie toy like thing is just a switch which shorts/connects two contact points when you tilt it. For more details, you can search this forum using the keyword “tilt switch”. Now if you show your magic Rpi shut down to your bad friends or your daughter, then they would start to respect you more than you deserve. 🙂 – tlfong01 16 mins ago
  • PS – I learnt this trick in Rpi One days, and I read about it from time to time in various forums. I guess this trick works in all OS versions of Rpi1/2/34. The other good thin is that although you don’t need to know how the program woks, if you like to know a little more about python “low level system) programming, eg, (1) How to mess around with the program starting rc.local file, (2) python OS commands like “os.system(‘sudo shutdown -h now’)”, you can show off this “advanced” stuff to your bad friends, conveniencing them you are not just a friendly, blindly copy, paste, run programs guy. – tlfong01 just now   Edit

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: