Sunday, January 22, 2017

On Switch for Raspberry Pi

When you gave finished using your Raspberry Pi, you should really shut it down, otherwise, its possible to corrupt the SD card image which would mean you having to reinstall Raspbian. Having shut-down your Raspberry Pi you can get it to boot up again by unplugging and plugging the USB lead, but a neater solution is to add a reset button to your Raspberry Pi.

Most models of Raspberry Pi have a connector just for this purpose.


You will Need

* 2 pin header
* A push button with female header connectors.

For the push button, you can either use a scavenged reset switch from an old PC, or, as I have here, a MonkMakes Button, which is sold as a twin-pack on or


First of all, you need to identify the two holes in your Raspberry Pi board that you need to make connections to. These are circled in yellow in the figures below, for the Raspberry Pi models that I have. The location of this has moved with pretty much every Raspberry Pi release. The two pins will either be labelled RUN or P6

Raspberry Pi 3 model B

Raspberry Pi 2 model B

Raspberry Pi model B ver 2

Raspberry Pi Zero

Raspberry Pi A+

Having found where the pin headers need to go, if you have soldering equipment, then solder the pin header into the socket as shown here:

If you want to avoid soldering, then you can do so as follows. First push the plastic part of the header pin down as shown below:

Then push the header pin through from the underside of the board and push the header sockets of the MonkMakes Button into the header pins so that the Pi is the filling in a header sandwich. As long as the switch is not moved around too much, it should stay connected and make a reasonable contact, but soldering is better if you can.

Shutting Down and Starting

To test out your modification, power up your Raspberry Pi and then shut it down, by selecting Shutdown from the raspberry menu.

Then select the option Shutdown.

After a while the screen will close down and the Pi will go into a 'halt' mode, where it uses minimal power and is basically in standby mode.

Now to start your Pi, all you need to do is press the button and it will start to boot up!

If you liked this article, you will probably like my Raspberry Pi books:



  1. Nice article - Thanks.

    It would be nice to take it a step further and make it work via a remote. Perfect if you using your RasPi as a media centre.

  2. Great article, thank you!

    Can you recommend a place online where the 2 pin header can be purchased?

  3. Most electronic companies sell the headers. Usually in cut-able blocks.
    Off hand, there's:
    Adafruit (
    Sparkfun (
    Jameco (

  4. "When you gave finished using your Raspberry Pi, you should really shut it down, otherwise, its possible to corrupt the SD card image which would mean you having to reinstall Raspbian."

    Just for clarification, you mean a proper shutdown from the OS vs pulling the power, right? I've got several raspis which run 24/7 for months at a time. Even power loss is quite survivable, thanks to the ext4 filesystem.

    Still, very cool to know that it's easy to install a power switch in the raspi, thank you!

  5. As I understand it, this button is for starting up, but not shutting down? I run a headless Pi, shutting it down through SSH, but I would like the button push to send a proper shutdown command. I don't know if this is workable. Anyone know the answer?

  6. If you tap the button while the Pi is running, it will stop the CPU and cause the OS to reboot.

    A better option maybe to pull pin GPIO.3 to ground to wake the CPU from a shutdown. Recent loader blobs monitor this pin after a soft shutdown.

  7. One can get USB cords with switches in them