Python code for HC-SR501 PIR Motion Detector
- HC SR501 PIR board
- RaspberryPi
- 3 x Dupont jumpers F-F
To start with, both sensitivity and time delay potentiometers should be kept to the minimum i.e. both turned CCW to 0700 hour position. Trigger jumper should be set to H
position.
https://www.sensoranalytics.com.au/image/shared/WiringDiag.png
- Copy
ctrl-pir
,driver-pir.py
, andpir.py
files to~/src/pir
. SetLOGFILE
to actual path inpir.py
.
cd ~/src/pir
./ctrl-pir start
screen -r pir
Install screen
. Install missing python packages used by pir.py
.
Adding ctrl-pir start
to start on boot to crontab. For extra cautious, ctrl-pir restart
once a day at some off peak hour.
Register with pushover.net. Then add your app token and user key in pir.py
and set Mute = 1
. Now phone will sound and display notifications.