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.
| 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) |
| 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 |
Install these via Arduino IDE → Sketch → Include Library → Manage Libraries:
LiquidCrystal_I2Cby Frank de Brabander
Wire.h comes built-in with Arduino IDE.
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
| 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 |
Every sensor is different. Follow these steps:
- Open Serial Monitor at
9600 baud - Place sensor in water at different levels
- Note the RAW values printed
- 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;============================================
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
water_level_arduino/
├── water_level_monitor.ino ← Main Arduino sketch
└── README.md ← This file
| 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 |
Free to use and modify for personal and educational projects.