Skip to content

Oliversenseii/Water-Level-Sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

💧 Advanced Water Level Monitoring System

This project monitors water levels using an analog water sensor connected to an Arduino. It displays real-time readings on a 16x2 I2C LCD, lights up color-coded LEDs, and triggers a buzzer alarm when the water reaches dangerous or overflow levels.


✨ Features

Feature Description
5 Water Levels Empty → Low → Medium → High → Danger → Overflow
LCD Display Live % reading, status label, bar graph, uptime counter
Color LEDs Green / Yellow / Orange / Red (cascading as level rises)
Flashing Red LED Rapid blink on OVERFLOW state
Escalating Buzzer Slow beep → double beep → rapid alarm
Auto-Silence Buzzer auto-mutes after 10 seconds (prevents annoyance)
Debounce Filter 3 consecutive reads required before state changes (no false alarms)
Electrolysis Guard Sensor powered only during reading (extends sensor life)
Serial Logging Timestamped table output in Serial Monitor (9600 baud)

🛒 Required Components

Component Qty
Arduino Uno / Nano / Mega 1
Analog Water Level Sensor 1
16x2 LCD with I2C module 1
Green LED 1
Yellow LED 1
Orange LED 1
Red LED 1
220Ω Resistors 4
Active Buzzer (5V) 1
Jumper Wires several
Breadboard 1

📦 Required Libraries

Install these via Arduino IDE → Sketch → Include Library → Manage Libraries:

  • LiquidCrystal_I2C by Frank de Brabander

Wire.h comes built-in with Arduino IDE.


🔌 Wiring Diagram

WATER SENSOR
  VCC  → D7  (controlled power pin)
  GND  → GND
  SIG  → A0

LEDs (each with 220Ω resistor in series)
  Green  (+) → 220Ω → D4
  Yellow (+) → 220Ω → D5
  Orange (+) → 220Ω → D6
  Red    (+) → 220Ω → D3
  All    (-) → GND

BUZZER
  (+) → D12
  (-) → GND

LCD (I2C)
  SDA → A4
  SCL → A5
  VCC → 5V
  GND → GND

📊 Water Level States

Level Raw Value LEDs ON Buzzer LCD
EMPTY < 50 None Silent EMPTY
LOW 50–250 🟢 Green Silent LOW
MEDIUM 250–450 🟢🟡 Green+Yellow Silent MEDIUM
HIGH 450–650 🟢🟡🟠 +Orange Slow beep HIGH
DANGER 650–800 🟡🟠🔴 +Red Double beep DANGER!
OVERFLOW > 800 🔴 Red BLINK Rapid alarm ** OVERFLOW

⚙️ Calibration

Every sensor is different. Follow these steps:

  1. Open Serial Monitor at 9600 baud
  2. Place sensor in water at different levels
  3. Note the RAW values printed
  4. Update these lines in the code:
const int THRESH_EMPTY    = 50;
const int THRESH_LOW      = 250;
const int THRESH_MEDIUM   = 450;
const int THRESH_HIGH     = 650;
const int THRESH_DANGER   = 800;

🖥️ Serial Monitor Output

============================================
  ADVANCED WATER LEVEL MONITOR v2.0
============================================
TIME(ms) | RAW  | PCT | STATE
---------|------|-----|------------------
     800 |   45 |  0% | EMPTY
    1600 |  312 | 35% | MEDIUM
    2400 |  780 | 90% | DANGER!
    3200 | 1010 |100% | ** OVERFLOW

📁 File Structure

water_level_arduino/
├── water_level_monitor.ino   ← Main Arduino sketch
└── README.md                 ← This file

🔧 Troubleshooting

Problem Solution
LCD shows nothing Check I2C address (try 0x3F instead of 0x27)
Sensor always reads 0 Check D7 wiring (sensor power pin)
Readings are unstable Increase DEBOUNCE_COUNT from 3 to 5
Buzzer won't stop Check BUZZER_SILENCE_MS setting (default 10000ms)
All LEDs stay ON Double-check resistor connections

📝 License

Free to use and modify for personal and educational projects.

About

Water level monitoring system using Arduino with LCD display, LEDs, and buzzer alarm

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages