https://github.com/zkhan93/rpi_power_button
Power button for RaspberryPi
https://github.com/zkhan93/rpi_power_button
iot raspberry-pi
Last synced: about 1 month ago
JSON representation
Power button for RaspberryPi
- Host: GitHub
- URL: https://github.com/zkhan93/rpi_power_button
- Owner: zkhan93
- Created: 2019-10-22T16:36:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-29T08:05:19.000Z (over 5 years ago)
- Last Synced: 2025-04-02T23:34:06.990Z (about 1 year ago)
- Topics: iot, raspberry-pi
- Language: Shell
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# POWER BUTTON for Raspberry Pi
## Hardware Setup
Connect a simple push button with two ends, one with GPIO5 PIN and the other with GPIO6 pin.
On button press, it should essentially touch these two pins together and then disconnect them.
## Software Setup
pre-requisites
make sure you have `python3-dev` and `virtualenv` installed
```bash
sudo apt-get install python3-dev gcc python3-setuptools
python3 -m pip install virtualenv
```
clone the repository to `/home/pi/repos/rpi_power_button` (feel free to choose a different path) lets call this `REPO_DIR`,
replace `REPO_DIR` with this path for all the following commands.
There are 2 ways
### Manual way
create python vurtualenv and install dependencies
```bash
cd REPO_DIR
virtualenv -P python3 vevn
pip install -r requirements.txt
```
create a symlink of this power_button service which start the python script to listen to the GPIO 5 BOARD pin
```bash
sudo ln -s REPO_DIR/power_button.service /etc/systemd/system/power_button.service
```
modify `power_button.service` to replace REPO_DIR with the actual repo path.
```bash
# leave the first `REPO_DIR` as is.
sed -i "s+REPO_DIR+REPO_DIR+g" power_button.service
```
Enable the new service using systemd
```bash
sudo systemctl enable power_button.service
sudo systemctl daemon-reload
```
### The Shell Way
run the setup script to do it.
```bash
./setup.sh
```
## for Power LED using UART PIN
https://howchoo.com/g/ytzjyzy4m2e/build-a-simple-raspberry-pi-led-power-status-indicator