2

I have seen a number of tutorials on using GPIO P6 to work as a power switch. Is this safe? Does this approach do a "safe shutdown" - sudo shutdown -h now?

enter image description here

From a tutorial:

For this hack, we will use the two-pin P6 header.

What you need: 1x Raspberry Pi Model B Rev.2 1x 2-pole momentary pushbutton switch

For this system, simply solder the two poles of the switch to the two pins of P6. Or, for a "remote" switch, attach two wires to P6 and then connect the switch to those wires.

To reset the RPi while it's on: hold the pushbutton down for about a second. To wake the RPi from halt state: press the pushbutton down until the ACT light turns on.

5

Safe depends on when you plan to use it. Essentially, it is not to different to unplugging and re-plugging you power supply, which may brick your SD-Card if you do it while your operating system is writing it. (Actually, it does a soft reset of the CPU, but this still halts everything including the SD-Card momentarily)

A safe use would be to only push it when the RPi is shut down, as with the sudo shutdown -h now command. Pressing the button will reboot your Pi (as would dis- and reconnecting the power supply).

So - no, this will not shut down your pi safely. If you want a solution to do that, try using the one of the P1 header's pins as input and write a bash script to shutdown when the pin gets pushed. You can then turn on your Pi with the P6 Header, and turn it off with the P1. Be aware that your device will still draw power as long as it's connected to the outlet.

See also the comments and discussion here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.