INTRUDER ALARM

MOTION SENSOR

Vikrant Singh

7/29/20241 min read

Project Overview

This project is designed to create an intruder alarm system using an Arduino, an IR sensor, a buzzer, and an LED. The system will detect the presence of an intruder using the IR sensor and will alert with a buzzer sound and an LED indicator.

Components

1. Arduino Uno

2. IR Sensor

3. Buzzer

4. LED

5. Jumper Wires

6. Breadboard

Circuit Diagram :

Steps to Build the Project :

Connect the IR Sensor to Arduino:
  • Connect the VCC pin of the IR sensor to the 5V pin on the Arduino.

  • Connect the GND pin of the IR sensor to the GND pin on the Arduino.

  • Connect the OUT pin of the IR sensor to digital pin 2 on the Arduino.

Connect the Buzzer to Arduino:
  • Connect the positive leg of the buzzer to digital pin 9 on the Arduino.

  • Connect the negative leg of the buzzer to the GND pin on the Arduino.

Connect the LED to Arduino:
  • Connect the longer (positive) leg of the LED to digital pin 8 on the Arduino.

  • Connect the shorter (negative) leg of the LED to a 220Ω resistor.

  • Connect the other end of the resistor to the GND pin on the Arduino.

Arduino Code :

const int irSensorPin = 2; // IR sensor pin

const int buzzerPin = 9; // Buzzer pin

const int ledPin = 8; // LED pin

void setup() {

pinMode(irSensorPin, INPUT);

pinMode(buzzerPin, OUTPUT);

pinMode(ledPin, OUTPUT);

Serial.begin(9600); // Initialize serial communication for debugging

}

void loop() {

int sensorValue = digitalRead(irSensorPin);

Serial.println(sensorValue); // Print sensor value to serial monitor

if (sensorValue == HIGH) {

digitalWrite(buzzerPin, HIGH); // Turn on buzzer

digitalWrite(ledPin, HIGH); // Turn on LED

} else {

digitalWrite(buzzerPin, LOW); // Turn off buzzer

digitalWrite(ledPin, LOW); // Turn off LED

}

delay(100); // Small delay to avoid rapid switching

}

Code File

Testing the System :
  • Place the IR sensor in a position where it can detect movement.

  • Observe the LED and buzzer:

    • When motion is detected, the LED should light up, and the buzzer should sound an alarm.

    • When no motion is detected, the LED should be off, and the buzzer should be silent.

***Happy Tinkering***