Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Nano-Based Landslide Detection System with GSM Alerts

Image of Arduino Nano-Based Landslide Detection System with GSM Alerts

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 process sensor data and trigger alerts via a buzzer and LEDs. Additionally, a GSM module is used to send SMS alerts in case of a detected landslide.

Component List

  1. Arduino Nano

    • Description: A small, complete, and breadboard-friendly 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
  2. SW-420 Vibration Sensor

    • Description: A vibration sensor module that detects vibrations and outputs a digital signal.
    • Pins: vcc, Ground, Digital output
  3. Buzzer

    • Description: An electronic device that emits sound when a voltage is applied.
    • Pins: PIN, GND
  4. LED: Two Pin (red)

    • Description: A red LED with two pins.
    • Pins: cathode, anode
  5. SIM800L GSM Module

    • Description: A GSM module used for sending SMS messages.
    • Pins: 5V, GND, VDD, SIM_TXD, SIM_RXD, RST
  6. Soil Moisture Sensor

    • Description: A sensor that measures the moisture level in the soil.
    • Pins: VCC, GND, SIG
  7. ADXL345 Accelerometer (keystudio)

    • Description: A 3-axis accelerometer used to measure tilt and acceleration.
    • Pins: 3.3V, SDA, SCL, GND, 5V
  8. Resistor (220 Ohms)

    • Description: A resistor with a resistance of 220 Ohms.
    • Pins: pin1, pin2
  9. LED: Two Pin (yellow)

    • Description: A yellow LED with two pins.
    • Pins: cathode, anode
  10. LED: Two Pin (green)

    • Description: A green LED with two pins.
    • Pins: cathode, anode
  11. 9V Battery

    • Description: A 9V battery used to power the circuit.
    • Pins: +, -

Wiring Details

Arduino Nano

  • GND connected to:

    • Buzzer (GND)
    • ADXL345 Accelerometer (GND)
    • SIM800L GSM Module (GND)
    • Soil Moisture Sensor (GND)
    • 9V Battery (-)
    • Red LED (cathode)
    • Green LED (cathode)
    • Yellow LED (cathode)
    • SW-420 Vibration Sensor (Ground)
  • D2 connected to:

    • SW-420 Vibration Sensor (Digital output)
  • D3 connected to:

    • Buzzer (PIN)
  • D4 connected to:

    • Resistor (pin2)
  • D5 connected to:

    • Resistor (pin2)
  • D6 connected to:

    • Resistor (pin2)
  • D7 connected to:

    • SIM800L GSM Module (SIM_RXD)
  • D8 connected to:

    • SIM800L GSM Module (SIM_TXD)
  • VIN connected to:

    • 9V Battery (+)
  • 5V connected to:

    • ADXL345 Accelerometer (5V)
    • SIM800L GSM Module (5V)
    • Soil Moisture Sensor (VCC)
    • SW-420 Vibration Sensor (vcc)
  • A5 connected to:

    • ADXL345 Accelerometer (SCL)
  • A4 connected to:

    • ADXL345 Accelerometer (SDA)
  • A0 connected to:

    • Soil Moisture Sensor (SIG)

SW-420 Vibration Sensor

  • vcc connected to:

    • Arduino Nano (5V)
  • Ground connected to:

    • Arduino Nano (GND)
  • Digital output connected to:

    • Arduino Nano (D2)

Buzzer

  • PIN connected to:

    • Arduino Nano (D3)
  • GND connected to:

    • Arduino Nano (GND)

LED: Two Pin (red)

  • cathode connected to:

    • Arduino Nano (GND)
  • anode connected to:

    • Resistor (pin1)

SIM800L GSM Module

  • 5V connected to:

    • Arduino Nano (5V)
  • GND connected to:

    • Arduino Nano (GND)
  • SIM_TXD connected to:

    • Arduino Nano (D8)
  • SIM_RXD connected to:

    • Arduino Nano (D7)

Soil Moisture Sensor

  • VCC connected to:

    • Arduino Nano (5V)
  • GND connected to:

    • Arduino Nano (GND)
  • SIG connected to:

    • Arduino Nano (A0)

ADXL345 Accelerometer (keystudio)

  • 5V connected to:

    • Arduino Nano (5V)
  • GND connected to:

    • Arduino Nano (GND)
  • SCL connected to:

    • Arduino Nano (A5)
  • SDA connected to:

    • Arduino Nano (A4)

Resistor (220 Ohms)

  • pin1 connected to:

    • Red LED (anode)
    • Green LED (anode)
    • Yellow LED (anode)
  • pin2 connected to:

    • Arduino Nano (D4)
    • Arduino Nano (D5)
    • Arduino Nano (D6)

LED: Two Pin (yellow)

  • cathode connected to:

    • Arduino Nano (GND)
  • anode connected to:

    • Resistor (pin1)

LED: Two Pin (green)

  • cathode connected to:

    • Arduino Nano (GND)
  • anode connected to:

    • Resistor (pin1)

9V Battery

  • + connected to:

    • Arduino Nano (VIN)
  • - connected to:

    • Arduino Nano (GND)

Code Documentation

#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 (