Introduction
A PIR (Passive Infrared) Motion Detector is an electronic device that detects movement by sensing infrared radiation emitted by living beings. It is commonly used in security systems, automatic lighting, and home automation.
This project demonstrates a simple and effective way to detect motion using a PIR sensor and Arduino.
Objective of the Project
- To detect motion using a PIR sensor.
- To trigger an alarm or device when movement is detected.
- To interface PIR sensor with Arduino.
- To implement automatic security systems.
Working Principle
The PIR sensor detects infrared radiation emitted by humans or animals. When a moving object passes through the sensor’s field of view, the sensor output goes HIGH. Arduino processes this signal and activates the connected device (like a buzzer, LED, or alarm).
Step-by-Step Working
- PIR sensor continuously monitors infrared radiation.
- When motion is detected, sensor output becomes HIGH.
- Arduino receives the signal and processes it.
- Output devices like buzzer or LED are activated.
- After a preset time, the output turns OFF automatically.
Components Required
- Arduino Uno
- PIR Sensor (HC-SR501)
- Buzzer or LED
- 220Ω Resistor (if using LED)
- Jumper Wires
- Breadboard / PCB
- Power Supply
Circuit Diagram
Connections
PIR Sensor:
VCC -> 5V
GND -> GND
OUT -> D2 (Arduino)
LED / Buzzer:
Positive -> D8 (Arduino)
Negative -> GND
Resistor (for LED) -> 220Ω in series
Arduino Code for PIR Motion Detector
int pirPin = 2;
int ledPin = 8;
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int motion = digitalRead(pirPin);
if (motion == HIGH) {
digitalWrite(ledPin, HIGH); // Turn ON LED or buzzer
Serial.println("Motion Detected!");
delay(1000); // Keep output ON for 1 second
} else {
digitalWrite(ledPin, LOW); // Turn OFF LED or buzzer
}
}
Code Explanation
- PIR sensor output is read by Arduino.
- If HIGH, motion is detected.
- LED or buzzer turns ON when motion is detected.
- Output turns OFF after the delay when no motion is detected.
Advantages
- Low cost and simple to implement
- Reliable motion detection
- Low power consumption
- Can be integrated with security systems
Applications
- Home and office security
- Automatic lighting systems
- Smart homes
- Intruder alarm systems
Future Enhancements
- Connect with GSM module to send alerts
- Integrate with cameras for surveillance
- IoT-based monitoring
- Voice alerts or SMS notification
Conclusion
The PIR Motion Detector is an essential electronics project for security and automation purposes. It is simple, efficient, and highly practical for real-life applications, helping students understand sensor interfacing and microcontroller-based automation.
