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

Arduino-Based Flood Warning System with GSM Alert and Audio Warning

Image of Arduino-Based Flood Warning System with GSM Alert and Audio Warning

Circuit Documentation

Summary

This circuit is designed as a real-time flood warning system. It utilizes multiple water level sensors to monitor water levels and an Arduino UNO microcontroller to process sensor data. When water levels exceed a predefined threshold, the system sends alerts via SMS using the SIM800L GSM module and triggers an audio warning using the ISD1820 voice module. The system is powered by a 9V battery, which is maintained by a solar charge controller connected to a solar panel. A voltage regulator ensures stable power supply to the Arduino UNO. A DC motor is controlled by an L293D motor driver, which could be used for an actuator in the flood warning system.

Component List

Water Level Sensor

  • Description: Measures the level of water.
  • Pins: SIG (Signal), VCC (Power), GND (Ground).

Arduino UNO

  • Description: Microcontroller board based on the ATmega328P.
  • Pins: Various digital and analog I/O pins, power, and ground.

9V Battery

  • Description: Provides power to the circuit.
  • Pins: + (Positive), - (Negative).

Solar Charge Controller

  • Description: Manages the power coming from the solar panel to the battery and load.
  • Pins: Solar Cell +, Solar Cell -, Battery +, Battery -, Load +, Load -.

Voltage Regulator

  • Description: Regulates input voltage to a stable output voltage.
  • Pins: GND (Ground), IN (Input Voltage), OUT (Output Voltage).

L293D Motor Driver

  • Description: Drives DC motors.
  • Pins: Motor control and power pins.

SIM 800L V2.0 GSM Module

  • Description: GSM/GPRS module for mobile communication.
  • Pins: SIM_TXD, VDD, SIM.RXD, 5V/4V, GND, RST.

ISD1820 Voice Module

  • Description: Audio playback and recording module.
  • Pins: VCC (Power), GND (Ground), P-E (Play Enable), Sp1, SP2.

DC Motor

  • Description: Converts electrical energy into mechanical motion.
  • Pins: pin 1, pin 2.

Solar Panel

  • Description: Converts sunlight into electrical energy.
  • Pins: gnd (Ground), vcc (Voltage).

Speaker

  • Description: Converts electrical signals into sound.
  • Pins: + (Positive), - (Negative).

Wiring Details

Water Level Sensor

  • SIG: Connected to Arduino UNO digital pins (D7, D8, D9).
  • VCC: Connected to SIM 800L V2.0 GSM 5V/4V.
  • GND: Common ground with SIM 800L V2.0 GSM, ISD1820, and Arduino UNO.

Arduino UNO

  • GND: Common ground with various components.
  • 5V: Powers the SIM 800L V2.0 GSM module.
  • Digital Pins (D0, D1, D7, D8, D9, D10): Connected to SIM 800L V2.0 GSM and ISD1820 modules, and water level sensors.
  • Vin: Connected to the output of the voltage regulator.

9V Battery

  • +: Connected to the Solar Charge Controller "Battery +" and Voltage Regulator "IN".
  • -: Connected to the Solar Charge Controller "Battery -" and Voltage Regulator "GND".

Solar Charge Controller

  • Solar Cell +: Connected to Solar Panel "vcc".
  • Solar Cell -: Connected to Solar Panel "gnd".
  • Battery +, Battery -: Connected to the 9V Battery.
  • Load +, Load -: Not specified in the net list.

Voltage Regulator

  • GND: Connected to the 9V Battery "-".
  • IN: Connected to the 9V Battery "+".
  • OUT: Connected to Arduino UNO "Vin".

L293D Motor Driver

  • VCC: Not specified in the net list.
  • GND: Common ground with Arduino UNO.
  • A1, A2: Connected to the DC Motor pins.

SIM 800L V2.0 GSM Module

  • SIM_TXD: Connected to Arduino UNO "D0".
  • VDD: Connected to Speaker "+".
  • SIM.RXD: Connected to Arduino UNO "D1".
  • 5V/4V: Connected to Arduino UNO "5V".
  • GND: Common ground with Speaker, Water Level Sensors, and ISD1820.

ISD1820 Voice Module

  • VCC: Connected to SIM 800L V2.0 GSM 5V/4V.
  • GND: Common ground with SIM 800L V2.0 GSM.
  • P-E: Connected to Arduino UNO "D10".

DC Motor

  • pin 1, pin 2: Connected to L293D Motor Driver "A1", "A2".

Solar Panel

  • vcc: Connected to Solar Charge Controller "Solar Cell +".
  • gnd: Connected to Solar Charge Controller "Solar Cell -".

Speaker

  • +: Connected to SIM 800L V2.0 GSM "VDD".
  • -: Connected to SIM 800L V2.0 GSM "GND".

Documented Code

/*
 * Real-time Flood Warning System
 * This Arduino sketch monitors water levels using multiple sensors and sends
 * alerts via SMS using the SIM800L GSM module. It also triggers an audio
 * warning using the ISD1820 voice module.
 */

#include <SoftwareSerial.h>

// Pin definitions
const int waterSensor1Pin = 9;
const int waterSensor2Pin = 8;
const int waterSensor3Pin = 7;
const int gsmRxPin = 0;
const int gsmTxPin = 1;
const int isd1820Pin = 10;

// Thresholds
const int floodLevelThreshold = 500; // Example threshold value

// GSM module
SoftwareSerial gsmSerial(gsmRxPin, gsmTxPin);

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

  // Initialize pins
  pinMode(waterSensor1Pin, INPUT);
  pinMode(waterSensor2Pin, INPUT);
  pinMode(waterSensor3Pin, INPUT);
  pinMode(isd1820Pin, OUTPUT);

  // Initial state
  digitalWrite(isd1820Pin, LOW);
}

void loop() {
  // Read water level sensors
  int waterLevel1 = analogRead(waterSensor1Pin);
  int waterLevel2 = analogRead(waterSensor2Pin);
  int waterLevel3 = analogRead(waterSensor3Pin);

  // Check if any sensor exceeds the flood level threshold
  if (waterLevel1 > floodLevelThreshold || waterLevel2 > floodLevelThreshold ||
      waterLevel3 > floodLevelThreshold) {
    sendFloodAlert();
    triggerAudioWarning();
  }

  // Delay before next reading
  delay(1000);
}

void sendFloodAlert() {
  // Send SMS alert
  gsmSerial.println("AT+CMGF=1"); // Set SMS mode to text
  delay(100);
  gsmSerial.println("AT+CMGS=\"+1234567890\""); // Replace with actual number
  delay(100);
  gsmSerial.print("Flood warning: Water level is high!");
  delay(100);
  gsmSerial.write(26); // ASCII code for Ctrl+Z to send SMS
  delay(1000);
}

void triggerAudioWarning() {
  // Trigger ISD1820 audio warning
  digitalWrite(isd1820Pin, HIGH);
  delay(5000); // Play for 5 seconds
  digitalWrite(isd1820Pin, LOW);
}

This code is designed to run on the Arduino UNO microcontroller. It initializes the communication with the GSM module and sets up the pins for the water level sensors and the ISD1820 voice module. The loop function continuously checks the water levels and, if any sensor detects a level above the threshold, it sends an SMS alert and triggers an audio warning.