EP-0077: Difference between revisions

From 52Pi Wiki
Jump to navigation Jump to search
Line 45: Line 45:
*3. Download shell script:
*3. Download shell script:
<pre>
<pre>
apt-get install -y wiringPi
cd ~
cd ~
git clone https://github.com/yoyojacky/rpi-pwrbtn.git
git clone https://github.com/yoyojacky/powerbuttom.git
cd ~/rpi-pwrbtn
cd ~/powerbuttom
chmod +x rpi-psu_client.sh
sudo mv ~/powerbuttom/gpioshutdown /etc/init.d/
sudo ./rpi-psu_client.sh
sudo chmod +x /etc/init.d/gpioshutdown
sudo vim.tiny /etc/rc.local
</pre>
Add this two lines before exit 0 <br>
<pre>
gpio mode 25 out
gpio write 25 1
</pre>
</pre>
*4. Reboot your Raspberry Pi and plug power button on your RPi, press the button to test.
*4. Reboot your Raspberry Pi and plug power button on your RPi, press the button to test.
Have fun.
Have fun.
----
----

Revision as of 13:05, 7 February 2017

Power Button For RPi V1.02


Description

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.


Features

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

Parameters

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 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:
device_tree=bcm2710-rpi-3-b.dtb
dtoverlay=gpio-poweroff
  • 3. Download shell script:
apt-get install -y wiringPi
cd ~
git clone https://github.com/yoyojacky/powerbuttom.git
cd ~/powerbuttom
sudo mv ~/powerbuttom/gpioshutdown /etc/init.d/
sudo chmod +x /etc/init.d/gpioshutdown
sudo vim.tiny /etc/rc.local

Add this two lines before exit 0

gpio mode 25 out
gpio write 25 1
  • 4. Reboot your Raspberry Pi and plug power button on your RPi, press the button to test.

Have fun.