From 52Pi Wiki
Revision as of 16:35, 14 December 2017 by Yoyojacky (talk | contribs) (Mechanical Drawing)
Jump to navigation Jump to search

Power Button For RPi

Old Version V1.22

IMG 8183.JPG


New Version V2.22




As everyone at some point will recognize the Raspberry Pi doesn't include any kind of shutdown button.
So the only way to power it off is by unplugging it from the power supply.
To make sure you get no corruption of your data files on the SD card you should shutdown the Raspberry before powering it off.
So the whole procedure can be a bit annoying especially if you want to use the Raspberry as some kind of embedded PC .
e.g. a media server or an internet radio.
NOTE:There is new version: V2.02, using the same method to configure on Raspberry Pi


Power Button provides a small circuit that includes the features:

  • Sending a shutdown signal to the Raspberry if the Shutdown Button is pressed
  • Waiting for the Raspberry to shut down
  • Powering off the Raspberry after save shutdown
  • Powering on the Raspberry after the Button is pressed again
  • LED light indicating the current state: On / Shutdown / Off
  • Easy to setup


  • Updated MCU
  • Changed Layout
  • Changed Button
  • Optimized code


Parameter Value
Dimension 65mm x 30 mm x 20mm
Weight 22.72g

Package Includes

  • Power Button For RPi Module x1
  • IR Remote controller ( without battery) x1

Mechanical Drawing

  • V1.22


There is a chart which can show you the function of the GPIO Pin definition of this board:

Function BCM RPi
Disk Status 21 Pin 40
Shut Down 24 Pin 18
PWR Status 26 Pin 37
GND N/A Pin 6/9/14/20/25/30/34/39
5V 5V Pin 2/4
NOTE: Please make sure that your Raspberry Pi  have  5V/2.5A  power supply with this module!!!

How to wire it up

Do NOT connect your power supply to Raspberry Pi,  Please connect it to Power Button directly.

How to set it up

  • 1. Remove your TF card and connect it to your PC or laptop with TF card adapter.
  • 2. Modify /boot/config.txt file as following, for example, my pi is Raspberry Pi 3 model B:
NOTE:  device_tree=PARAMETER  is depends on your Raspberry Pi's model. 
more info please access this link:

[Device Tree| https://www.raspberrypi.org/documentation/configuration/device-tree.md]

Raspberry Pi model Device_Tree Info
Raspberry Pi B : device_tree=bcm2708-rpi-b.dtb
Raspberry Pi 2B : device_tree=bcm2709-rpi-2-b.dtb
Raspberry Pi B+ : device_tree=bcm2708-rpi-b-plus.dtb
Raspberry Pi 3 B: device_tree=bcm2710-rpi-3-b.dtb
  • 3. Install the library of wiringPi and Download shell script to check the GPIO pin's status:
sudo apt-get install -y wiringPi
cd ~
git clone https://github.com/yoyojacky/powerbutton.git
cd ~/powerbutton
sudo  mv   ~/powerbutton/gpioshutdown    /etc/init.d/
sudo  chmod   +x   /etc/init.d/gpioshutdown
  • 4. Edit the initialized file in /etc/rc.local :
sudo  nano   /etc/rc.local

Add those three lines before exit 0

sudo /etc/init.d/gpioshutdown &      #Thanks for Steven Porter's kindly advise. (update the "&" mark at the end of command)
gpio mode 25 out
gpio write 25 1

After edit this file, Press "Ctrl + X" to save this file and Press "Y“ to save it.

  • 5. Reboot your Raspberry Pi and plug power button on your RPi, press the button to test.

Have fun.

Video Tutorial


Please follow the link: [ Raspberry Pi 3B with Ir remote power button and pi supply & USB HUB | https://youtu.be/BhEoGZshiPM ]