Description
Human Body Detecting PIR Motion Sensor allows you to sense the motion of a Human Body.
- Size: Ф 11.8MM
- Focal length: 5MM
- Thickness: 0.6MM
- Material science: HDPE
- Response angle: 120 degrees
- Response distance: 5m
- Operating voltage 5v
Getting started with Human Body Detecting PIR Motion Sensor Module
In this project you’re going to create a simple circuit with a Body Detecting PIR Motion Sensor Module that can detect movement of the Human body. An LED will light up when movement is detected.
Hardware required
Connecting the Hardware
Arduino Uno Human Body PIR Motion sensor
GND GND
5V Vcc
D2 OUT
Upload the CODE
int led = 13; // the pin that the LED is atteched to
int sensor = 2; // the pin that the sensor is atteched to
int state = LOW; // by default, no motion detected
int val = 0; // variable to store the sensor status (value)
void setup() {
pinMode(led, OUTPUT); // initalize LED as an output
pinMode(sensor, INPUT); // initialize sensor as an input
Serial.begin(9600); // initialize serial
}
void loop(){
val = digitalRead(sensor); // read sensor value
if (val == LOW) {
digitalWrite(led, HIGH);
delay(100);
if (state == HIGH) {
Serial.println(“Motion detected!”);
state = LOW;
}
}
else {
digitalWrite(led, LOW);
delay(1000);
if (state == LOW){
Serial.println(“Motion stopped!”);
state = HIGH;
}
}
}
RESULTS
A LED will light up when movement is detected and the serial monitor prints “Motion detected!”