Introduction
Water conservation is a critical global challenge. Traditional water meters require manual readings and do not provide real-time consumption data. A Smart Water Meter is an IoT-based system that automatically measures water usage and sends data to a cloud platform for monitoring and analysis.
This system helps reduce water wastage, supports fair billing, and promotes efficient water management.
Objective of the Project
- To measure real-time water consumption
- To monitor water usage remotely
- To reduce water wastage
- To enable smart billing and alerts
Working Principle
- Water flow sensor detects the amount of water flowing
- Microcontroller calculates water consumption
- Data is displayed locally and sent to cloud
- Alerts are generated for excessive usage or leakage
Components Required
- ESP32 / NodeMCU (ESP8266)
- Water Flow Sensor (YF-S201)
- LCD / OLED Display
- Buzzer
- Relay (optional – water cutoff)
- Power Supply
- IoT Platform (ThingSpeak / Blynk / Firebase)
Block Diagram
Water Flow Sensor
↓
ESP32 / NodeMCU
↓
LCD Display + Buzzer
↓
Wi-Fi
↓
Cloud Platform
Circuit Connections (ESP32 Example)
Water Flow Sensor
Red → 5V
Black → GND
Yellow→ GPIO27
Buzzer
+ → GPIO26
- → GND
Relay (Optional)
IN → GPIO25
VCC → 5V
GND → GND
IoT Arduino Code (Smart Water Meter)
#include <WiFi.h>
#include "ThingSpeak.h"
#define flowPin 27
#define buzzer 26
volatile int flowPulse = 0;
float flowRate;
float totalLiters = 0;
WiFiClient client;
const char* ssid = "Your_WiFi";
const char* password = "Your_Password";
unsigned long channelID = 123456;
const char* writeAPIKey = "YOUR_API_KEY";
void IRAM_ATTR pulseCounter() {
flowPulse++;
}
void setup() {
Serial.begin(9600);
pinMode(flowPin, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
attachInterrupt(digitalPinToInterrupt(flowPin), pulseCounter, RISING);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
ThingSpeak.begin(client);
}
void loop() {
flowPulse = 0;
delay(1000);
flowRate = (flowPulse / 7.5);
totalLiters += flowRate / 60;
Serial.print("Flow Rate (L/min): ");
Serial.println(flowRate);
Serial.print("Total Water Used (L): ");
Serial.println(totalLiters);
if (flowRate > 20) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);
}
ThingSpeak.setField(1, flowRate);
ThingSpeak.setField(2, totalLiters);
ThingSpeak.writeFields(channelID, writeAPIKey);
delay(15000);
}
Code Explanation
- Flow sensor pulses represent water flow
- ESP32 calculates flow rate and total usage
- Data is sent to IoT cloud
- Buzzer alerts for excessive usage
Advantages
- Accurate water consumption tracking
- Eliminates manual meter reading
- Early detection of leaks
- Supports water conservation
Applications
- Residential water monitoring
- Smart cities
- Industrial water management
- Agricultural irrigation systems
Future Enhancements
- Mobile app for water usage insights
- Automatic water cutoff on leakage
- AI-based water demand prediction
- Smart billing integration
Conclusion
The Smart Water Meter is an efficient and eco-friendly solution for modern water management. By integrating IoT technology, it enables real-time monitoring, accurate billing, and effective water conservation.
