3

I have a Raspberry Pi that I want to mount in an enclosure. The enclosure already has a couple external buttons on it. I'm trying to find some sort of circuit that I could by that I could wire the buttons to, in order to properly shutdown and turn on the Raspberry Pi. By properly, I don't mean "cut the power" to shutdown. I mean an actual Linux shutdown command. I have found the following products:

But what is the deal with the buttons that these companies put on their circuit boards? If you enclose any of those products in an enclosure with an Raspberry Pi, NONE of those included buttons could be accessed externally.

Do people actually use the circuit boards just like that? Aren't there any similar products out there that just have some headers/leads on them that I could plug directly to?

I'm not good at soldering onto circuit boards last I tried it, so I'd prefer to find something that is simply plug and play but that has the ability for an external button to be added instead of some useless surface mount button. I need the circuit to be able to power up the Raspberry Pi and properly send a shutdown signal as well.

RPiAwesomeness
  • 3,021
  • 4
  • 31
  • 52
Jake Wilson
  • 133
  • 1
  • 6

3 Answers3

2

It is trivial to write a script that runs the shutdown command on button press. The complication comes from people who want to power down the Pi. Unless you are using batteries this seems pointless.

It is simple to "restart" the B or B+ from the halt state see https://raspberrypi.stackexchange.com/a/23725/8697

Milliways
  • 62,573
  • 32
  • 113
  • 225
0

Here is a link that shows a complete solution to power a Pi, within it is also a link to a more simple solution to turn the Pi on and off, including power.

https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=132201

Paulv
  • 1
-1

The software part of this is simple: detect the button pressing event happening on GPIO and execute the command shutdown -h now or halt.

But to cut the power properly you will need something hardware. Considering the scenario that you are building a power management HAT that back powers the Pi. You can detect whether the Pi is off by observing the UART lines: then TX go low for extended period the Pi is off. Some circuitry should be built to detect this and turn off the pass transistor controlling power to the Pi.

Maxthon Chan
  • 1,051
  • 8
  • 14