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


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


  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.



/*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() {
  //Set serial out if we want debugging 
  pinMode(ledPin, OUTPUT); 
  // declare LED as output 
  pinMode(pirSensorPin, INPUT); 
  // declare the PIR sensor as input 

  //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); 
    analogWrite(ledPin, LOW); 

  //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