It’s often required to restart/reboot your Raspberry Pi for whatever reason but unfortunately there is only one way to do that, by unplugging and reconnecting your Raspberry Pi’s power supply. Basically what we needed here is the Reset switch which is not included, removing and replacing the USB power cable is just not the best solution.
Let’s see how you can add a Reset switch to your Raspberry Pi which will save you many hassles.
Fitting a Reset Switch to Your Raspberry Pi
Don’t confuse or tremble that how you are going to add a reset switch, it’s a very simple task. There are 3 methods we’ll explain here, each depending upon the skill level – if you are a beginner then it will best for you to go the route of an inline power switch on the micro-USB cable powers your Pi; a little more of an experts can go for USB reset button, 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. The third way will be to fit your own pins to the P6 header on your Raspberry Pi, and then connect a PC-style reset switch.
Let’s dive into details of these methods.
Add An Inline Power Switch To Your Raspberry Pi
This is the simplest solution. What you have to do is to connect it to the micro USB connector on you Raspberry Pi, then connect the main power cable to the power switch, which will make it a universal option across all models (such as the new Raspberry Pi Model A+). Go to Pi-Supply.com to get these inline devices which will cost you around $20 plus shipping.
Jumper + GPIO = Reset Your Pi!
With the help of a motherboard jumper and the following mentioned script, you can request Raspberry Pi to shutdown:
sudo shutdown –h now
Now you have to recognize the GPIO pin array. To make this easier, you can find it on the Model A and B (Rev 2) on the opposite edge of the board from the power connector, and comprises 26 pins, whereas 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.
It will be best if you use SSH. GPIO 3 – pins 5 and 6 – can be used for shutdown. Copy this script from github and execute it on your Pi, Make it executable with:
sudo chmod755 raspi_gpio_actions.shthen sudo./raspi_gpio_actions.sh
It will check if anything is connected by polling the GND (ground) pin while jumpers being attached so once the pins are connected by the jumper Shutdown will be initiated by the script. It will shut down your Raspberry Pi.
If you do not want to run the script again and again then open /etc/crontab in nano and add this line:
@reboot root /home/user/scripts/raspi_gpio_actions.sh
Save and exit by pressing Ctrl+X, the logic is simple here it will regularly poll GPIO3 to detect the jumper and the pins, and if it’s detecting them it will simply automatically shut it down.
Note: make sure to remove the jumper because if it’s attached then Raspberry Pi will not boot correctly. You can attach it to other pins as if you think you might lose it. Just to clear things, keep in mind that it’s an automated way of running the safe shutdown command, but if device is crashing or freezing then there are highly chances that script will not run.
Give Your Raspberry Pi A PC-Style Soft Reset Switch
To add a PC-style reset button to your Pi – a couple of pins will be added to the P6 header (labelled Run on the Model B+) using a soldering iron and some fine-gauge solder designed for electronic work. A switch will also be needed to instigate on/off action.
You can buy all of the required things online. Although, the pins can be bought in bulk so if you don’t want to end with a whole lot of pins then it will be a good idea to check your old computers. The pins and reset switch seen here came from an old motherboard, or you can purchase a small board-mounted button for a wire-free solution.
You will find the P6/Run header only on Model B Rev 2 and Model B+ Raspberry Pi. On Model B Rev 2 look for the HDMI port, where you will see 2 small holes on a few millimeters difference, while on the B+ look for it on the header next to the display ribbon connector, near to the microSD slot, and to the right of the printed “© Raspberry Pi 2014″.
Join the pins to the Run header cleanly so that they fuse in perfectly, by doing this you have created a connector for the reset button. You can also use reset button to power on your Pi. See the below video for better and visualized understanding.
Do let us know in the comments which option you have used and if you have any question regarding the reset switch on your Raspberry Pi.