Arduino Nano-Based Landslide Detection System with GSM Alerts
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to detect potential landslides by monitoring soil moisture, vibrations, and tilt. It uses an Arduino Nano microcontroller to read sensor data from a soil moisture sensor, a vibration sensor, and an accelerometer. Based on the sensor readings, the system triggers alerts using LEDs and a buzzer. Additionally, it sends SMS alerts via a GSM module.
Component List
Arduino Nano
- Description: Microcontroller board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
SW-420 Vibration Sensor
- Description: Vibration sensor module.
- Pins: vcc, Ground, Digital output
Buzzer
- Description: Simple piezoelectric buzzer.
- Pins: PIN, GND
LED: Two Pin (red)
- Description: Red LED.
- Pins: cathode, anode
SIM800L GSM Module
- Description: GSM module for sending SMS.
- Pins: 5V, GND, VDD, SIM_TXD, SIM_RXD, RST
Soil Moisture Sensor
- Description: Sensor to measure soil moisture levels.
- Pins: VCC, GND, SIG
ADXL345 Accelerometer
- Description: 3-axis accelerometer.
- Pins: 3.3V, SDA, SCL, GND, 5V
Resistor (220 Ohms)
- Description: Resistor with 220 Ohms resistance.
- Pins: pin1, pin2
LED: Two Pin (yellow)
- Description: Yellow LED.
- Pins: cathode, anode
LED: Two Pin (green)
- Description: Green LED.
- Pins: cathode, anode
9V Battery
- Description: Power source.
- Pins: +, -
Wiring Details
Arduino Nano
- GND: Connected to GND of the 9V battery, red LED, green LED, SIM800L GSM Module, ADXL345 Accelerometer, Soil Moisture Sensor, SW-420 Vibration Sensor, and yellow LED.
- D2: Connected to Digital output of the SW-420 Vibration Sensor.
- D3: Connected to PIN of the Buzzer.
- D4: Connected to pin2 of a 220 Ohm Resistor.
- D5: Connected to pin2 of a 220 Ohm Resistor.
- D6: Connected to pin2 of a 220 Ohm Resistor.
- D7: Connected to SIM_RXD of the SIM800L GSM Module.
- D8: Connected to SIM_TXD of the SIM800L GSM Module.
- VIN: Connected to + of the 9V battery.
- 5V: Connected to 5V of the SIM800L GSM Module, ADXL345 Accelerometer, VCC of the Soil Moisture Sensor, and vcc of the SW-420 Vibration Sensor.
- A5: Connected to SCL of the ADXL345 Accelerometer.
- A4: Connected to SDA of the ADXL345 Accelerometer.
- A0: Connected to SIG of the Soil Moisture Sensor.
SW-420 Vibration Sensor
- vcc: Connected to 5V of the Arduino Nano.
- Ground: Connected to GND of the Arduino Nano.
- Digital output: Connected to D2 of the Arduino Nano.
Buzzer
- PIN: Connected to D3 of the Arduino Nano.
- GND: Connected to GND of the Arduino Nano.
LED: Two Pin (red)
- cathode: Connected to GND of the Arduino Nano.
- anode: Connected to pin1 of a 220 Ohm Resistor.
SIM800L GSM Module
- 5V: Connected to 5V of the Arduino Nano.
- GND: Connected to GND of the Arduino Nano.
- SIM_TXD: Connected to D8 of the Arduino Nano.
- SIM_RXD: Connected to D7 of the Arduino Nano.
Soil Moisture Sensor
- VCC: Connected to 5V of the Arduino Nano.
- GND: Connected to GND of the Arduino Nano.
- SIG: Connected to A0 of the Arduino Nano.
ADXL345 Accelerometer
- 3.3V: Not connected.
- SDA: Connected to A4 of the Arduino Nano.
- SCL: Connected to A5 of the Arduino Nano.
- GND: Connected to GND of the Arduino Nano.
- 5V: Connected to 5V of the Arduino Nano.
Resistor (220 Ohms)
- pin1: Connected to anode of the red LED.
- pin2: Connected to D6 of the Arduino Nano.
Resistor (220 Ohms)
- pin1: Connected to anode of the yellow LED.
- pin2: Connected to D5 of the Arduino Nano.
Resistor (220 Ohms)
- pin1: Connected to anode of the green LED.
- pin2: Connected to D4 of the Arduino Nano.
LED: Two Pin (yellow)
- cathode: Connected to GND of the Arduino Nano.
- anode: Connected to pin1 of a 220 Ohm Resistor.
LED: Two Pin (green)
- cathode: Connected to GND of the Arduino Nano.
- anode: Connected to pin1 of a 220 Ohm Resistor.
9V Battery
- +: Connected to VIN of the Arduino Nano.
- -: Connected to GND of the Arduino Nano.
Documented Code
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
#include <SoftwareSerial.h>
// Pin definitions
#define SOIL_SENSOR_PIN A0
#define VIBRATION_SENSOR_PIN 2
#define BUZZER_PIN 3
#define GREEN_LED 4
#define YELLOW_LED 5
#define RED_LED 6
// Threshold values
#define MOISTURE_THRESHOLD 500 // Soil moisture threshold
#define VIBRATION_THRESHOLD 100 // Vibration sensor threshold
#define TILT_THRESHOLD 15.0 // Tilt threshold (degrees)
// Initialize accelerometer
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345);
// GSM module connected to pins D7 (TX) and D8 (RX)
SoftwareSerial gsm(7, 8);
void setup() {
// Pin Modes
pinMode(SOIL_SENSOR_PIN, INPUT);
pinMode(VIBRATION_SENSOR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(YELLOW_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
// Initialize Serial and GSM
Serial.begin(9600);
gsm.begin(9600);
// Initialize Accelerometer
if (!accel.begin()) {
Serial.println("No ADXL345 detected, check wiring.");
while (1);
}
accel.setRange(ADXL345_RANGE_16_G); // Set range for the accelerometer
}
void loop() {
int moistureLevel = analogRead(SOIL_SENSOR_PIN);
int vibration = digitalRead(VIBRATION_SENSOR_PIN);
sensors_event_t event;
accel.getEvent(&event);
float tilt = atan2(event.acceleration.y, event.acceleration.x) * 180 / PI;
// Print sensor readings
Serial.print("Soil Moisture: ");
Serial.println(moistureLevel);
Serial.print("Vibration: ");
Serial.println(vibration);
Serial.print("Tilt: ");
Serial.println(tilt);
// Landslide detection logic
if (moistureLevel > MOISTURE_THRESHOLD || vibration > VIBRATION_THRESHOLD || abs(tilt) > TILT_THRESHOLD) {
// Trigger alert
digitalWrite(BUZZER_PIN, HIGH);
digitalWrite(RED_LED, HIGH);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(GREEN_LED, LOW);
sendSMS("Warning: Possible landslide detected!");
delay(2000);
} else if (moistureLevel > MOISTURE_THRESHOLD || abs(tilt) > (TILT_THRESHOLD / 2)) {
// Moderate alert
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(RED_LED, LOW);
digitalWrite(YELLOW_LED, HIGH);
digitalWrite(GREEN_LED, LOW);
} else {
// Normal status