Main > Raspberry Pi & Dev Board
Pi shutdown with toggle switch
pbj:
So, for my purposes, the thing that really kills the Pi are the mandatory shutdowns unless you want to corrupt your SD card. Which means I keep doing things like running DOS MAME cabinets or using an old Xbox.
Then I saw this:
http://www.piups.net/
Supposed to shut it down safely when power is cut, and the Pi will boot back up when power is restored. Seems like that takes care of the issue.
Surely there's got to be a cheaper way to accomplish this?
JDFan:
THere is an instructable ( http://www.instructables.com/id/Simple-Raspberry-Pi-Shutdown-Button/ ) - that includes a python script to shut down the pi using the GPIO -- It can be used with a momentary switch wired to the GPIO so that when the button is pressed it runs the python script to shut down the pi properly - so does what you are wanting without buying anything other than a button (which you probably already have !)
pbj:
I'm thinking more along the lines of this...
http://www.hackerspace-ffm.de/wiki/index.php?title=Raspi_EDLC_UPS
I want to be able to cut the Pi off from wall power and have it safely shut down.
pbj:
Maybe one of you Pi gurus will check in. The idea is that the thing shuts down when GPIO 7 is no longer being fed 3V:
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(7, GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
while True:
print GPIO.input(7)
if(GPIO.input(7) == False):
os.system("sudo shutdown -h now")
break
time.sleep(1)
Think that will work?
DaOld Man:
--- Quote from: pbj on November 12, 2015, 11:08:06 am ---I'm thinking more along the lines of this...
http://www.hackerspace-ffm.de/wiki/index.php?title=Raspi_EDLC_UPS
I want to be able to cut the Pi off from wall power and have it safely shut down.
--- End quote ---
I was thinking along these lines too, except have a 120 vac relay on the high side of the power supply to signal the Pi to shutdown when the relay turns off (Due to 120 VAC power outage.)
I was looking into this for my NES_frankenstein project, but the small relay I have gets pretty warm.
This would be very simple with the mausberry switch circuit, just run one of the PWR wires from mausberry thru a NO contact on the relay.
I was also trying to figure out how big a capacitor I would need on the 5 volt side to keep the pi powered long enough to shutdown. Didnt think about super caps.
This would probably be the simplest way to do it, if you are using the mausberry switch.
Of course the relay contact could also trigger shutdown from one of the GPIO pins.
Navigation
[0] Message Index
[#] Next page
Go to full version