Skip to content

AlgorithmEncrypted/Smart-Water-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Smart Water Management System

An Arduino-based automated water management system designed for reliable, real-time water level monitoring and pump control with zero manual intervention.

Overview

A 4-case hysteresis-driven water management system that monitors tank levels using multiple sensors and automatically controls a solenoid valve to prevent overflow, dry running, and water wastage.

Hardware

  • Arduino Nan0
  • 3x Water Level Sensors (D11, D12, D5)
  • NC (Normally Closed) Solenoid Valve
  • Relay Module (Active LOW)
  • SSD1306 0.96" OLED Display (Works Even Without Display)
  • 4x Status LEDs (White, Green, Blue, Red)

Pin Configuration

Pin Component
D2 Relay (Active LOW)
D5 Top Sensor (Overflow)
D6 White LED
D7 Red LED
D8 Blue LED
D9 Green LED
D11 Bottom Sensor (Pump Trigger)
D12 Mid Sensor (Tank Full)

Features

  • 4-Case Hysteresis Logic — smooth state transitions with independent touch and release delays prevent false triggers and relay chatter
  • Double Sensor Protection — dual confirmation system requires continuous sensor contact before any action, eliminating noise-based false switching
  • Zero Water Overflow — NC solenoid ensures pump is off by default; water cannot overflow even on power failure
  • Zero Dry Run — pump only activates when water source is confirmed present
  • 100% Uptime Logic — non-blocking millis() based code, no delay() in main loop, system never freezes
  • Real-time OLED Display — display synced to relay state, not sensor state, showing true system status
  • LED Status Indicators — each LED directly synced to its sensor for instant fault diagnosis
  • System Halt Protection — overflow triggers a hardware halt requiring physical reset, preventing repeated overflow cycles
  • Transition Indicators — dual LED transitions during state changes for clear visual feedback

Cases

Case Condition Action LED
1 Tank Empty Pump OFF White
2 Water Source Detected Pump ON, Filling Green
3 Tank Full Pump OFF Blue
4 Overflow System HALT, Reset Required Red

State Transition Logic

[Case 1] --5s D11 touch--> [Case 2] --5s D12 touch--> [Case 3] --2s D5 touch--> [Case 4 HALT] [Case 1] <--5s D11 release-- [Case 2] <--5s D12 release-- [Case 3]

How It Works

Each sensor has independent confirmation delays on both touch and release, implementing true hysteresis:

  • Touch delay — sensor must be continuously wet for the full delay before state changes
  • Release delay — sensor must be continuously dry for the full delay before reverting
  • If contact breaks before delay completes, timer resets from zero

The relay and display only update after the delay is satisfied, while LEDs respond instantly for real-time fault diagnosis. The NC solenoid guarantees safe state on power loss — pump is always OFF by default.

Libraries Required

  • Wire.h
  • Adafruit_GFX.h
  • Adafruit_SSD1306.h

Installation

  1. Clone the repository
  2. Install required libraries via Arduino Library Manager
  3. Upload smart_water_management.ino to your Arduino Uno
  4. Wire components as per pin configuration table
  5. Power up — system initializes with splash screen and enters Case 1

License

MIT License

About

Arduino-based 4-case hysteresis water management system with NC solenoid control, real-time OLED display, and automatic overflow protection.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages