PIR MOTION SENSOR USING ARDUINO UNO, BUZZER & LED'S

Circuit Diagram:



PIR Motion Security Alarm System with Arduino UNO

Hardware Wire Bus Distribution Index

Wire the PIR motion sensor, dual-LED indicators, and audible piezo siren to your microcontroller using this physical layout profile:

Peripheral Component Pin Target Controller Location Signal System Purpose
PIR Sensor VCC (+) 5V Power Rail Pin Main Hardware Logic Operational Power
PIR Sensor OUT (D) Digital Pin 7 Intrusion Detection TTL Logic Input Track
PIR Sensor GND (-) GND Pin Terminal Common Circuit Ground Reference
Green LED Anode (+) Digital Pin 2 Secure Zone Operational Status Light
Red LED Anode (+) Digital Pin 3 Active Threat Intrusion Status Light
Piezo Buzzer Positive Wire Digital Pin 4 Alternating Sound Frequency Siren Output Bus
LED Cathodes / Buzzer Negative GND (LEDs via Resistors) Common Safety Ground Return Paths
⚠️ PIR TEMPERATURE VOLTAGE RISK: Ensure that your PIR module's power line matches its rated input limits. While some boards can safely take 5V power rails, running sensor signal pins alongside unregulated high-current loads without isolating structural returns can warp sensor readings.

System Brief Explanation

  • Siren Pattern Mechanics: When an alert triggers, the algorithm generates an alternating acoustic sweep pattern. It steps between 1200Hz and 800Hz tones at 150ms intervals to avoid outputting a flat, easily missed monotone signal.
  • Stabilization Delay: The loop cycles an explicit delay(100); routine at the end of each pass. This manages processing overhead and allows the PIR pyroelectric crystal to stabilize between sensor polls.

Source Firmware Application

Review the primary C++ code file container block below. The control utilities are hosted inside the top panel frame for instant deployment copying:

📁 pir_security_alarm.ino
Arduino C++
// Define Pin Allocations
const int pirSensorPin = 7;  // PIR motion output pin
const int greenLedPin = 2;   // Secure indicator
const int redLedPin = 3;     // Alarm indicator
const int buzzerPin = 4;     // Audible siren

// Variable to track motion state
int motionStatus = LOW;

void setup() {
  // Setup output devices
  pinMode(greenLedPin, OUTPUT);
  pinMode(redLedPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  
  // Setup input device
  pinMode(pirSensorPin, INPUT);
  
  // Open communication to Serial Monitor
  Serial.begin(9600);
  Serial.println("--- PIR Motion Security System Active ---");
}

void loop() {
  // Read the digital state of the PIR sensor
  motionStatus = digitalRead(pirSensorPin);
  
  if (motionStatus == HIGH) {
    // MOTION DETECTED!
    digitalWrite(greenLedPin, LOW);   // Kill secure light
    digitalWrite(redLedPin, HIGH);    // Trigger alert light
    
    // Play an alternating security siren (800Hz to 1200Hz)
    tone(buzzerPin, 1200, 150);
    delay(150);
    tone(buzzerPin, 800, 150);
    
    Serial.println("[INTRUSION ALERT] Motion detected in the secured zone!");
  } 
  else {
    // SYSTEM SECURE
    digitalWrite(greenLedPin, HIGH);  // Keep secure light alive
    digitalWrite(redLedPin, LOW);     // Ensure alert light is dead
    
    noTone(buzzerPin);                // Silence the siren
  }
  
  // Small delay to allow simulation processing
  delay(100);
}

Project Video Demonstration

Watch the motion detector capture physical movement, flash safety warnings, and fire the alarm array instantly:

Comments