Infrared Human Body Motion Sensor(HC-SR501)

아두위키 : Arduwiki

Infrared PIR Sensor, a Passive Infrared Sensor.

It detects objects within its range that emit infrared radiation.

It can detect the faint infrared radiation emitted by humans, and allows for adjustments in detection distance and delay time.

Specifications

  • Operating Voltage: 4.5V ~ 20V
  • Quiescent Current: 50uA
  • Detection Angle: 110 degrees
  • Delay Time: 3 seconds ~ 300 seconds
  • Detection Distance: 3m ~ 7m

Required Hardware

  • Infrared Human Body Motion Sensor
  • Arduino

Connection

The following is the circuit used in the example code.

If using the Infrared Human Body Motion Sensor by itself, an LED is not necessary.

Instead of an LED, other modules can be applied and utilized.

Human Detection Sensor Resistor LED Arduino
VCC 5V
OUT D7
GND - GND
Connection +
Connection D8

Example Code

This is an example that uses the Infrared Human Body Motion Sensor to light up an LED.

#define PIR 7     //Define motion sensor pin
#define LED 8     //Define LED pin for verification
int state = 0;     //Variable for storing state
void setup()
{
  pinMode(PIR, INPUT);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
}

void loop(){      //Code to light up the LED when motion is detected
//  state = digitalRead(PIR);
  if(digitalRead(PIR))
  {
    digitalWrite(LED, HIGH);
    delay(1000);
  }
  digitalWrite(LED,LOW);
}

Execution Result