1. Introduction
Security is an important aspect in homes, lockers, vehicles, and industries. In this project, we design a Vibration Sensor Alarm System using Arduino that detects shocks or vibrations and triggers an alarm using a buzzer.
This system is useful for:
- Locker and cupboard security
- Bike or vehicle protection
- Basic earthquake or vibration detection
- Industrial safety monitoring
2. Components
- Arduino UNO / Nano
- Vibration Sensor Module (SW-420)
- Buzzer
- LED (optional)
- Resistor (220Ω for LED)
- Connecting wires
- Breadboard
3. Circuit and Connections
| Pinout Diagram of Arduino Uno |
| Vibration Sensor (SW-420): Pinout Diagram |
| Pinout Diagram of Buzzer |
- VCC → 5V
- GND → GND
- DO → Digital Pin 2
🔔 Buzzer:
- Positive → Pin 8
- Negative → GND
💡 LED (Optional):
- Anode → Pin 7 (through resistor)
- Cathode → GND
4. Detailed Step By Step Circuit Working
The SW-420 vibration sensor detects movement or shock:
- Inside the module, a spring and mass system responds to vibration
- When vibration occurs, the internal contact changes
- The module outputs a digital HIGH signal
- Arduino reads this signal
- Buzzer and LED are activated
👉 No vibration → LOW
👉 Vibration → HIGH
5. Libraries to be included
👉 No external libraries required (simple digital input)
6. Code
#define sensorPin 2
#define buzzerPin 8
#define ledPin 7
void setup() {
pinMode(sensorPin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int sensorValue = digitalRead(sensorPin);
if (sensorValue == HIGH) {
digitalWrite(buzzerPin, HIGH);
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
digitalWrite(ledPin, LOW);
}
}
7. Detailed Step By Step Code Working
sensorPinreads vibration signal- If vibration detected (HIGH):
- Buzzer ON
- LED ON
- If no vibration:
- Buzzer OFF
- LED OFF
👉 Simple real-time detection system
8. Working Principle
The SW-420 works on a mechanical vibration detection principle:
- Internal spring moves during vibration
- Contact is made/broken
- Digital signal generated
- Arduino processes and triggers output
9. Advantages
- Simple and low-cost system
- Easy to build and understand
- Useful for security applications
- Fast response time
10. Disadvantages
- May give false triggers (high sensitivity)
- Not suitable for precise measurement
- Requires adjustment using onboard potentiometer
11. Applications
- Anti-theft alarm systems
- Locker and safe security
- Vehicle vibration detection
- Industrial machine monitoring
12. Conclusion
This Arduino Vibration Sensor Alarm System is a simple yet effective security solution. It demonstrates how vibration can be detected and used to trigger alerts in real time. The project can be further enhanced with IoT and GSM features.