Skip to content

3.10. Smart Disaster Early Warning System

| Description | In this project, learners will build a Smart Disaster Early Warning System capable of monitoring environmental conditions that may indicate danger. The system uses a Water Level Sensor and Temperature Sensor to detect abnormal conditions. Information is displayed on an LCD screen, while LEDs and a Buzzer provide visual and audible alerts. This project demonstrates the principles used in flood monitoring, wildfire detection, and environmental hazard warning systems.| |------------------|----------------------------------------------------------------| | Use case |This project is connected to real-world uses such as: This project demonstrates how environmental conditions can be monitored continuously to provide early warnings. Similar systems are used for flood monitoring, wildfire detection, and industrial safety applications.|

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires LCD Display Resistor LED Buzzer Water Sensor Temperature Sensor

Building the circuit

Things Needed:

  • Arduino Uno
  • Water Level Sensor
  • LM35 Temperature Sensor
  • I2C LCD Display
  • Green LED
  • Red LED
  • Buzzer
  • 220Ω Resistors
  • Breadboard
  • Jumper Wires
  • Arduino USB Cable

Mounting the component on the breadboard and wiring the circuit

Step 1: Connect the Arduino 5V pin to the breadboard’s red (+) power rail.

Step 2: Connect the Arduino GND pin to the breadboard’s blue (−) ground rail.

Step 3: Place the LM35 Temperature Sensor, Green LED, Red LED, and Buzzer on the breadboard.

Step 4: Connect the I2C LCD Display’s VCC to the 5V power rail.

Step 5: Connect the I2C LCD Display’s GND to the ground rail.

Step 6: Connect the I2C LCD Display’s SDA to Arduino analog pin A4.

Step 7: Connect the I2C LCD Display’s SCL to Arduino analog pin A5.

Step 8: Connect the Water Level Sensor’s VCC (+) to the 5V power rail.

Step 9: Connect the Water Level Sensor’s GND (−) to the ground rail.

Step 10: Connect the Water Level Sensor’s Signal (S) pin to Arduino analog pin A0.

Step 11: With the flat side of the LM35 facing you, connect its left VCC pin to the 5V power rail.

Step 12: Connect the LM35’s middle VOUT pin to Arduino analog pin A1.

Step 13: Connect the LM35’s right GND pin to the ground rail.

Step 14: Connect the Green LED’s anode (long leg) to Arduino digital pin 6 through a 220 Ω resistor.

Step 15: Connect the Green LED’s cathode (short leg) to the ground rail.

Step 16: Connect the Red LED’s anode (long leg) to Arduino digital pin 7 through a 220 Ω resistor.

Step 17: Connect the Red LED’s cathode (short leg) to the ground rail.

Step 18: Connect the Buzzer’s positive (+) pin to Arduino digital pin 8.

Step 19: Connect the Buzzer’s negative (−) pin to the ground rail.

Step 20: Carefully check all connections to ensure the power, ground, sensors, LCD, LEDs, resistors, and buzzer are correctly connected before powering the Arduino.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.


#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Create LCD object
LiquidCrystal_I2C lcd(0x27,16,2);
// Sensor pins
int waterPin = A0;
int tempPin = A1;
// Output pins
int greenLED = 6;
int redLED = 7;
int buzzerPin = 8;
void setup() {
  // Initialize LCD
  lcd.init();
  lcd.backlight();
  // Configure output pins
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
}
void loop() {
  // Read water sensor
  int waterLevel = analogRead(waterPin);
  // Read temperature sensor
  int sensorValue = analogRead(tempPin);
  // Convert to voltage
  float voltage = sensorValue * (5.0 / 1023.0);
  // Convert voltage to Celsius
  float temperature = voltage * 100;
  // Display readings
  lcd.setCursor(0,0);
  lcd.print("W:");
  lcd.print(waterLevel);
  lcd.print(" T:");
  lcd.print(temperature,0);
  // Safe condition
  if(waterLevel < 600 && temperature < 40){
    digitalWrite(greenLED,HIGH);
    digitalWrite(redLED,LOW);
    digitalWrite(buzzerPin,LOW);
    lcd.setCursor(0,1);
    lcd.print("Status: SAFE ");
  }
  // Danger condition
  else{
    digitalWrite(greenLED,LOW);
    digitalWrite(redLED,HIGH);
    digitalWrite(buzzerPin,HIGH);
    lcd.setCursor(0,1);
    lcd.print("DANGER ALERT!");
  }
  delay(500);
}

Step 3: Save your code. See the Getting Started section

Step 4: Select the arduino board and port _See the Getting Started.

Step 5: Upload your code.

CONCLUSION

When the program is running, the Smart Disaster Early Warning System continuously monitors the water level and temperature. The LCD displays the current sensor readings, while the green LED indicates safe conditions. If the water level or temperature exceeds the predefined threshold, the red LED lights up, the buzzer sounds, and the LCD displays a danger alert, providing an immediate visual and audible warning of potential hazardous conditions.