by PeteB » 21 Apr 2016, 04:47
by Dohmar » 21 Apr 2016, 06:29
by ingohz » 21 Apr 2016, 07:36
PeteB wrote:Here is how I imagine the hardware would look, with everything on a small board about half the size of a Pi.
Standard barrel connector for a 5V supply, momentary switch on the same board close to the connector, or on an extended pair of wires, if inside an enclosure. Room for a small number of other components, latching relay or the mosfet switch from the example posted above, power supplied to the Pi and a DAC through the GPIO connector. Resettable fuse (Polyfuse), maybe.
The switch in the pics is temporary, the one I intended to use turned out to be too poor quality to bother putting it on the board.
The ribbon cable is a convenience, I don't have the patience to connect/disconnect several single-pin jumpers several times, let alone make new ones.
by PeteB » 21 Apr 2016, 15:07
by Wizzer » 23 Sep 2016, 15:32
by moocowe » 25 Sep 2016, 15:13
import RPi.GPIO as gpio
gpio.setup(4, gpio.IN, pull_up_down=gpio.PUD_UP)
os.system('sudo shutdown -h now')
Description=Cut power on shutdown
if [ "$1" = "poweroff" -o "$1" = "halt" ]
echo "4" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio4/direction
echo "0" > /sys/class/gpio/gpio4/value
by hondagx35 » 25 Sep 2016, 21:43
I've also tried the following script in /lib/systemd/system-shutdown, but I don't think it's doing anything at all.
chmod +x /usr/lib/systemd/system-shutdown/yourscript
by moocowe » 25 Sep 2016, 23:12
by Tall Person » 31 Oct 2017, 00:20
from time import sleep
import RPi.GPIO as GPIO
if ( GPIO.input(25) == False ) :
btn_timer = btn_timer+1
if ( btn_timer > 5 ) :
os.system('sudo shutdown -h now &')
elif (btn_timer > 2) :
os.system('sudo reboot &')
elif (btn_timer > 0.5) :
os.system('sudo ifup wlan0 &')
btn_timer = 0
by Tall Person » 31 Oct 2017, 00:41