A water meter lets you know how much water is being used at a given point of time. It helps nudge the user to be conscious of their water usage. For example, it can tell a person how much water they have used in the duration of one hand wash and can help them reduce unnecessary water consumption! Over the course of 1 year, it has the potential to save water in lakhs.
Prerequisites:
- Working knowledge of the Arduino IDE interface
- Basic understanding of Arduino UNO
For more information, check out our tutorials on Arduino UNO , or refer to their website 1 on how to begin. - Basic knowledge of soldering
Materials you will need
-
Flow sensor (you can purchase it here)
-
On board LCD screen
-
Perforated board
-
Wires
-
Battery cap and battery
-
Spacer bolt and nut
-
Male and female pins
Libraries to be installed
Build
Step 1 : Solder pins to the perforated board. Male pins to attach the arduino board and Female pins to attach the LCD screen.
Step 2 : Solder pins from the Arduino to the LCD screen and to the flow sensor
Flow sensor connections :
Data (yellow wire) → D2
Positive (red wire) → Vin
Negative/Ground (black wire) → GND
LCD connections
SDA → A4
SCL → A5
Vcc → 5V
GND → GND
Step 3: Fix an adapter plug to a battery through a switch and a battery cap
Step 4 : Package the setup to cover open connections
/* Prototype Name : Water Meter
Input Sensor : Water Flow Sensor
Output Device : LCD, Multicolor LED, Buzzer
Libraries Used : LiquidCrystalPCF584, FastLED
/
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x27); // change to 0X3F if necessary
byte sensorInterrupt = 0; // 0 = interrupt for digital pin 2
byte sensorPin = 2; //Digital Pin
// The hall-effect flow sensor outputs approximately 4.5 pulses per second per
// litre/minute of flow.
float calibrationFactor = 4.5;
volatile byte pulseCount;
float flowRate;
unsigned int flowMilliLitres;
unsigned long totalMilliLitres;
unsigned long oldTime;
void setup()
{
lcd.begin(16, 2);
// Initialize a serial connection for reporting values to the host
Serial.begin(115200);
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
pulseCount = 0;
flowRate = 0.0;
flowMilliLitres = 0;
totalMilliLitres = 0;
oldTime = 0;
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
lcd.setBacklight(255);
lcd.home(); lcd.clear();
lcd.print(“Hi:Water Meter”);
lcd.setCursor(0, 1);
lcd.print(“Conserve Water”);
delay(6000);
}
/*
Main program loop
/
void loop()
{
if ((millis() - oldTime) > 1000) // Only process counters once per second
{
detachInterrupt(sensorInterrupt);
flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
oldTime = millis();
flowMilliLitres = (flowRate / 60) * 1000;
// Add the millilitres passed in this second to the cumulative total
totalMilliLitres += flowMilliLitres;
unsigned int frac;
// Print the flow rate for this second in litres / minute
Serial.print(“Flow rate: “);
Serial.print(int(flowRate)); // Print the integer part of the variable
Serial.print(”.”); // Print the decimal point
// Determine the fractional part. The 10 multiplier gives us 1 decimal place.
frac = (flowRate - int(flowRate)) * 10;
Serial.print(frac, DEC) ; // Print the fractional part of the variable
Serial.print(“L/min”);
// Print the number of litres flowed in this second
Serial.print(" Current Liquid Flowing: “); // Output separator
// Print the cumulative total of litres flowed since starting
Serial.print(” Output Liquid Quantity: "); // Output separator
// Reset the pulse counter so we can start incrementing again
pulseCount = 0;
// Enable the interrupt again now that we’ve finished sending output
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
// LCD , LED and buzzer
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Curr.Use(mL):”);
lcd.print(flowMilliLitres);
lcd.setCursor(0, 1);
lcd.print(“Total(mL):”);
lcd.print(totalMilliLitres);
}
}
/
Insterrupt Service Routine
*/
void pulseCounter()
{
// Increment the pulse counter
pulseCount++;
}
What are the benefits?
Benefits for a Problem Solver:
Reduce time in manual calculation of flow rate - The LCD display shows current and total usage of water. Once the meter is connected to a tap, it shows the usage of water for the time the tap is on.
Ease of transportation due to portability, it can be used in schools, restaurants, hospitals and other such public and private spaces.
Can be used to solve water related problems in the community
Share the data with government as well as other citizens
Find ways to reduce water wastage in not only your home but your entire community
Track water consumption more regularly and take action when there are discrepancies
ALTERNATE: Calculate time it takes to fill a 1L bottle completely and convert to litres/minute.
The constraints with this method are listed below:
- Availability of materials like 1L bottle and timer
- Support of more than 1 person
- Takes about 10-15 minutes to first collect the data and then convert to litres/min