Arduino PIR Motion Sensor HC-SR501

This Artilce will demonstrate how to capture the Motion using Arduino &  PIR Motion Sensor HC-SR501.

Difficulty level: Beginner

Components Required:

1 xArduino Uno R3

1x HC-SR501 PIR Motion Sensor

1x LED 5MM Any Color

1x Bread Board

PIR Motion Sensor HC-SR501 Pin Layout:

 

 

Complete Video Setup:

Arduino Code:

// Arduino PIR Motion Sensor HC-SR501
// Author:https://www.or97.com

int ledPin = 7;  // LED on Pin 7 of Arduino
int pirPin = 8; // Pin #8 for HC-S501

int pirValue; // Place to store read PIR Value

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(pirPin, INPUT);
digitalWrite(ledPin, LOW);
}

void loop() {

//Take the Digital Singal From PIR Motion Sensor Pin
pirValue = digitalRead(pirPin);
digitalWrite(ledPin, pirValue);

}

Leave a Reply

Shopping cart