Arduino Nano Landslide Detection System with GSM Alerts
A multi-sensor early warning platform that fuses soil moisture, vibration, and tilt data to detect landslide precursors and fire instant SMS alerts — no internet required, ideal for remote hill stations and mining areas.
Project Overview
The Arduino Nano Landslide Detection System is a smart environmental safety solution combining three complementary sensors to catch early warning signs of slope failure. Wet soil lowers shear strength, micro-vibrations signal unstable movement, and angle shifts confirm active displacement — monitoring all three together dramatically reduces false alarms while catching real events early.
How the System Works
Components Required
| # | Component | Spec / Notes | Qty |
|---|---|---|---|
| 1 | Arduino Nano | ATmega328P, 5V, 14 digital + 8 analog pins | 1 |
| 2 | Soil Moisture Sensor | Capacitive or resistive, analog output (AO) | 1 |
| 3 | SW-420 Vibration Sensor | Digital output, adjustable sensitivity via pot | 1 |
| 4 | ADXL345 Accelerometer | I²C interface, ±16g range, 3.3V supply | 1 |
| 5 | GSM Module (SIM800L or SIM900) | SIM800L: 4V/2A peak · SIM900: 5V/2A peak | 1 |
| 6 | Regulated Power Supply | 5V/2A for Nano + sensors; separate 4V/2A for SIM800L | 1–2 |
| 7 | Active Buzzer | 5V, 85dB+ | 1 |
| 8 | LEDs (Green / Yellow / Red) | 5mm, with 220Ω resistors each | 3 |
| 9 | Active SIM Card | GSM carrier with SMS plan | 1 |
| 10 | Jumper Wires + Breadboard | Male-to-male and male-to-female | ~20 |
| 11 | 220Ω Resistors | For each LED current limiting | 3 |
Circuit Diagram & Pinout
📌 Full Pin Connection Reference
| Component | Component Pin | Arduino Nano | Wire |
|---|---|---|---|
| Soil Moisture | AO | A0 | Orange |
| Soil Moisture | VCC | 5V | Red |
| Soil Moisture | GND | GND | Black |
| SW-420 Vibration | DO | D2 | Yellow |
| SW-420 Vibration | VCC | 5V | Red |
| SW-420 Vibration | GND | GND | Black |
| ADXL345 | SDA | A4 | Purple |
| ADXL345 | SCL | A5 | Blue |
| ADXL345 | VCC | 3.3V ⚠️ | Red |
| ADXL345 | GND | GND | Black |
| SIM800L/SIM900 | TX | D7 (SoftSerial RX) | Green |
| SIM800L/SIM900 | RX | D8 (SoftSerial TX) | Teal |
| SIM800L/SIM900 | VCC | External 4V/5V PSU | Red |
| SIM800L/SIM900 | GND | Common GND | Black |
| Buzzer | + | D3 | Red |
| Green LED | Anode | D4 (via 220Ω) | Green |
| Yellow LED | Anode | D5 (via 220Ω) | Yellow |
| Red LED | Anode | D6 (via 220Ω) | Red |
Sensor Thresholds & Alert Logic
Thresholds below are starting points — calibrate for your specific soil type, sensor model, and geographic conditions.
| Sensor | Safe (🟢) | Caution (🟡) | Alert (🔴) | Variable |
|---|---|---|---|---|
| Soil Moisture (0–1023) | < 250 | 250–500 | > 500 | MOISTURE_THRESHOLD 500 |
| Vibration (digital) | LOW | Intermittent | HIGH (sustained) | VIBRATION_THRESHOLD |
| Tilt Angle (degrees) | < 7.5° | 7.5°–15° | > 15° | TILT_THRESHOLD 15.0 |
Step-by-Step Build Instructions
Install Required Arduino Libraries
Open Arduino IDE → Sketch → Include Library → Manage Libraries. Search for and install:
- Adafruit ADXL345 by Adafruit
- Adafruit Unified Sensor by Adafruit
- Wire (built-in — no install needed)
- SoftwareSerial (built-in — no install needed)
Wire the Soil Moisture Sensor
- AO → Arduino A0 (orange wire)
- VCC → Arduino 5V
- GND → Arduino GND
Wire the SW-420 Vibration Sensor
- DO → Arduino D2 (yellow wire)
- VCC → Arduino 5V
- GND → Arduino GND
Use the onboard potentiometer to adjust sensitivity. Turn clockwise to increase sensitivity (triggers on smaller vibrations).
Wire the ADXL345 Accelerometer (I²C)
- SDA → Arduino A4 (purple wire)
- SCL → Arduino A5 (blue wire)
- VCC → Arduino 3.3V ⚠️ (NOT 5V)
- GND → Arduino GND
Wire the GSM Module (SIM800L / SIM900)
- Insert active SIM card into the module
- GSM TX → Arduino D7 (SoftwareSerial RX)
- GSM RX → Arduino D8 (SoftwareSerial TX)
- VCC → External regulated power (4V for SIM800L, 5V for SIM900)
- GND → Common GND
Wire the Buzzer & Status LEDs
- Buzzer (+) → D3 · Buzzer (−) → GND
- Green LED anode → 220Ω resistor → D4
- Yellow LED anode → 220Ω resistor → D5
- Red LED anode → 220Ω resistor → D6
- All LED cathodes → GND
Calibrate Sensor Thresholds
Before uploading the final sketch, upload a calibration sketch to read raw sensor values in Serial Monitor:
void setup() { Serial.begin(9600); } void loop() { Serial.print("Moisture: "); Serial.println(analogRead(A0)); Serial.print("Vibration: "); Serial.println(digitalRead(2)); delay(500); }
Record normal readings, then simulate wet soil / tapping the sensor to determine your real thresholds. Update MOISTURE_THRESHOLD and TILT_THRESHOLD accordingly.
Upload Main Sketch & Test
Replace the phone number in the code with your own +91XXXXXXXXXX. Select Arduino Nano and the correct COM port, then Upload. Open Serial Monitor at 9600 baud to watch live sensor readings.
Full Source Code
Complete Arduino sketch with three-level alert logic, ADXL345 tilt calculation, and GSM SMS sending:
#include <Wire.h> #include <Adafruit_Sensor.h> #include <Adafruit_ADXL345_U.h> #include <SoftwareSerial.h> // ─── Pin Definitions ────────────────────────────────────────────────────────── #define SOIL_PIN A0 #define VIBRATION_PIN 2 #define BUZZER_PIN 3 #define GREEN_LED 4 #define YELLOW_LED 5 #define RED_LED 6 // ─── Thresholds (calibrate for your environment) ────────────────────────────── #define MOISTURE_THRESHOLD 500 // 0–1023 ADC range #define TILT_THRESHOLD 15.0 // degrees — full alert // SW-420 is digital: HIGH = vibration detected // ─── GSM Configuration ──────────────────────────────────────────────────────── #define PHONE_NUMBER "+91XXXXXXXXXX" // ← your number here SoftwareSerial gsm(7, 8); // RX=D7, TX=D8 // ─── Objects ────────────────────────────────────────────────────────────────── Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); // ─── State ──────────────────────────────────────────────────────────────────── unsigned long lastAlertTime = 0; const unsigned long ALERT_COOLDOWN_MS = 60000; // 1 min between SMS void setup() { pinMode(SOIL_PIN, INPUT); pinMode(VIBRATION_PIN, INPUT); pinMode(BUZZER_PIN, OUTPUT); pinMode(GREEN_LED, OUTPUT); pinMode(YELLOW_LED, OUTPUT); pinMode(RED_LED, OUTPUT); Serial.begin(9600); gsm.begin(9600); if (!accel.begin()) { Serial.println("ADXL345 not found – check wiring!"); while (1); } accel.setRange(ADXL345_RANGE_16_G); Serial.println("Landslide Detection System Ready"); setLED("green"); } void loop() { int moisture = analogRead(SOIL_PIN); bool vibration = digitalRead(VIBRATION_PIN); sensors_event_t event; accel.getEvent(&event); float tilt = atan2(event.acceleration.y, event.acceleration.x) * 180.0 / PI; Serial.print("Moisture:"); Serial.print(moisture); Serial.print(" Vibration:"); Serial.print(vibration); Serial.print(" Tilt:"); Serial.println(tilt, 1); bool criticalAlert = (moisture > MOISTURE_THRESHOLD || vibration == HIGH || abs(tilt) > TILT_THRESHOLD); bool warningAlert = (moisture > MOISTURE_THRESHOLD/2 || abs(tilt) > TILT_THRESHOLD/2); if (criticalAlert) { setLED("red"); unsigned long now = millis(); if (now - lastAlertTime > ALERT_COOLDOWN_MS) { String msg = "⚠ LANDSLIDE ALERT!\n" "Moisture: " + String(moisture) + "\n" "Tilt: " + String(tilt,1) + "deg\n" "Vibration: " + String(vibration ? "YES" : "NO"); sendSMS(msg); lastAlertTime = now; } delay(2000); } else if (warningAlert) { setLED("yellow"); } else { setLED("green"); } delay(1000); } // ─── Helper: set LED + buzzer state ─────────────────────────────────────────── void setLED(String state) { digitalWrite(BUZZER_PIN, state == "red" ? HIGH : LOW); digitalWrite(RED_LED, state == "red" ? HIGH : LOW); digitalWrite(YELLOW_LED, state == "yellow" ? HIGH : LOW); digitalWrite(GREEN_LED, state == "green" ? HIGH : LOW); } // ─── Helper: send GSM SMS ───────────────────────────────────────────────────── void sendSMS(String message) { gsm.println("AT+CMGF=1"); // Text mode delay(1000); gsm.println("AT+CMGS=\"" + String(PHONE_NUMBER) + "\""); delay(1000); gsm.println(message); delay(100); gsm.println((char)26); // CTRL+Z = send delay(3000); Serial.println("SMS sent."); }
ALERT_COOLDOWN_MS variable (default 60s) prevents SMS flooding during a sustained alert. Adjust to suit your deployment requirements.Simulation & Testing Tools
Prototype and validate this project online before soldering anything:
Applications & Benefits
✅ Key Benefits
Works without internet (GSM-only) · Multi-sensor fusion reduces false alarms · Three-tier alert system (normal / caution / critical) · Low-cost open-source hardware · Expandable to IoT cloud platforms (ThingSpeak, Blynk) · Scalable to multi-node network deployments · Learning platform for I²C, UART, and sensor fusion
Comments
Post a Comment