Introduction: Pi Shutdown Module
This module gives you a great way to properly shutdown a Raspberry Pi. Then it can be powered off with a button on the power adapter or unplugged. The light will turn off when it is safe to power off. If you decide to boot up after it has shutdown (while it still has power), hitting the button again will boot it up.
The PCB is inexpensive from OSH Park. Minimum order is 3, so share with a friend or put it on 3 Raspberry Pi's
I created this so my kids will properly shut down the RetroPie after playing.
Step 1: Parts
3 Boards from OSH Park $6.10 and free shipping
1x LED
1x .01uf Capacitor (100nf and 104 = .01uf)
1 330 Ohm Resistor
1x 1M Ohm Resistor
2x - Header 10 pin 2x5 (use 1x and electrical tape if the Pi has a heatsink)
1x Button Switch 6x6x9.6 the last number is the height of the button. A different height can be substituted.
Step 2: Build
The "UNPLUGGED" part of the PCB is designed to give lateral support to the board and to channel electrostatic discharge to the 1M resistor. After soldering, clip component leads on the underside to make sure if doesn't short out on the Pi.
If you have a heatsink on your Pi, don't solder in the "UNPLUGGED" connector and put electrical tape of the backside of the PCB.
Step 3: OS Configuration
It needs a service to shut it down when you press the button.
Download python script
wget -O off.py https://cdn.instructables.com/ORIG/FSJ/0G5H/JM6KYZ7W/FSJ0G5HJM6KYZ7W.py
chmod +x off.py
Setup startup service
sudo nano /lib/systemd/system/off.service
[Unit]
Description=Off Program
[Service]
ExecStart=/home/pi/off.py StandardOutput=null
[Install]
WantedBy=multi-user.target Alias=off.service
Save, then active the service
sudo systemctl enable off.service sudo systemctl start off.service
It uses serial pin to light the LED while its running. So it needs serial console turned on in Raspberry Config.
sudo raspi-config
3 Comments
Tip 4 years ago
Raspberry Pi automatically boots when it gets power after being powered off. It doesn't not shut off like PCs do when the software is shut down. So it takes a second step to shut off power. So the Pi can be in a state where the OS is shutdown and it is still receiving power. The button on the module I designed will tell the Pi to boot up if it is in that state. I've read that it uses about 200 mA in while in this shutdown state. It would take more complicated and expensive hardware, it would need route the USB power through it, to power off the Pi on shutdown. I seen projects that do that, but recall it being about 3x more expensive than this project.
4 years ago
Sorry, I didn't say that correct. I don't want a signal if the pi is starting up or rebooting. I just like to know if there is a power outage and the power comes back on, will the pi startup again or do I have to push a button?
Question 4 years ago
Looks great! I use my pi's for digital signage. Some are on remote locations I'd like to know if the pi reboots after an unexpected powercut, without pushing a button?