Motion Detection Module
Introduction (How it Works)
PIR stands for Passive Infrared Sensor which is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. PIR detect emitted infrared energy – given off by humans and animals in the form of heat. When there is a sudden increase in infrared energy, an alarm is sounded.
For this module you will need:
- Raspberry Pi (any model)
- HC–SR501 PIR sensor
- Female to male and male to male jumper wires
- microSD card with Raspbian installed
Connect HC-SR501 motion detection module to your Raspberry Pi as shown in the diagram below:
On your Raspberry Pi, open a terminal window. Install python by the following commands:
sudo apt-get update
sudo apt-get install -y python-dev python-rpi.gpio
Download and save this file to your desktop
With the following commands you can execute the Python script that detects the motion:
The script will detect motion every second. Press Ctrl + C to terminate the execution of the Python script.