Im trying to get a Raspberry Pi set up so that when I run ‘shutdown’ on the OS, it will also shut off it’s own power. Has anyone ever done this?
I was hoping to use a Mini Pushbutton Power Switch but it has turned out to be non-simple. Under Linux, the GPIO pins apparently can be set to steady output high, or steady output low, after shutdown using the special gpio-poweroff setup in /boot/config.txt. There is also an ‘active_low’ feature which apparently will force a transition from high to low to trigger events.
My issue is that no matter how I try to hook a GPIO to the Power Switch, i can’t seem to make it happy. If power is off, and I connect GPIO 2 to ‘Off’ on the switch, then hit the pushbutton to turn on, the Pi power light flashes for a moment then shuts down - almost like as part of the bootup process, Gpio2 is going high for a moment and triggering the ‘off’ on the Power Switch momentarily, so it’s doing an endless loop of partial booting.
I also tried GPIO17 instead of GPIO2, connecting to Off on the switch - this is supposedly naturally low so it seems like it’s OK when booting up, but then i can never seem to get it to trigger the ‘off’ pad on the switch after shutdown so its not shutting off power.
Also tried connecting to Control instead of Off, this was a bit of a mess
I will try again later but I was wondering if this has not been done before? Is it necessary to put some in-between circuit between the GPIO pin and the pushbutton switch?
I also looked into the slide-switches but i couldnt figure out if / how they allow software self poweroff through a pin.