Engineer Jagat

IT & Engineering Stuff

Arduino Motion Sensor Project: Alarm System

October 17, 2020
Arduino Motion Sensor Project: Alarm System

Arduino Motion Sensor Project is one of the most used projects in different aspects. We can use it for Security System or Alarm System.

In this Project, we use PIR(Passive Infrared) Sensor and Arduino Uno as main components. The required components are listed below:

  • Arduino Uno
  • PIR Motion Sensor
  • Breadboard
  • Jumper Wire 
  • LEDs
  • Buzzer

Step-by-Step

Step 1: Setup

First we have to setup Arduino IDE. Follow the video description

Arduino IDE Setup

Step 2: Code

int sensorPin = 8;
int sirenPin = 9;
int pir;

void setup() {
  
  pinMode(sensorPin, INPUT);
  pinMode(sirenPin, OUTPUT);
  
  Serial.begin(9600);         
}

void loop() {
 pir = digitalRead(sensorPin);            
 if(pir == 1)
 {
  
  Serial.println("Motion detected"); 
  digitalWrite(sirenPin, HIGH);     
  delay(2000);                            
 }
 else
 {
 
  Serial.println("no motion");
  digitalWrite(sirenPin, LOW);
  delay(2000);
 }

}

Step 3: Circuit

Output

Share with Friends
Copyright © 2020-2021 Engineer Jagat All rights reserved. Developed by Ravindra Rana