Just got your Raspberry Pi and looking for a fun afternoon project? How about making a power on button. Once you shut down your Pi, it is off, and turning it back on can get a bit sticky. The easiest option is to unplug the Pi, but over time this is going to wear down the parts of your Raspberry Pi…that’s not a good thing.
Don’t just unplug your Pi
Perhaps you’ve been using the Pi for a little while and you have decided not to shut it down at all. Instead, you simply pull the plug when you are done using it. THIS IS A BAD IDEA Simply unplugging the Pi without a proper shutdown can damage your SD card, especially if this is your normal way of doing things and do it too often. Also, it may not be entirely good for your Pi. You don’t want to have to rebuild your operating system just because you don’t want to take the time to shut it down.
**Make a Wake-up button **
Making a wake up button is simple. To wake the Raspberry Pi up when it is asleep, all you need to do is short Pin 5 to ground. (Pin 5 is also known as GPIO03). Since Pin 6 is already at ground, you can do this by shorting Pins 5-6.
Find a contact switch
You can find these for a lot cheaper online, but sometimes you just want to complete a project right now! I suppose I’m just too impatient sometimes.
The important thing is that you are looking for a Normal Open (N.O.) Momentary Contact switch. This will short the two pins only when the button is pressed. If you choose a Normal Close (N.C.) button, you may have additional problems.
Header Strip Plug The next thing that you need is a header strip to plug onto to the Pi. You could use a regular female header strip like this one:
Or you can use a jumper like the one shown here. You would need two of them, one for each lead coming from your button.
If you have an old computer case laying around (which many of us do), you can just steal one of the cables connecting a case LED to the mother board. Motherboards have the same spacing as the Raspberry Pi header. I used a former speaker cable:
The advantage is that you don’t have to do any soldering to the straight pins. Also, it allows your switch to be removable, but the contacts are pretty solid. Finally, you already have the wire connected, so all you have to do is solder up the switch.
I recommend covering each lead as well as both contacts together with some head shrink tubing. This gives a little support to the connection and also prevents unintentional shorts.
Connecting to the Pi
When you are all done, simply plug your wired switch across pins 5 and 6 on the Pi, as shown below:
You’ll notice that this is shown with the original Raspberry Pi version A, but this works with all versions of the Pi.
That’s it. You now have a button that can wake the Raspberry Pi from sleeping mode.