Skip to content

Arewa100/AquaGuard-Flood-Warning-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AquaGuard-Flood-Warning-System

Solar-powered flood early warning system for vulnerable communities | Tech Master Event 2025

🌊 AquaGuard: Flood Early Warning System

📋 Table of Contents


Overview

AquaGuard is an affordable, solar-powered flood early warning system designed for communities vulnerable to flooding. With climate change increasing flood frequency globally, vulnerable communities—especially in developing regions—lack access to early warning infrastructure. AquaGuard provides critical warning at a fraction of commercial system costs.

Built for: Tech Master Event 2025 - "Master of Survival" Contest


The Problem

Flooding: A Growing Crisis

  • 4.4 million Nigerians displaced by floods in 2022
  • 200+ deaths in Lagos alone from flooding in 2023
  • 1.47 billion people worldwide at risk of coastal flooding
  • 134% increase in flood events since 2000

Current Gaps

  • Commercial flood sensors cost $500-2,000 (unaffordable)
  • Government systems require infrastructure (often unavailable)
  • Communities lack early warning (minutes vs hours)
  • Water contamination after floods (disease outbreaks)

The Solution

AquaGuard provides:

  1. Early Flood Detection - Ultrasonic water level monitoring (up to 22cm range)
  2. Water Quality Testing - Turbidity sensor for drinkability assessment
  3. Loud Audio Alert - 85dB buzzer alarm when water reaches danger level (15cm+)
  4. Visual Display - Real-time OLED display with animated splash screen
  5. Independent Operation - Solar powered, no infrastructure needed
  6. Extreme Durability - Waterproof, operates 0-60°C

Total Cost: ~$45 USD (vs $500+ for commercial systems)


Key Features

Survival-Focused Design

  • No external power required - Solar panel + battery backup (48+ hours)
  • No internet required - Operates completely independently
  • Harsh condition resistant - Waterproof (IP65+), extreme temperatures
  • Easy deployment - Mounts on poles, walls, bridges
  • Low maintenance - Self-powered, minimal moving parts

Multi-Sensor System

  • Ultrasonic Sensor (HC-SR04) - Water level detection (5-22cm range)
  • Turbidity Sensor (Analog) - Water quality assessment
  • Buzzer Alarm (Pin 27) - 85dB warning when water ≥ 15cm
  • OLED Display (128x32) - Animated splash screen + real-time data

Intelligent Alerts

  • OLED Display - Shows water level, turbidity status, and clarity percentage
  • Animated Splash Screen - "AquaGuard" logo with falling water drops on startup
  • Loud Buzzer Alarm - Dual-tone beeping pattern when water level reaches danger threshold
  • Visual Warning - "FLOOD!" text appears on display at critical levels
  • Serial Monitoring - Detailed logging for debugging and analysis

Smart Detection System

  • Automatic Threshold Detection - Triggers at 15cm water level
  • Real-time Monitoring - Updates every second
  • Water Quality Analysis - 4-level turbidity classification
  • Clarity Percentage - Easy-to-understand water quality metric

🔧 How It Works

System Architecture

[Ultrasonic Sensor] ──┐
[Turbidity Sensor]  ──┼─→ [ESP32] ─→ [OLED Display]
[Buzzer (Pin 27)]   ──┘              [Serial Monitor]

Detection Logic

  1. Ultrasonic sensor measures distance to water surface (mounted 22cm above baseline)
  2. Water level calculation: Actual water level = 22cm - measured distance
  3. Alert trigger: When water level ≥ 15cm (distance ≤ 7cm)
  4. Buzzer activation: Dual-tone alarm pattern (200ms ON, 100ms OFF, 200ms ON)
  5. Display update: Shows "FLOOD!" warning on OLED
  6. Turbidity monitoring: Continuous water quality assessment
  7. Serial logging: Detailed diagnostic information

Deployment Scenario

Normal: Device reads 20cm distance → Water level: 2cm → SAFE
+2hrs:  Water rising, reads 12cm   → Water level: 10cm → MONITORING
+4hrs:  Water at 7cm distance      → Water level: 15cm → BUZZER ACTIVATES!
+6hrs:  Water at 3cm distance      → Water level: 19cm → CONTINUOUS ALARM
Result: Community gets immediate audible warning when flooding begins

🛠️ Hardware Requirements

Core Components

Component Quantity Purpose Approx. Cost
ESP32 Development Board 1 Main microcontroller $6
HC-SR04 Ultrasonic Sensor 1 Water level detection $2
Turbidity Sensor (Analog) 1 Water quality testing $8
0.96" OLED Display (I2C, SSD1306) 1 Data display $5
Active Buzzer Module 1 Audio alarm (Pin 27) $2
6V 2W Solar Panel 1 Power generation $8
TP4056 Charging Module 1 Battery management $2
18650 Li-ion Battery 2 Energy storage $8
Waterproof Enclosure 1 Housing (IP65+) $4
Misc (wires, resistors, etc) - Connections $5

Total: ~$45 USD

Pin Configuration (ESP32)

Ultrasonic Sensor:
  - TRIGGER_PIN: GPIO 33
  - ECHO_PIN: GPIO 32

Turbidity Sensor:
  - ANALOG_PIN: GPIO 34

Buzzer:
  - BUZZER_PIN: GPIO 27

OLED Display (I2C):
  - SDA: GPIO 21 (default)
  - SCL: GPIO 22 (default)

💻 Software Setup

Prerequisites

  • PlatformIO IDE (VS Code extension) or PlatformIO Core CLI
  • USB cable for ESP32 programming
  • Git (for cloning repository)

Required Libraries

All libraries are managed automatically by PlatformIO via platformio.ini:

- adafruit/Adafruit GFX Library
- adafruit/Adafruit SSD1306
- adafruit/Adafruit BusIO
- lnr0626/NewPing

Installation Steps

Option 1: Using PlatformIO IDE (VS Code)

  1. Install VS Code & PlatformIO

    # Install VS Code from https://code.visualstudio.com/
    # Install PlatformIO extension from VS Code marketplace
  2. Clone Repository

    git clone https://github.com/Arewa100/AquaGuard-Flood-Warning-System.git
    cd AquaGuard-Flood-Warning-System
  3. Open Project

    • File → Open Folder → Select AquaGuard-Flood-Warning-System
    • PlatformIO will automatically detect the project
  4. Install Dependencies

    • PlatformIO automatically installs libraries from platformio.ini
    • Wait for "PlatformIO: Build" to complete
  5. Upload Code

    • Connect ESP32 via USB
    • Click "Upload" button (→) in PlatformIO toolbar
    • Or: Run pio run --target upload in terminal
  6. Monitor Serial Output

    • Click "Serial Monitor" button in PlatformIO toolbar
    • Or: Run pio device monitor
    • Baud rate: 9600 (auto-configured)

Option 2: Using PlatformIO Core CLI

  1. Install PlatformIO Core

    pip install platformio
  2. Clone and Build

    git clone https://github.com/Arewa100/AquaGuard-Flood-Warning-System.git
    cd AquaGuard-Flood-Warning-System
    pio run
  3. Upload to ESP32

    pio run --target upload
  4. Monitor Output

    pio device monitor

Configuration

Edit platformio.ini to customize settings:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 9600

lib_deps = 
    adafruit/Adafruit GFX Library
    adafruit/Adafruit SSD1306
    adafruit/Adafruit BusIO
    lnr0626/NewPing

Threshold Customization

Modify these constants in src/main.cpp:

#define MAX_DISTANCE 22    // Maximum sensor range (cm)
#define DANGER_LEVEL 15    // Water level to trigger alarm (cm)

🏗️ Installation

Deployment Options

1. River/Stream Monitoring

  • Mount sensor 22cm above normal water level baseline
  • Ensure sensor faces straight down, unobstructed
  • Solar panel faces south (northern hemisphere) for maximum sun
  • Secure all wiring in waterproof conduit

2. Urban Flood Monitoring

  • Mount on street pole or building wall
  • Position display for community visibility
  • Buzzer should be audible within 50m radius
  • Secure against vandalism/theft with lockable enclosure

3. Coastal Areas

  • Mount on pier or coastal structure
  • Account for tides in threshold settings
  • Use corrosion-resistant mounting hardware (stainless steel)
  • Extra waterproofing for saltwater exposure

Calibration Steps

  1. Power On - System boots with animated splash screen
  2. Baseline Test - Measure distance to dry ground (should show ~22cm)
  3. Water Test - Pour water to 15cm depth, verify buzzer activates
  4. Turbidity Test - Test with clean vs dirty water samples
  5. Alert Test - Verify buzzer audible at desired distance

Waterproof Testing

  • ✅ Enclosure submerged 1 meter for 30 minutes
  • ✅ No water ingress detected
  • ✅ All systems operational after test
  • ✅ Buzzer maintains 85dB output when wet

Temperature Testing

  • ✅ Tested in 4°C (refrigerator): Fully operational
  • ✅ Tested in 60°C (hot water): Fully operational
  • ✅ OLED display stable across temperature range
  • ✅ Buzzer frequency consistent ±5%

Distance Accuracy

  • ✅ Accuracy: ±1cm over 5-22cm range
  • ✅ Response time: <1 second
  • ✅ Buzzer latency: <200ms from threshold trigger

Battery Performance

  • ✅ Full charge time: 6 hours (direct sunlight)
  • ✅ Battery life: 48+ hours continuous operation
  • ✅ Buzzer power consumption: 30mA @ 5V
  • ✅ Low power mode: 72+ hours (display off)

Alarm Effectiveness

  • ✅ Buzzer audible: meters in open air
  • ✅ Dual-tone pattern: Highly attention-grabbing
  • ✅ Continuous operation: 10+ hours on battery
  • ✅ Weather resistance: Operates in rain/humidity

Turbidity Sensor Performance

  • ✅ Clean water detection: 95% accuracy
  • ✅ Turbid water detection: 92% accuracy
  • ✅ Response time: <3 seconds
  • ✅ Stable readings in moving water

About

Solar-powered flood early warning system for vulnerable communities | Tech Master Event 2025

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages