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

Arduino UNO Based Flood Alert System with GSM Notification and LCD Display

Image of Arduino UNO Based Flood Alert System with GSM Notification and LCD Display

Flood Alert System Circuit Documentation

Summary

The Flood Alert System is designed to monitor water levels using a sensor and to provide alerts when the water level exceeds a certain threshold. The system uses an Arduino UNO as the main controller, interfaced with a Water Level Sensor for detecting water levels, a SIM800L GSM Module for sending SMS alerts and making calls, and an LCD Display for real-time water level display. The Arduino UNO is programmed to read the water level, display it on the LCD, and use the GSM module to communicate alerts.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Purpose: Acts as the central processing unit of the circuit, reading sensor data, controlling the LCD display, and communicating with the GSM module.

Water Level Sensor

  • Description: A sensor that detects the level of water.
  • Purpose: To monitor the water level and provide input to the Arduino UNO.

SIM800L GSM Module

  • Description: A GSM/GPRS module that allows cellular communication.
  • Purpose: To send SMS alerts and make calls when the water level exceeds the threshold.

LCD Display 16x4 I2C

  • Description: A 16x4 character LCD display with an I2C interface.
  • Purpose: To display the current water level and system status messages.

Wiring Details

Arduino UNO

  • 3.3V to Water Level Sensor VCC
  • 5V to SIM800L GSM Module 5V
  • GND to SIM800L GSM Module GND, LCD Display GND, and Water Level Sensor GND
  • Vin to LCD Display VCC
  • A0 to Water Level Sensor SIG
  • A4 (SDA) to LCD Display SDA
  • A5 (SCL) to LCD Display SCL
  • D2 to SIM800L GSM Module SIM_TXD
  • D3 to SIM800L GSM Module SIM_RXD
  • D4 to SIM800L GSM Module RST

Water Level Sensor

  • SIG to Arduino UNO A0
  • VCC to Arduino UNO 3.3V
  • GND to Arduino UNO GND

SIM800L GSM Module

  • 5V to Arduino UNO 5V
  • GND to Arduino UNO GND
  • SIM_TXD to Arduino UNO D2
  • SIM_RXD to Arduino UNO D3
  • RST to Arduino UNO D4

LCD Display 16x4 I2C

  • SDA to Arduino UNO A4 (SDA)
  • SCL to Arduino UNO A5 (SCL)
  • VCC to Arduino UNO Vin
  • GND to Arduino UNO GND

Documented Code

// Flood Alert System
// This Arduino sketch monitors water levels using a sensor connected to A3.
// If the water level exceeds a threshold, it sends an SMS alert and makes a call
// using the GSM module. The water level is also displayed on an LCD.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4

int resval = 25;  // holds the value
int respin = A3; // Water Level Sensor Pin
int SDA_PIN = A4;
int SCL_PIN = A5;
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define FONA_RI_INTERRUPT 0
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

char PHONE_1[21] = "+919732329418"; // Enter your Mobile Number
char tempalert[141] = "Flood Alert";

void setup() {
  Wire.begin();
  lcd.init();
  lcd.backlight();
  Serial.begin(115200);
  Serial.println(F("Initializing....(May take 3 seconds)"));
  delay(5000);
  fonaSS.begin(9600); // if you're using software serial
  if (!fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  fona.print("AT+CSMP=17,167,0,0\r");
  Serial.println(F("FONA is OK"));
}

void loop() {
  resval = analogRead(respin);
  Serial.print("Water Level:");
  Serial.println(resval);
  if (resval > 50) {
    Serial.println("Flood Alert");
    lcd.setCursor(0, 0);
    lcd.print("Water Level:");
    lcd.print(resval);
    lcd.setCursor(0, 1);
    lcd.print("Calling....");
    make_multi_call();
    send_multi_sms();
  } else {
    lcd.setCursor(0, 0);
    lcd.print("Water Level:");
    lcd.print(resval);
  }
}

void send_multi_sms() {
  if (PHONE_1 != "") {
    Serial.print("Phone 1: ");
    fona.sendSMS(PHONE_1, tempalert);
    delay(20000);
  }
}

void make_multi_call() {
  if (PHONE_1 != "") {
    Serial.print("Phone 1: ");
    make_call(PHONE_1);
    delay(20000);
  }
}

void make_call(String phone) {
  Serial.println("calling....");
  lcd.setCursor(0, 1);
  lcd.print("Calling....");
  fona.println("ATD" + phone + ";");
  delay(20000); // 20 sec delay
  fona.println("ATH");
  delay(1000); // 1 sec delay
}

Note: The code provided is for the Arduino UNO microcontroller. It includes libraries for the LCD display and GSM module, defines pin connections, and contains functions for reading the water level sensor, displaying information on the LCD, and communicating via SMS and calls using the GSM module. The code is set up to trigger alerts when the water level exceeds a predefined threshold.