Introduction π
Want to protect your room from intruders or set up an automatic alert system? With a motion sensor alarm, you can detect movement and trigger an alarm whenever someone enters your space! ππ
- Introduction π
- How Does a Motion Sensor Alarm Work? π€
- What You Need π οΈ
- Circuit Diagram π
- Step-by-Step Assembly ποΈ
- Step 1: Connect the PIR Motion Sensor π
- Step 2: Connect the Transistor Switch (For Non-Arduino Version) π
- Step 3: Connect the Buzzer or Siren π
- Step 4: Connect a Relay (For AC Alarms) β‘
- Step 5: Code for Arduino-Based Motion Alarm π¨βπ»
- Testing & Troubleshooting π οΈ
- Expanding the Project π
- Conclusion π―
In this guide, weβll build a DIY motion sensor alarm using a PIR sensor, a buzzer (or siren), and an Arduino or transistor-based circuit. Letβs get started! π οΈπ
Β
How Does a Motion Sensor Alarm Work? π€
A PIR (Passive Infrared) sensor detects movement by sensing heat changes in its surroundings. When a person moves, the PIR sensor triggers a circuit that activates a buzzer, LED, or siren.
Key Components in a Motion Sensor Alarm:
1οΈβ£ PIR Sensor π β Detects motion using infrared radiation.
2οΈβ£ Buzzer or Siren π β Alerts when movement is detected.
3οΈβ£ LED (Optional) π‘ β Indicator light for detection.
4οΈβ£ Relay Module (For High-Power Sirens) β‘ β Controls AC-powered alarms.
5οΈβ£ Microcontroller (Arduino) or Transistor Switch π§ β Processes the PIR signal.
π‘ Alternative: You can build this without an Arduino using a transistor-based circuit!
Β
What You Need π οΈ
To build a basic motion sensor alarm, gather these components:
β PIR Motion Sensor (HC-SR501) π β Detects movement.
β Buzzer or Siren (5V or 12V) π β Sound alert.
β Transistor (BC547 or 2N3904) π β Amplifies PIR signal (if using without Arduino).
β Resistors (1KΞ©, 10KΞ©) β‘ β Controls circuit current.
β Relay Module (5V) β‘ β Controls AC-powered alarms (optional).
β LED + 330Ξ© Resistor π‘ β Visual indicator for detection.
β Power Supply (5V or 9V Battery) π β To power the circuit.
β Breadboard & Jumper Wires π β For easy connections.
π‘ Tip: For a wireless alarm, connect the output to a Wi-Fi module (ESP8266 or ESP32) for phone notifications!
Β
Circuit Diagram π
1οΈβ£ Motion Sensor Alarm (Basic Transistor Circuit)
[PIR Sensor]
β
[Transistor (BC547)]
β
[Buzzer or LED]
β
[Power (5V)] ---- [GND]
2οΈβ£ Motion Sensor Alarm Using Arduino
[PIR Sensor (HC-SR501)]
β
[Arduino Digital Input]
β
[Buzzer (Pin 7) + LED]
β
[5V Power Supply]
Step-by-Step Assembly ποΈ
Step 1: Connect the PIR Motion Sensor π
πΉ VCC β 5V
πΉ GND β Ground (GND)
πΉ OUT β Base of Transistor (via 10KΞ© Resistor) OR Arduino Digital Pin 2
π‘ How It Works? The PIR sensor detects movement and sends a HIGH signal (3.3V) to activate the buzzer or alarm.
Β
Step 2: Connect the Transistor Switch (For Non-Arduino Version) π
πΉ Emitter (E) β Ground (GND)
πΉ Collector (C) β Buzzer Negative (-)
πΉ Base (B) β PIR OUT via 10KΞ© Resistor
π‘ Why a transistor? The PIR sensorβs signal is too weak to drive a buzzer directly, so the transistor amplifies it!
Β
Step 3: Connect the Buzzer or Siren π
πΉ For Small Buzzers (5V): Connect + to 5V, β to transistor or Arduino Pin 7.
πΉ For High-Power Sirens (12V): Use a Relay Module to switch the alarm ON/OFF.
π‘ Tip: Add an LED with a 330Ξ© resistor as a visual indicator! π‘
Β
Step 4: Connect a Relay (For AC Alarms) β‘
πΉ Relay IN β Transistor Collector or Arduino Pin 8
πΉ Relay VCC β 5V
πΉ Relay GND β Ground
πΉ Relay NO (Normally Open) β Alarm Live Wire
π‘ When motion is detected, the relay activates, turning ON an AC-powered siren! π¨
Β
Step 5: Code for Arduino-Based Motion Alarm π¨βπ»
Upload this Arduino Sketch using the Arduino IDE:
cpp
--------
#define PIR_PIN 2
#define BUZZER_PIN 7
#define LED_PIN 8
void setup() {
pinMode(PIR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
int motion = digitalRead(PIR_PIN);
if (motion == HIGH) {
digitalWrite(BUZZER_PIN, HIGH);
digitalWrite(LED_PIN, HIGH);
Serial.println("Motion Detected! π¨");
delay(2000); // Keep alarm ON for 2 seconds
} else {
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
}
}
π‘ How It Works?
- The PIR sensor detects motion and sends a HIGH signal.
- The buzzer and LED turn ON for 2 seconds, then reset.
Testing & Troubleshooting π οΈ
π΄ Alarm Not Triggering?
βοΈ Check PIR sensor wiring (VCC, GND, OUT).
βοΈ Increase motion sensitivity using the PIR module potentiometer.
π΄ False Alarms?
βοΈ Place the PIR sensor away from heat sources (windows, lamps, AC vents).
βοΈ Reduce sensitivity using the adjustable delay knob on the PIR sensor.
π΄ Relay Not Working?
βοΈ Use a separate power supply for 12V relays.
βοΈ Check if relay IN pin is receiving HIGH signal from the transistor or Arduino.
Expanding the Project π
β Add a GSM Module π β Sends an SMS alert when motion is detected.
β Connect to Wi-Fi π β Use an ESP8266 or ESP32 for a smartphone notification system.
β Use a Camera π· β Trigger a photo capture when motion is detected.
β Battery Backup π β Add a 9V battery for uninterrupted operation.
Conclusion π―
Congratulations! π Youβve built a DIY motion sensor alarm that detects movement and triggers an alert! Now your room is protected with a smart security system. π¨π
Quick Recap:
β Used a PIR motion sensor to detect movement.
β Controlled a buzzer or relay for an alarm.
β Built a transistor-based or Arduino-based alarm system.
β Learned how to expand it with Wi-Fi, GSM, or camera modules.
π Next Step: Upgrade your alarm to send SMS alerts or integrate with a smart home system!


