Home / Wiki / Sensor / Distance
Mini PIR Module(HC-SR505)

Introduction

HC-SR505 Mini PIR motion sensor is based on infrared technology, used to measure the distance. When detect someone has enter the detectable area, it outputs high level, when people is out of the range area, it delays for 9 seconds in high level automatically and then turn to low level. This sensor has two kinds of trig way:

   A.  Unrepeatable trig way: when detect IR and output high level, it will stay in this status for 9 seconds, then turn to low level.

   B.  Repeatable trig way: After output high level, during the delay time, if detect IR, the output will stay for high level, after the IR disappeared, the module will continue stay in high level for 9 seconds, then turn to low level (delay time begins from the latest IR disappeared).

This module also has the locking function, the locking time is default to be 200ms, after finish a whole output (high level turns to low level), it can set a locking time, during this time, the sensor won’t accept any signal.

Tip: The Mini PIR sensor module is easily influenced by the light, so ensure that the environment is not too light, or you’ll see the serial monitor display several same data in cycle. I have made an experiment under the fluorescent lamp, and the data showed on the serial monitor is ridiculous and then I give it a little hat, it output the correct data.

Technical data

Input voltage: DC 4.5 to 20V

Static current: 50μA

Measuring angle: 110°

Measuring distancemax 7m

High power level: ≥3.3V

Low power level: 0V

Working temperature: -20 to +80°

 

Features

Self-calibration

Tiny

Repeatable Trigger

Wide range of operating voltage

Low-power: quiescent current is 50μA (suit for product which need powered by battery)

Output high signal

Better anti-interference

 

Applications

Security Products

Industrial automation and control

Body induction lamps

Body induction toys

 

 

Usage

 

[code]

/*

 *connect PIR sensor module's output pin to Catduino's digital pin 3

 *if detect someone who emit IR, the Mini PIR sensor module will output high level

 *the high level will delay for 9 senconds

 */

#define PIRPin 3          

int PIRState=0;                    //define PIRState

 void setup()  {

  Serial.begin(9600);             //set serial monitor's baud rate at 9600

  pinMode(PIRPin,INPUT);           //define PIRPin as input pin

}

void loop()  {

    PIRState=digitalRead(PIRPin);   //read PIRPin's digital data

    if(PIRState==HIGH)  {

      Serial.println("Somebody is here.");    //if detect the IR, outpu "Somebody is here"

    }

else

Serial.println("There's nobody");              //if haven't detect the IR, output "There's nobody"

    delay(1000);       //delay 1 second after judge if PIRState is high or low

}

[/code]

 

Resource

Program

Datasheet