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.
/*
* 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.