Waterflow Monitor
Remote display of domestic water meter with consumption analysis for quick leak diagnosis. ESP32-OLED, WiFi, Web server, IFTTT.
Worse than a leaking faucet, a water supply pipe that splits underground downstream of the meter at the entrance to your property can cause a very unpleasant surprise the next time your supplier reads the meter!
There are pulse emitters on the market that clip onto the meters and generate a pulse to ground (common collector) on a two-wire connection each time the litre figure passes a Hall effect sensor. A lithium battery supplies the transmitter for an estimated 15 years. There are also wireless versions of these transmitters, but the radio protocol used is not published.
This project consists of connecting such a wired transmitter to a box installed in the owner's home in a dry place. The system, based on an ESP32 with OLED display, counts the pulses, thus measuring the water consumption, displaying data on three sliding pages and analyzing the flow. The presence of a continuous flow without interruption of at least two hours over twenty-four hours, or a consumption of more than eight hundred litres in one day, are indications of a probable leak. The owner is then notified to carry out a more thorough verification of his installation.
The system is connected to the Internet by WiFi, with a time setting by SNTP, and a web server allows to enter the system reference values (iinitial value and last supplier meter reading) and to visualize in real time from anywhere in the world the status of its consumption on a computer or a smartphone. In the event of a leak, an SMS alert generated using the IFTTT service is sent to the owner.
A 3D printed specifically designed box also houses a lithium-ion battery that can power the system for approximately 36 hours in the event of a power failure. The essential data is also saved in EEPROM every hour.
There are pulse emitters on the market that clip onto the meters and generate a pulse to ground (common collector) on a two-wire connection each time the litre figure passes a Hall effect sensor. A lithium battery supplies the transmitter for an estimated 15 years. There are also wireless versions of these transmitters, but the radio protocol used is not published.
This project consists of connecting such a wired transmitter to a box installed in the owner's home in a dry place. The system, based on an ESP32 with OLED display, counts the pulses, thus measuring the water consumption, displaying data on three sliding pages and analyzing the flow. The presence of a continuous flow without interruption of at least two hours over twenty-four hours, or a consumption of more than eight hundred litres in one day, are indications of a probable leak. The owner is then notified to carry out a more thorough verification of his installation.
The system is connected to the Internet by WiFi, with a time setting by SNTP, and a web server allows to enter the system reference values (iinitial value and last supplier meter reading) and to visualize in real time from anywhere in the world the status of its consumption on a computer or a smartphone. In the event of a leak, an SMS alert generated using the IFTTT service is sent to the owner.
A 3D printed specifically designed box also houses a lithium-ion battery that can power the system for approximately 36 hours in the event of a power failure. The essential data is also saved in EEPROM every hour.
Updates from the author
Gixy31 5 years ago
Pascal Mr Thiercelin 5 years ago
Gixy31 6 years ago
As seen on the principle diagram, the hardware part is pretty simple. A pulse emitter is clipsed on the water meter (Izar Pulse H from DIEHL Metering). The two wires coming from the pulse emitter (open collector and ground) are connected respectively to the GPIO 25 pin of the ESP32 and to the GND pin. A little filtering is achieved with a 1uF capacitor and a 2.2k resistor.
The li-Ion battery is charged through a dedicated ready to use circuit and provide at least 36 hours of autonomy.
The software
The software has been developped with the Arduino IDE, thanks to a handfull piece of libraries:
- WiFi, ESPmDNS, WiFiUdp and ArduinoOTA for network access and Over The Air firmware update
- TimeLib for time management (with NTP)
- ESP32WebServer and WiFiClient for the webserver interface
- Wire, SSD1306 and OLEDDisplayUi for the display management
and of course all the power of the ESP32 Arduino Core functions.
Pulses coming from the pulse emitter are counted by an ISR (Interrupt Service Routine). The main loop manages the display (three sliding pages), handle the web clients and analyses the water consumption.
Three pages are sliding every 5 seconds on the OLED display :
- page 1 displays the date, water consumption since 00-AM and if there is or not a leak;
- page 2 gives the current value of the meter, the last value read by the water distribution compay and the consumption since then;
- page 3 gives the status of the WiFi connection.
Time of day is displayed in the upper right corner of each page, taking into accound DST (still for one year, who knows?)
The webserver manages also three pages:
- the first page displays the same data as those displayed on the integrated screen, plus a table of the consumption on an hourly basis for the last 24 hours;
- the second page is used to enter the actual value of the watermeter and the value when read by the water company. Accessing this page is protected by ID and password;
- the third page is an "About" page with a short description of the system, along with the firmware version.
The waterleakage diagnostic is computed following two methods:
- if there is not a 2 hours period since 24 hours without any consumption, meaning that there is a continuous waterflow for 24 hours. This detects in particular small leaks.
- if more than 800 liters have been consummed since 24 hours. This value is well above the mean value of the daily consumption for a standard family home. This will alert very early if a big leak occurs.
In case of leak alert, a message is displayed on the first page of the display as well as on the website. To warn the proprietary as soon as possible, an SMS is also sent to him, thanks to the free IFTTT service (webhooks + SMS services).
HaSch 5 years ago
Now, I have absolutely no plan how to make a IFTTT applet to receive SMS and in Elektor Magazine it is described rather superficially. I opened an IFTTT account but I'm unable to create the needed applet. Can you make a HowTo for me and others to get it work?
Best regards,
Hans
NWC 5 years ago
HaSch 5 years ago
What's going wrong. Please help! But maker.ifttt.com is giving back an error 404: The requested page or file does not exist.
JohnDoe 5 years ago
The free SMS service is no more provided by IFTTT. Instead they propose notifications, which implies to install the IFTTT app on your phone.
To create an applet :
- under your account menu on the top right, chose 'create'
- click on '+ This' then chose Webhooks
- Click on the 'Receive a web request' box, then give your event a name, 'My_Event' for example, and click on 'Create trigger'
- Click on '+That' and chose Notifications, chose then ordinary or rich notification
- Define your own message. You can add 'ingredients' which can be value1, value2, value3 and OccurredAt (more on that below)
- Click on 'Create action'
Then, again under your account menu, chose 'My Services' > Webhooks > Documentation : you will get what to send to maker.ifttt.com in order to fire My_Event, with values passed as parameters, and more important, with your unique key. Note that value1, value2 and value3 are keywords and can't be modified.
You can see the message sent in the .ino file.
Hope this will help you.
Gixy31
HaSch 5 years ago
thank you for the information and the detailed HowTo. Is it necessary to modify the Arduino sketch or will it work with the same code you provided?
Best regards
Hans
JohnDoe 5 years ago
HaSch 5 years ago
Hans
HaSch 5 years ago
Update:
OK, I found the solution:
Into Arduino sketch I had to write the Hash of the password, not the password itself. The Hash can be calculated using a website like >https://www.md5hashgenerator.com>.
After flashing the modified sketch using serial connection the board can be flashed using OTA.
Great! The filled in password is correct.
Gixy31 4 years ago
I saw your message in the last issur of Elektor magazine. It seems that you have an Elster meter. For your information, pulses emitters exist for a lot of models of these meters :
Elster-PR6 for V200, V210, S150 and S220 meters
Elster-PR7 for H4000, H4200, S2000 and C4000 meters
Elster - Reed T-Probe for V100 and V110 models
https://www.compteur-energie.com/
Best regards,
HaSch 4 years ago
thank you for the link. Unfortunately I don't know which is the right pulse emitter for my ELSTER meter because I have the V150.
Best regards,
Denis LAFOURCADE 5 years ago