Your Raspberry Pi is frozen. Perhaps there was a failure in a new component, or the system stopped processing some bad code. In any case, you must now disconnect and reconnect your Pi’s power supply, as manual disconnection is not possible.
Removing and replacing the USB power cable isn’t ideal, and it certainly causes excessive wear on the Raspberry Pi, especially the power port itself. The system does need a reset switch, but unfortunately none of them were included.
Setting the Reset Switch on Raspberry Pi
Relatively simple to add a reset switch. There are three methods available to you, each suitable for a specific skill level. For beginners, the built-in power switch on the micro-USB cable keeps your Pi easy to use.

Are you more of an expert? If the USB reset button seems simplistic, you can also use a jumper (a small plastic square with a few metal connectors) commonly found on motherboards or on the back of a PC hard drive.
However, for those who happily use a soldering iron, you can also attach your own pins to the P6 connector on your Raspberry Pi and then plug in a PC-style reset switch.
Let’s look at all three options in more detail.
Add a built-in power switch to your Raspberry Pi
Quite obviously, the easy way to add an onboard power switch to your Raspberry Pi will save you the hassle of fiddling with the GPIO header or even soldering your own pins on the board.
All you have to do with this device is plug it into the micro USB connector on your Raspberry Pi and then connect the electrical power to the power switch. This makes it a universal option for all models (such as the new Raspberry Pi Model A+) where using GPIOs or adding pins to the P6 header is not an option.
Visit Pi-Supply.com for one of these built-in devices, which retail for about $20 plus shipping.
Jumper + GPIO = Reset your Pi!
With a jumper on the motherboard, you can ask the Raspberry Pi to start a graceful shutdown, which is equivalent to typing
sudo shutdown –h now
using a script.
Define an array of GPIO pins. On models A and B (Rev 2), this is on the opposite edge of the board from the power connector and contains 26 pins. On the A+ and B+ models, you’ll find a 40-pin array taking up almost the entire long edge above the Raspberry Pi Model B+’s printed text.

Each GPIO array has 3 — pins 5 and 6 — can be used to trigger a shutdown. Copy this script from github and run it on your Pi (if you are using SSH you should set it up, copy the script from your browser and then click in the SSH window to copy). Make it executable with
sudo chmod 755 raspi_gpio_actions.sh then sudo ./raspi_gpio_actions.sh
With the jumper connected, the script polls the GND (ground) pin to see if anything is connected. Once the pins are jumpered, the script will run and safely shut down the Pi.
To keep the script running each time the Pi boots, open /etc/crontab in nano and add the following line:
@reboot root /home/user/scripts/raspi_gpio_actions.sh
Click CTRL+X to save and exit. This will poll the GPIO3 regularly and when the device detects a jumper on the pins it will automatically shut down.
Don’t forget to remove the jumper when you’re done. You can leave it attached to only one of your contacts so you don’t lose it. If you do not remove it, the Raspberry Pi will not boot correctly.
Keep in mind that this method is not suitable for situations where the Pi crashes or freezes. It’s basically an automatic way to run the safe shutdown command, so there’s a good chance that if the device is hung, the script won’t run.
Give your Raspberry Pi a PC style soft reset switch
Adding a Pair of Pins to Header P6 (labeled » Run on model B+») With the help of a soldering iron and a small fine-gauge solder designed for electronic work, you can add a PC-style reset button to your Pi. This requires an instant switch, which is essentially an instant on/off action.

All of these components and connecting wire can be purchased online or from electronics retailers. You may find that 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 out all the older computers you have. The pins and reset switch seen here come from an old motherboard and a recently disused tower. Alternatively, you can purchase a small board mount button for a wire-free solution.
Only Model B Rev 2 and model B+ Raspberry Pis have a P6/Run header. To find it on your Model B Rev 2, locate the HDMI port where you should find two small holes a few millimeters apart.

On the B+ heading next to the display ribbon connector, next to the microSD slot, and to the right of the printed «© Raspberry Pi 2014».
By cleanly soldering the pins to the Run header, you create a connector for the reset button. Once connected and with the Pi powered on, ensure that no action is taken to test the button.
This video explains in full: