Motion Detection Module

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.

Required Hardware

For this module you will need:

Wiring

Connect HC-SR501 motion detection module to your Raspberry Pi as shown in the diagram below:

Code

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:

cd Desktop
python pir.py

The script will detect motion every second. Press Ctrl + C to terminate the execution of the Python script.

Images & Screenshots