PIR Sensor

Interfacing PIR Sensor with Arduino Uno

PIR stands for Passive Infra-Red. It is also known as Motion Sensor. It’s easy to interface it with Arduino Uno. We have a delay for 5 seconds to allow for the PIR sensor to initialize. You can tinker with this value for the shortest delay without the sensor throwing false positives.

More details: IR Sensor | Flame Detection System

Components

Arduino Unox 1
PIR Sensorx 1
Bread Boardx 1
Jumper Wirex 3
Screw Driverx 1

Steps:

  1. Connect the PIR Sensor pins as shown in the image.
  2. Make sure VCC and GND not short.
  3. Set the sensitivity of the sensor by rotating the pots using a screwdriver.
  4. Upload the code mentioned for Arduino UNO.
  5. Open the Serial Monitor for the Readings.

Circuit:

Code:

/*the code is written for Arduino UNO, but can run on any Arduino Board with required modification */

int pirSensorPin = 2; 
// PIR Sensor is connected to GPIO - 02

int motionDetected = LOW; 
// Start MotionDetected as low (No motion detected)		
void setup() {
  
  Serial.begin(9600); 
  //Set serial out if we want debugging 
  
  pinMode(ledPin, OUTPUT); 
  // declare LED as output 
  
  pinMode(pirSensorPin, INPUT); 
  // declare the PIR sensor as input 

  delay(5000); 
  //Allow time for the PIR Sensor to calibrate

}	
void loop() {
  
  motionDetected = digitalRead(pirSensorPin); 
  // Read the PIR sensor 

  if (motionDetected == HIGH) { 
  //If motion detected 

    //triggering the alarm 
    Serial.println("Motion Detected");       
    digitalWrite(ledPin, HIGH); 
    delay(100); 
    analogWrite(ledPin, LOW); 
    delay(100); 
  } 

  //setting off digitalWrite(ledPin, LOW);         
  Serial.println("No Motion");
}

Helpful Resources:

IR Sensor | Flame Detection System

Related Projects:

Alert System | Flame Sensor

Follow us on:

Source: Platforuma

Leave a Comment

Your email address will not be published. Required fields are marked *

EXTRA ₹999 OFF on Lock-Down Live Learning!

Join Now!
X myStickymenu