I was looking for a power switch or button for the Raspberry Pi 3. Does anyone have a recommendation on a good switch?
I was looking for a power switch or button for the Raspberry Pi 3. Does anyone have a recommendation on a good switch?
It is possible to add your own switch that works as both an on AND off push button.
It can be done trivially with some cheap components and a script.
I wrote a blog post on what I have set up:
Hi Graham,
Very interesting. Could you explain how come grounding pin 5 causes the Pi to boot up if it is halted? (I don't disbelieve, I believe you, I just genuinely didn't know about it, so I'm just curious to know more). Does the Pi pull-up that pin, in shutdown state? Is this at a particular run level, or when the CPU is halted?
Hi Shabaz,
I honestly don't know for sure what the technical details are as to why shorting pins 5 and 6 cause it to boot. I found that info on various forums like this one. I assume that the Pi must pull up pin 5 when it shuts down. My shutdown script essentially executes 'shutdown -h now', which safely shuts down and cuts power to the USB ports (which is ideal for me because I'm powering arcade controller button lights from the USB).
My original version didn't have the diodes or pin 13 connection, and I just used pin 5 in the script. This worked fine, however pin 5 is a bit of a 'special' pin, and a lot of hats seem to use it, which is why I decided instead to use pin 13 for shutdown detection. If you are doing a really simple project with no hats then you can just use pin 5 for both boot and shutdown, with no diodes.
Hi Graham,
Thanks for the info! I'll try it sometime hopefully, that's pretty neat that it can cause it to boot up.
Nice to find out ...google provided the following
https://elinux.org/RPI_safe_mode#Wake_from_Halt.5B1.5D
Thanks to the above, it seems pulling pin 5 low after sudo halt will make it boot.
After power interruption, pulling pin 6 makes it boot ... however I thought it boots when you apply power, so not sure what they mean.
mark
Raspberrypi.org crazy documentation.. looks like at some point, shorting pins 5 and 6 also had an effect, to boot into some 'safe mode'? (Maybe they mean runlevel 2). But apparently the Gertboard product messed it up by triggering it accidentally so they stripped it from their bootcode.bin firmware:
I wonder how they are achieving such programmable behaviours anyway, when the ARM processor cores are halted. I wonder if this means the GPU continues running..?
I wonder if this means the GPU continues running..?
The inner workings of Raspberry Pi are like women ... mere mortal men are not supposed to know much less understand.
mcb1 wrote:
Nice to find out ...google provided the following
https://elinux.org/RPI_safe_mode#Wake_from_Halt.5B1.5D
Thanks to the above, it seems pulling pin 5 low after sudo halt will make it boot.
After power interruption, pulling pin 6 makes it boot ... however I thought it boots when you apply power, so not sure what they mean.
mark
You are correct that it boots when power is applied, but after you have halted the system you would have to unplug and replug the power to switch it back on, which is messy. With the above solution you can just toggle power with the button as much as you like without touching the power cables or supply. It's good for when you want to make something where the Pi is hidden (in my case, an arcade machine).
mcb1 wrote:
Nice to find out ...google provided the following
https://elinux.org/RPI_safe_mode#Wake_from_Halt.5B1.5D
Thanks to the above, it seems pulling pin 5 low after sudo halt will make it boot.
After power interruption, pulling pin 6 makes it boot ... however I thought it boots when you apply power, so not sure what they mean.
mark
You are correct that it boots when power is applied, but after you have halted the system you would have to unplug and replug the power to switch it back on, which is messy. With the above solution you can just toggle power with the button as much as you like without touching the power cables or supply. It's good for when you want to make something where the Pi is hidden (in my case, an arcade machine).