1. Introduction
Motion detection systems are widely used in security systems, automatic lighting, and smart home applications. These systems detect the presence of humans or animals and trigger an alarm or perform an automatic action.
In this project, we will build a simple Arduino PIR Motion Sensor Alarm using a PIR sensor, buzzer, and LED. The PIR sensor detects infrared radiation emitted by the human body and sends a signal to the Arduino when motion is detected.
When a person moves in front of the sensor, the Arduino activates a buzzer and LED alarm to indicate motion detection.
This is a simple and useful beginner Arduino project that helps students understand motion sensing and sensor interfacing with microcontrollers.
2. Components
The following components are required for this project:
-
Arduino Uno
-
PIR Motion Sensor (HC-SR501)
-
Buzzer
-
LED
-
220Ω Resistor
-
Breadboard
-
Jumper Wires
-
USB Cable for Arduino
3. Circuit and Connections
Make the following connections.
PIR Motion Sensor
-
VCC → Arduino 5V
-
GND → Arduino GND
-
OUT → Arduino Pin 2
Buzzer
-
Buzzer Positive (+) → Arduino Pin 8
-
Buzzer Negative (–) → Arduino GND
LED Indicator
-
LED Anode (+) → Arduino Pin 13
-
LED Cathode (–) → 220Ω Resistor → GND
The PIR sensor detects motion and sends a signal to the Arduino through the output pin.
4. Circuit Working
The PIR sensor detects motion by measuring changes in infrared radiation in its environment.
When a person moves in front of the sensor, the infrared radiation changes. The PIR sensor detects this change and produces a HIGH signal at its output pin.
The Arduino continuously reads the PIR sensor output.
-
No Motion Detected
-
Sensor output LOW
-
Buzzer OFF
-
LED OFF
-
-
Motion Detected
-
Sensor output HIGH
-
Arduino turns buzzer ON
-
Arduino turns LED ON
-
Thus the system acts as a simple motion detection alarm system.
5. Code
int pir = 2;
int buzzer = 8;
int led = 13;
void setup()
{
pinMode(pir, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
}
void loop()
{
int motion = digitalRead(pir);
if(motion == HIGH)
{
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
}
else
{
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
}
}
6. Code Working
First, the pins connected to the PIR sensor, buzzer, and LED are defined in the program.
The PIR sensor pin is configured as an input, while the buzzer and LED pins are configured as outputs in the setup function.
Inside the loop function, the Arduino continuously reads the PIR sensor output.
If the sensor output becomes HIGH, it means motion has been detected. The Arduino immediately turns ON the buzzer and LED.
If the output is LOW, it means no motion is present, so the buzzer and LED remain OFF.
7. Tips
-
Allow the PIR sensor 30–60 seconds to stabilize after powering it.
-
Adjust the sensitivity and delay potentiometers on the sensor module if required.
-
Place the sensor where it has a clear view of the area to be monitored.
-
Avoid placing the sensor near heat sources like heaters or sunlight.
8. Uses
This motion detection system can be used in many applications such as:
-
Security alarm systems
-
Automatic lighting systems
-
Smart home automation
-
Intruder detection systems
-
Energy saving lighting systems
9. Conclusion
In this project, we built a simple Arduino PIR Motion Sensor Alarm system using a PIR sensor, buzzer, and LED. The PIR sensor detects human movement and sends a signal to the Arduino, which activates an alarm.
This project demonstrates how motion sensors can be used with Arduino to create simple security and automation systems.