Introduction
In this post I will show how you can add a power switch to start and shutdown Raspberry Pi. It is not a good idea to always plugin/out you USB cable or switch on/off your mains power to shutdown or start Raspberry Pi. With a very simple hack you can add a power switch to your raspberry pi. This will not only help you to safely shutdown, it allows to restart the Pi without plugging/unplugging the power cable.
Steps and things you need
- You just need a push switch and a pair of wire connecting switch to raspberry pi.
- Update /etc/boot/config.txt with following line using command sudo nano /etc/config.txt
- dtoverlay=gpio-shutdown
- Connect one wire to GPIO03 and other to GND ( PIN 5 and PIN 6 of respectively). Connect the other end to the push switch. Refer the diagram below.
The path /etc/boot/config.txt does not exist.
May be the right path is: /boot/config.txt ? that is Update /boot/config.txt with following line using command sudo nano /etc/config.txt
Path may vary with the version of OS you are using.