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.
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.
Since it appears that the GPU likely keeps at least some elements of itself running even after the Pi's main CPU has halted, I'm surprised no-one has thought of implementing a bit more of a 'power management' controller into the GPU bootcode, so that people could select their desired behaviour, e.g. to stop the Pi from starting up if power is applied (if that is what some users wanted), or to provide a signal when the CPU is halted (for shutting down external supplies, without the delay that people are having to implement), provide a hardware signal if the power droop is detected, and so on..
All user configurable to use some of the less-commonly used GPIO pins beyond the first 26 pins - and only if specifically configured by the user.
Seems that it could all have been done in that bootcode.bin firmware, instead of having to mess with the sticking-plaster add-on boards that are available for the Pi.