Daily Archives: August 16, 2015

Adding a Reset Switch to your Raspberry Pi

Normally, shutting down the tiny credit card sized single board computer, the RBPi or Raspberry Pi, involves pulling the plug. That means disconnecting the power cable from the RBPi board. However, that is a risky way of shutting down the SBC, since it may be in the process of transferring data to the SD card, and the power interruptions may cause corruption of the memory card. Another problem with frequent removal and re-insertion of the power cable is the damage this may cause the connector port. Program development on the RBPi may cause it to hang occasionally. Therefore, frequent restarting via power cycling with removal/re-insertion of power cable will be a problem. A simple fix is to add a simple reset function to the RBPi. You can do this in one of three ways. The first is to use a USB reset button. The second is to use a motherboard jumper on the GPIO bus. The third option is useful only for RBPi Models B Rev2 and B+, where you solder pins on the P6 header and connect to a momentary button. The third option is the most complicated, requiring soldering on the RBPi.

Although the first option of a USB reset button is the simplest, it also ties up one of the USB ports on the RBPi. With only one or two USB ports available, depending on the RBPi model, this may not be a very viable option for many. However, in case it works for you, get a USB reset button from any specialist online stores. Those who want all their GPIO pins available or those who are averse to soldering may use the USB reset button connected to the RBPi for scenarios when the device needs to be booted.
If you can salvage a jumper from an old motherboard or an HDD, connect it on two pins on the RBPi GPIO. All RBPi models have GPIO pins – models A & B have 26 pins each, while the models A+ & B+ each come with 40 pins. You need to place the jumper on the GPIO3, pins 5 and 6, counting from the left while holding the board the right way around.

However, you will need a script to detect the jumper. Make the script executable before running – use ‘sudo chmod 755’ for this. You will also need to run the script every time you boot up. For this, add the following line to /etc/crontab –

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

Whenever you place the jumper on the specified pins of the GPIO, RBPi will sense it and will shut itself down.
The third option involves using the P6 header, which is available only on the latest models of the RBPi – models B Rev 2 & B+. On the Model B Rev 2, you can locate P6 next to the HDMI port. On the model B+, you will find P6 next to the label marked as ‘Raspberry Pi 2014’. Normally, the RBPi does not come with pins soldered on to P6, so you will have to do the soldering.

Once you have soldered the pins, install the jumper with the switch to reset the RBPi. However, use this switch with caution, only when the RBPi is not responding.