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|
|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).
- Test out your circuit by waving your hand or walking in front of the PIR switch. You should see the LED light up.
- Try adjusting the detection range and time range, and observe how the PIR behaviour changes.
STEP 2: Connect the PIR switch as shown below.
Here are examples of how you control the PIR switch using Arduino IDE and 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.
PART 4: ACTIVATING PIR WHEN IT’S DARK
The PIR already has a spot for a light sensor. Remove the cover on the PIR and there are two pads where you can solder a light-dependent resistor (LDR). Now, the PIR only activates when it’s dark.
For details, see https://www.youtube.com/watch?v=evZM2_RTvTU