OBJECTIVE

We will build a passive infrared motion detector that can detect movement from distances that are between 3m and 7m.

THE SCIENCE

All objects that have a temperature above absolute zero (0 ° Kelvin/-273.15 ° C/-459.67 ° F) emit heat in the form of infrared radiation. The hotter the object is, the more radiation it emits. Infrared radiation is not visible to the human eye but we can use a Passive InfraRed (PIR) sensor to detect it. We will design and build a device that allows us to detect this infrared radiation and therefore sense motion. If a person walks in front of the sensor the temperature will rise and therefore cause a change in voltage at its output.

A PIR sensor contains a pyroelectric sensor and a Fresnel lens. A Fresnel lens is a special type of lens that focuses infrared radiation onto the pyroelectric sensor. The pyroelectric sensor has two rectangular slots that are made from a material that allows infrared to pass through. Behind these two slots are two electrodes, one which can produce a positive voltage and the other a negative voltage. The two electrodes are wired in a manner that means that they cancel each other out. If one of them see more or less radiation than the other, the output will change to either high or low.

THE HARDWARE

The sensor that we will use is the HC-SR501 PIR sensor (Figure.1)

passive InfraRed
Figure.1 HC-SR501 PIR sensor

THE CODE

IMPROVEMENTS

When our circuit is turned on, sometimes we get a false positive. This is because the HC-SR501 takes a small amount of time to settle to adjust to the infrared that is in the room. We could eliminate these false positives by providing a delay when we switch the circuit on. This could be implemented in hardware or software. We will do it in software by adding a delay to the start of the program, before it is run.

FINAL CODE

Parts suggestions