PIR controlled HDMI output for Raspberry Pi
This daemon allows to control HDMI output in Raspberry Pi. It can put monitor to sleep when no nearby movement detected. It can be useful in kiosk applications. Works beautifully with MagicMirror. Requires Passive Infrared Sensor connected to Raspbrerry Pi. Look here for inspirations:
Make sure you have all needed components:
sudo apt-get install git
Clone repository. From pi
home execute:
git clone https://github.com/acejacek/pir_hdmi.git
New folder will appear: pir_hdmi
. Navigate into it.
Test if program works correctly. Check all options:
sudo python pirhdmi.py --help
Real check. Specify where your PIR is conencted (pin 11 in this example):
sudo python pirhdmi.py --debug --pir-pin 11
If all behaves as expected, interrupt program with Ctrl-C
, and follow next step to install service.
In pirhdmi.service
adjust your setting, specifically --pir-pin
to be the same as used in your connection.
Configure systemd
daemon to run script. Copy service definition to /lib/systemd/system
folder:
sudo cp pirhdmi.service /lib/systemd/system
Now, activate the service:
sudo chmod 644 /lib/systemd/system/pirhdmi.service
sudo systemctl daemon-reload
sudo systemctl enable pirhdmi.service
sudo systemctl start pirhdmi.service
Check the status:
sudo systemctl status pirhdmi.service
In pir_hdmi
folder execute:
git pull
All your customizations can be overwritten. Check again, if --pir-pin
in pirhdmi.service
points to correct one.
If you copy updated service definition pirhdmi.service
to /lib/systemd/system
folder, remember to inform systemd
about the changes:
sudo systemctl daemon-reload
sudo systemctl restart pirhdmi.service