Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Soil Moisture Monitoring with GSM Alert System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Soil Moisture Monitoring with GSM Alert System

Landslide Early Detection Device Documentation

Summary

The Landslide Early Detection Device is designed to monitor soil moisture levels and send an SMS alert if the moisture level falls below a predefined threshold, indicating potential landslide conditions. The circuit utilizes an Arduino UNO as the main controller, interfaced with a Soil Moisture Sensor for detecting moisture levels and a SIM 800L V2.0 GSM module for sending SMS alerts. The Soil Moisture Module provides an interface between the sensor and the Arduino.

Component List

Arduino UNO

Soil Moisture Sensor

Soil Moisture Module

SIM 800L V2.0 GSM

Wiring Details

Arduino UNO

Soil Moisture Sensor

Soil Moisture Module

SIM 800L V2.0 GSM

Documented Code

/*
 * Landslide Early Detection Device
 * This code reads the soil moisture sensor value and sends an SMS alert
 * using the SIM800L module if the moisture level falls below a threshold.
 */

#include <SoftwareSerial.h>

// Pin definitions
const int soilMoisturePin = A0;
const int simTxPin = 10;
const int simRxPin = 11;

// Threshold for soil moisture
const int moistureThreshold = 200;

// Create a software serial port for SIM800L
SoftwareSerial sim800l(simTxPin, simRxPin);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  sim800l.begin(9600);

  // Initialize soil moisture sensor pin
  pinMode(soilMoisturePin, INPUT);

  // Wait for SIM800L to initialize
  delay(1000);

  // Send initial AT command to check communication
  sim800l.println("AT");
  delay(1000);
  if (sim800l.available()) {
    Serial.println(sim800l.readString());
  }
}

void loop() {
  // Read soil moisture value
  int soilMoistureValue = analogRead(soilMoisturePin);
  Serial.print("Soil Moisture Value: ");
  Serial.println(soilMoistureValue);

  // Check if soil moisture is below threshold
  if (soilMoistureValue <= moistureThreshold) {
    sendSMS("Landslide detected!");
  }

  // Wait for a while before next reading
  delay(10000);
}

void sendSMS(String message) {
  // Set SMS mode to text
  sim800l.println("AT+CMGF=1");
  delay(1000);

  // Send SMS to the number saved on the SIM card
  sim800l.println("AT+CMGS=\"+1234567890\""); // Replace with actual number
  delay(1000);
  sim800l.print(message);
  delay(1000);
  sim800l.write(26); // ASCII code for CTRL+Z to send the message
  delay(1000);

  // Print response from SIM800L
  if (sim800l.available()) {
    Serial.println(sim800l.readString());
  }
}

This code is responsible for initializing the Arduino UNO and its peripherals, reading the soil moisture level, and using the SIM800L module to send an SMS alert if the moisture level is below the set threshold. The sendSMS function is used to send the actual message. The code is written in Arduino's C++-like language and should be uploaded to the Arduino UNO using the Arduino IDE.