Close

April 26, 2018

Learn: Motion Sensor with a PIR Switch

OVERVIEW

A PIR (passive infrared) motion sensor is used to sense movements by people, animals, or other objects that emit IR or heat. The PIR can be used in your projects such as an alarm or an automatic light switch that requires the detection of people.

PART 1: OPERATION OF THE PIR SWITCH

When the PIR senses motion, the OUT pin goes HIGH (3.3V).

Specification for PIR Switch (HC-SR501)
Operating voltage DC 4.5V to 20V
Standby current 50µA
Detection angle <110 degree
Detection range 3m to 7m

 

The detection range and time range (how long the OUT pin remains HIGH) can be adjusted using these screws.

 

PART 2: USING THE PIR SWITCH WITH ARDUINO

STEP 1: Connect the PIR switch as shown. Adjust the detection range and time range to the minimum (i.e., about 3 metres and 2 seconds respectively).

NOTE: The shorter leg of the LED connects to ground.

 

  1. Test out your circuit by waving your hand or walking in front of the PIR switch. You should see the LED light up.
  2. Try adjusting the detection range and time range, and observe how the PIR behaviour changes.

 

STEP 2: Connect the PIR switch as shown below.

NOTE: The shorter leg of the LED connects to ground.

 

Here are examples of how you control the PIR switch using Arduino IDE and Scratch.

Left: Arduino IDE; Right: Scratch

 

PART 3: USING A STANDALONE PIR SWITCH

For many simple application such as an automatic lighting or a welcome chime, you do not need an embedded system. You can use a transistor driver circuit (BC548) instead.

NOTE: The longer leg (positive terminal) of the LED connects to 5V.

Leave a Reply

Your email address will not be published. Required fields are marked *