https://github.com/fire1ce/raspberry-pi-pir-motion-display-control
Raspberry Pi display control based on motion (PIR) sensor using GPIO
https://github.com/fire1ce/raspberry-pi-pir-motion-display-control
Last synced: 12 months ago
JSON representation
Raspberry Pi display control based on motion (PIR) sensor using GPIO
- Host: GitHub
- URL: https://github.com/fire1ce/raspberry-pi-pir-motion-display-control
- Owner: fire1ce
- License: mit
- Created: 2021-10-02T12:34:55.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-11T23:22:00.000Z (almost 4 years ago)
- Last Synced: 2025-04-05T03:22:31.134Z (over 1 year ago)
- Language: Python
- Homepage: https://3os.org
- Size: 420 KB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Raspberry Pi Display Control Based on Motion (PIR) Sensor
## Information
This script uses pin GPIO4(7) to read data from Motion (PIR) Sensor, Any 5v and ground for PIR Sensor


## Requirements
- python3-gpiozero
Can be install via apt
```bash
sudo apt install python3-gpiozero
```
## Install
This will install the script as `service` and it will run at boot
```bash
curl https://raw.githubusercontent.com/fire1ce/raspberry-pi-pir-motion-display-control/main/install.sh | bash
```
## Uninstall
```bash
curl https://raw.githubusercontent.com/fire1ce/raspberry-pi-pir-motion-display-control/main/uninstall.sh | bash
```
## Default Behavior
| **Condition** | **Behavior** |
| --------------------------- | ----------------------------------- |
| Motion while display is off | Turns on display for 60 sec |
| Motion while display is on | Resets the timer for another 60 sec |
| No motion > 60 sec | Turns off the display |
## Config
File
```bash
/usr/local/bin/motion-display-control.py
```
You can change Data Pin of the PIR Sensor at **gpio_pin** value
You can change Delay at **display_delay** value
Line
```python
motion = Motion(gpio_pin=4, display_delay=60, verbose=False)
```
Restart the service to apply changes
```bash
sudo systemctl restart power_button.service
```
## Debug
In order to allow verbose debug change the following
File
```bash
/usr/local/bin/motion-display-control.py
```
Line
Set **verbose** value to **True**
```python
motion = Motion(gpio_pin=4, display_delay=60, verbose=True)
```
Restart the service to apply changes
```bash
sudo systemctl restart motion-display-control.service
```
## Check if service is running
```bash
sudo systemctl status motion-display-control.service
```
## Contributors
Thanks to [Boris Berman
](https://github.com/bermanboris/raspberry-pi-pir-motion-display-control) for the script rewrite from function to classes