Pinterest Stumbleupon Whatsapp

Your Raspberry Pi has frozen. Perhaps a new component has failed, or the system has ground to a halt processing some bad code. Either way, you now have to unplug and reconnect your Pi’s power supply as manually shutting down isn’t possible.

Removing and replacing the USB power cable isn’t ideal, and it is certainly putting undue wear and tear on your Raspberry Pi, particularly the power port itself. What the system really needs is a reset switch, but sadly none was included.

Fitting A Reset Switch To Your Raspberry Pi

It is relatively simple to add a reset switch. Three methods are available to you, each suited to a particular skill level. For the beginners, an inline power switch on the micro-USB cable powers your Pi is the easiest.


Are you more of an expert? If the USB reset button seems simplistic, using a jumper (a small plastic square housing some metal connectors) commonly found on motherboards or the back of PC hard disk is also an option.

For those of you happy to wield a soldering iron, however, you can also fit your own pins to the P6 header on your Raspberry Pi, and then connect a PC-style reset switch.


Let’s look at all three options in more detail.

Add An Inline Power Switch To Your Raspberry Pi

Quite clearly the simple option, adding a inline power switch to your Raspberry Pi saves you the hassle of playing with the GPIO header or even soldering your own pins to the board.

All you need to do with this device is connect it to the micro USB connector on your Raspberry Pi, and then connect the mains electric to the power switch. This make it a universal option across all models (such as the new Raspberry Pi Model A+ What Can You Do With The New Raspberry Pi A+? What Can You Do With The New Raspberry Pi A+? Curiously, this new Raspberry Pi doesn't feature any additional hardware. In fact, it has fewer ports. Just what are the Raspberry Pi Foundation up to? Read More ), where using the GPIO or adding pins to the P6 header isn’t an option.

Head to for one of these inline devices which retail for around $20 plus shipping.

Jumper + GPIO = Reset Your Pi!

With a motherboard jumper you can request the Raspberry Pi commences an orderly shutdown, the equivalent to entering

sudo shutdown –h now

with the help of a script.

Identify the GPIO pin array. On the Model A and B (Rev 2) this is found on the opposite edge of the board from the power connector, and comprises 26 pins. On the Model A+ and B+ you will find a 40 pin array occupying almost the entire long edge above the Raspberry Pi Model B+ printed text.


In each array, GPIO 3 – pins 5 and 6 – can be used to initiate shutdown. Copy this script from github and execute it on your Pi (if you’re using SSH, which you should be Setting Up Your Raspberry Pi For Headless Use With SSH Setting Up Your Raspberry Pi For Headless Use With SSH The Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up. The benefits of SSH go beyond upsetting the daily screening... Read More , copy the script from your browser and then right-click in the SSH window to copy). Make it executable with

sudo chmod 755 then sudo ./

With the jumper attached, the script polls the GND (ground) pin to check if anything is connected. Once the pins are connected by the jumper, the script will run and shutdown the Pi safely.

To save you running the script each time you boot your Pi, open /etc/crontab in nano and add this line:

@reboot        root    /home/user/scripts/

Press CTRL+X to save and exit. This will regularly poll GPIO3 and when the device detects the jumper on the pins it will automatically shut down.

When complete, remember to remove the jumper. You might leave it attached to just one of the pins, so as not to lose it. If you don’t remove it, the Raspberry Pi will not boot correctly.

Be aware that this method is no good for situations when the Pi has crashed or frozen. It’s essentially an automated way of running the safe shutdown command, so there’s a strong chance that if the device is frozen, the script won’t run.

Give Your Raspberry Pi A PC-Style Soft Reset Switch

Adding a couple of pins to the P6 header (labelled Run on the Model B+) using a soldering iron and some fine-gauge solder designed for electronic work allows you to add a PC-style reset button to your Pi. This requires a momentary switch, which is essentially an instantaneous on/off action.


All of these components, and the connecting wire, can be purchased online or from electronics retailers. You may find that the pins can only be bought in bulk, however, leaving you with more than you need.

In this situation, and in light of the requirement for a PC-style reset button, it’s worth checking any old computers you have. The pins and reset switch seen here came from an old motherboard and a recently-disused tower. Alternatively, you might purchase a small board-mounted button for a wire-free solution.

Only the Model B Rev 2 and Model B+ Raspberry Pi have the P6/Run header. To find it on your Model B Rev 2, look for the HDMI port, where you should find two small holes a few millimetres apart.


On the B+, the header next to the display ribbon connector, near to the microSD slot, and to the right of the printed “© Raspberry Pi 2014”.

By soldering the pins to the Run header cleanly, you create a connector for the reset button. Once connected and with your Pi powered up, ensure that no action is taking place to test the button.

This video explains in full:

It should work fine. Better still, when your Pi is powered off, the reset button can be used to switch it on!

Time To Reset Your Raspberry Pi

We’ve shown you three different methods for resetting a Raspberry Pi. The inline power switch from gives you the hard reset option, enabling you to switch off and back on quickly. Meanwhile, adding the jumper to the GPIO pin on compatible devices enables you to automate an ordered shutdown.

Finally, the DIY reset switch option provides a soft reset whenever your Raspberry Pi has locked up.

Be aware, however, that an inline power switch is purely for emergencies, not for everyday rebooting, for which you should use the GUI or bash command for shutting down safely 15 Useful Commands Every Raspberry Pi User Should Know 15 Useful Commands Every Raspberry Pi User Should Know If you're using a Raspberry Pi computer for your weekend project (perhaps a media centre or a home server) then there is a good chance these useful command line instructions will save you time. Read More .

Do you use a reset switch on your Pi? Considering trying any of these options? Let us know, and ask any questions, in the comments box below!

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Marc Menard
    March 23, 2017 at 1:40 pm

    Hi! I've just soldered a momentary normally open switch to the holes labeled "RUN" on my Raspberry Pi 2B, drilled a hole on the case to install it, and voilĂ ! Works perfectly. I now do a shutdown through the RetroPie Menu, and when I want it to power up, just hit the switch and boom, back up again. Cost me 1$ (canadian!) for the whole thing. Didn't bother using a set of pins as they would not line up with the case molded holes, so wire soldered directly to the board. I do have a good iron to do that, temperature controlled, which helps. So, even if the article is two years old, still useful. Never know when someone comes late to the parade... Thanks!

    • Christian Cawley
      March 27, 2017 at 7:32 am

      Good to hear it worked!

  2. Alex
    December 22, 2016 at 8:42 pm

    The directions for where to put the jumper are incorrect. Also, Raspberry Pi 2 has pins in different places.

    • Christian Cawley
      December 23, 2016 at 10:23 am

      Hi Alex. This guide is two years old, and is not written with an RPi2 in mind -- which is why it's not mentioned.

      Also, how are the directions incorrect? Which aspect is wrong. As you can see from my photos, it certainly worked at the time on a B+ board. Thanks.

      • Alex
        December 24, 2016 at 2:54 am

        I got confused by the different numbering of the official vs what the code says for the pins. Turns out, it shouldn't matter. My bad.

  3. ChrisAdmin
    October 16, 2016 at 8:25 am

    Warning: You should never jumper any GPIO pin directly to GND/NEG/+5v/+3.3v
    If you're programming, and happen to turn that GPIO pin LOW or HIGH, you'll be creating a short circuit and will blow up your rPi. Always use a resistor inline with any switch or jumper to take the current, if you make this elementary and common mistake.

    If you dont understand what this means, think of it this way:
    Sensing a pin is HIGH or LOW is fine when the jumper or switch is connected to NEG or POS... Some time later, If your GPIO pin is Jumpered to LOW, and using a different program or project, you turn that GPIO pin to HIGH, you are shorting out negative to positive directly. Good bye GPIO pin, or good bye rPi.
    A resistor (a 1k - 10k I guess) will drop the current sufficiently to act like a component that is using the current, such as acting like an LED.

    GPIO3 -> 1k Resister -> Switch -> 3.3v

  4. Clark Phillips
    November 12, 2015 at 6:42 pm

    Thank you for posting this! I found it incredibly informative!

    So far, I am aware of only two ways to "turn on" the Raspberry Pi:
    1) disconnect the Raspberry Pi from power, then restore power
    2) Add a "reset" switch as you described and press the "reset" switch while the Raspberry Pi is off (but still connected to power)

    I can turn off the Raspberry Pi safely by responding to a button in software (issuing whatever bash command I would like to issue). I want to know if it is possible to have a "turn on" button. Below is a description:
    - Raspberry Pi is off; Press the "turn on" button; Raspberry Pi turns on
    - Raspberry Pi is on; Press the "turn on" button; Raspberry Pi does absolutely nothing

    Any ideas? Is there some way to use the "turn on" behavior you discovered coupled with the "reset" functionality to effectively have a "turn on" behavior alone (without the "reset")?

    • Christian Cawley
      November 12, 2015 at 8:15 pm

      I believe you might be able to get closer using the UPS PIco.

  5. Marty
    March 31, 2015 at 8:03 pm

    I have a Raspberry Pi A+ and followed the method here of placing a jumper over GPIO 5,6 to start the above shutdown script and it worked well. I like the ideas in the comments about attaching a mobo reset switch to theses pins.

    I have an old computer that I can take this switch from. Does it matter which way the switch goes into these rpi pins?


  6. Alexis Juarez
    March 2, 2015 at 5:03 pm

    I recently do a reset switch for my raspberry B+ with this little script :
    import RPi.GPIO as GPIO
    import time
    import os

    #Pull_up_down es para activar los pullups internos
    GPIO.setup(27, GPIO.IN, pull_up_down = GPIO.PUD_UP)

    #Esperar evento
    GPIO.wait_for_edge(27, GPIO.FALLING)
    os.system('echo "Cerrando procesos..."')
    os.system('echo "Apagando Raspberry..."')
    os.system("sudo reboot")

    But i have a little problem here, sometimes, raspberry reboot by itself, i think that is a voltage problem. BTW, I do my own circuit for the switch with a pushButton.

    Do you have any solution for my problem?
    Thanks. :)

  7. Robbage
    February 23, 2015 at 11:23 pm

    "With the jumper attached, the script polls the GND (ground) pin to check if anything is connected"

    Are you sure about that?

  8. Gary Stainburn
    February 12, 2015 at 9:57 am

    I purchased a 1x547-3166 from RS Components. It's a 36 pin strip but was only 51p.
    It's easy to snap off 2 pins for use on the Pi. This gave me enough to do both my PI's with spare left for another 16 if I buy them :-)

    I've also connected the USB tty console cable to my Pi which uses the same pins as used here, so I'll have to use different pins to implement this

    • Christian Cawley
      February 16, 2015 at 12:26 pm

      Thanks for sharing that Gary, hope everyone interested takes notice :)

  9. Gary Stainburn
    February 2, 2015 at 3:16 pm

    I'm looking to steal a Reset button from a dead PC to use with the GPIO3 reset option. Will this fit on pins 5/6 (GPIO3)?

    I'm also looking at using the same type of button for the P6/RUN hardware reset. I've tried looking on the RS Comp web site and the Maplin web sites for the 2-pin header. Does anyone have a part number for either of these suppliers, or similar?

    • Christian Cawley
      February 12, 2015 at 8:30 am

      There should be space for a two-pin mobo reset switch for the GPIO3 option, let us know how it goes.

      I don't have a part number (I removed my pins from an old mainboard) but i do know that if bought online it can be tricky to get a single pair. You'll probably end up with a group of 5 or more.

  10. wayne
    January 22, 2015 at 10:55 pm

    Is one pin of the jumper ground and the other a pullup resister? Would it be possible to drive the reset from a logic source such as a PIC to wake up the Pi?

    • Christian Cawley
      January 29, 2015 at 5:19 pm

      Do you mean the pins added to the P6 header, or GPIO3?

  11. Doc
    December 9, 2014 at 12:01 am

    "...and then connect the mains electric to the power switch." US readers will have no idea what a "mains" is - it's a power cable.

    • Christian Cawley
      December 9, 2014 at 7:01 pm

      Good catch, Doc. One of the rare times an article by a Brit is edited by a Brit.

  12. Greg
    December 8, 2014 at 8:38 pm

    I added a shut-down button to my raspberry pi b+ using a simple momentary switch and a couple lines of code in python. I then added the script to run on start-up with crontab -e(? I think it was -e). It was one of the first things I did for my little toy. The button also works for starting it up to. Only problem I have is making a case for the pi that was room for the switch, but hey, at least it works. ~$4 in parts, and once I figure out which pins corresponded to the schematic for pin numbering, it worked perfectly (FYI, for B+ the top of the diagram corresponds to the side of the board with the MicroSD card slot)

    import RPi.GPIO as GPIO
    import time
    import os

    GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)
    while True:
    print GPIO.input(5)
    if(GPIO.input(5) == False):
    os.system("sudo shutdown -h now")

    Crontab command
    @reboot python /.../scriptlocation/ &

    • Marty
      April 3, 2015 at 12:48 am

      This python script and a simple power button with wire clips on GPIO3 (pins 5/6) works great and a lot faster than the script above from github.