Official website for Linux User & Developer
FOLLOW US ON:
Mar
20

Raspberry Pi reset switch tutorial

by Christian Cawley

Need to restart your Pi after a system lock-up? Ease strain on the mains connector – install a reset switch!

We all know that shutting down a Raspberry Pi by removing the power cable is risky. Data may be writing to the SD card, leading to corruption, while repeated removal of the power cable can cause problems with the connector port.

Clearly this can cause problems when faults cause the Raspberry Pi to hang, so the simple fix here is to add a simple reset function to the device. There are three ways this can be done: with a USB reset button, a motherboard jumper on the GPIO bus or with a momentary button connected to newly- soldered pins on the P6 header on the Model B Rev 2 and B+ (this is the most complicated option).

If you have an old PC lying around, retrieving the reset button and cable from this and even the connecting motherboard pins is achievable if you’re handy with a soldering iron. Otherwise, we recommend purchasing the parts online, although be aware that you’ll probably need to buy more pins than you’ll need.

A quick reset switch for your Pi
A quick reset switch for your Pi

What you’ll need

Momentary switch
Suitable wire for PCB projects
Soldering iron and solder
Single pin pair header
HDD/motherboard jumper

Step-by-step

Step 01 Check your Raspberry Pi model

Only two models feature the P6 header: the Raspberry Pi Model B Rev 2 (which you can find next to the HDMI port) and the B+ (to the left of the ‘© Raspberry Pi 2014’ label). You will need to install the pins manually, however, as they are not preinstalled for this function.

The reset pins
The reset pins

Step 02 Find your components

Header pins can be purchased online, although this will invariably result in having to order more than you need. Alternatively, if you have an old motherboard, remove a pair of pins with a soldering iron. Similarly, you might buy a new reset button, or use one from an old PC.

Step 03 Solder pins to your Pi

To gain stability when soldering, place the Pi upside down on a layer of packaging foam, with the header slotted into the holes.

Using fine solder, secure the pins to the mainboard with your soldering iron. This will require a very steady hand, so get assistance if required.

Step 04 Connect your reset switch

Leave the solder to cool for a few minutes before attaching the reset switch connector.

Some cases don’t have space for the pins and/or the connector, however, so take the time to plan ahead and make sure everything fits. If not, you may need to make some adjustments to your case.

Step 05 Reset Raspberry Pi following crashes

With the switch installed, you’ll be able to reset the Raspberry Pi when required. Note, however, that this isn’t an option to be used for whenever you feel like restarting. Rather, it should be done only when the system fails to respond within
a reasonable time frame.

Step 06 Reset with a HDD jumper

Not keen on soldering new pins to your Raspberry Pi? That is perfectly understandable, but it doesn’t mean you cannot reset the computer. We have another solution for you.

Using a motherboard jumper, two GPIO pins and a script to initiate an ordered shutdown is a simple alternative that doesn’t involve solder and potential PCB damage.

Jumper placement on the GPIO ports
Jumper placement on the GPIO ports

Step 07 Identify the GPIO pins

This method works on most models. Each has a GPIO array, 26 pins on the A and B (Rev 2) and 40 on the A+ and B+. The jumper should be placed on GPIO3, pins 5 and 6 counting from the left with the board the right way around.

Step 08 Detect jumper with a script

Use this script to detect the jumper, making it executable (sudo chmod 755) before running. Within a minute your Pi will shut down. Add this line to /etc/crontab to run the script whenever you boot up.

@reboot root /home/user/scripts/gpio_actions.sh

Remember to remove the jumper before booting up!

Step 09 Try a USB reset button

Specialist online stores offer USB reset buttons that can be connected to your Pi for scenarios when the device needs to be rebooted.

If the idea of using the HDD jumper or doing some minor soldering doesn’t suit you, then a USB reset switch might be your best option.

  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.