5088

Discover the updated Arduino IoT water leak detector: smarter, more efficient, with advanced monitoring and alert systems for the modern smart home.

Following the Elektor article presenting the water leak detector developed by Denis Fourcade in 2018
(Water Flow Monitor), I decided to take up his project, with his friendly agreement, thank you, Denis, but by modifying it quite deeply so that it can be integrated into my existing hardware and above all by using the latest possibilities of the Arduino IoT presented in the special issue dedicated to the Arduino (Dec/ Jan 2023). Here are the main features of this development
  • Use of the ESP32 processor and in particular the Heltec WiFi kit 32 development board which integrates, among other things, an Oled screen and a battery charger.
  • Direct connection (via an optocoupler to eliminate any interference) of a reed sensor integrated into my water meter and located approximately 40m against the wall of my property.
  • The system measures, by interruption, the flow in liters of my meter (my sensor sends 2 pulses per liter – configurable in the software 1-2-4-8-… pulses per liter).
  • The measurements are stored in 24 time slots (see copy of the screen). We can thus check water consumption even during unusual time slots: for example my water softener cleans the resin at 2:15 a.m. every 15 days.
  • A graph evolves in real time to indicate daily water consumption;  you can view up to 3 months of consumption which is stored in the Arduino cloud. In addition, you can easily download an Excel .cvs file for data processing.
  • On December 31 at midnight of each year, the value of the counter index is memorized (it can also be modified manually). We can thus easily calculate the annual consumption (value of the index at a time t - value of the index on January 1).
  • Every day at midnight the value of the counter index is memorized. This makes it possible to measure daily consumption (index value at time t – index value at midnight).
  • Every hour we store the consumption in liters in a table.
  • And every 15 minutes we calculate the sum of consumption over 24 hours, if this exceeds the set alarm threshold (750l/day in the photos), we signal this by triggering an audible alarm, by lighting a virtual indicator light on the Arduino Dashboard, by sending an email or a push message (possible since 11/30/2023) via the Arduino IoT. Something to be warned about for sure!
  • In the same way we look to see if there are 2 successive time slots where there is no consumption (this is often the case at night) because this would mean that there is a water leak. And if this condition is not respected, as seen previously, alerts are sent.
  • The only operation to be carried out is to enter the value of the water meter index. Between the measurement which is made via the reed relay and the actual information from the measuring rollers, the gap is very small. I readjust it about every 2 months.
Connecting to Arduino IoT I will detail in more detail in another article the integration of the Arduino IoT into an ESP32 or ESP8266 system. I did it on 6 different devices, and the application on my mobile is great! The values are very readable, and the graph is very useful! I optimized the connection reliability
  • If Wi-Fi stops, the system detects this and attempts to reconnect.
  • If the connection to the Arduino IoT is lost (which happens from time to time), the system detects this and after several reconnection attempts, reboots the CPU.
I also managed the local time as follows
  • When the system is connected to the Arduino IoT, I retrieve the UTC time sent to me by the Cloud.
  • As I need the local time which must also accommodate summer/winter time changes, I update the local time of the ESP32 taking these parameters into account.
  • The time is regularly updated via the Arduino IoT.

As I use an OLED screen, I also integrated a “screen saver” routine, and the screen turns off automatically after 5 minutes and turns back on in the event of an alarm or if a key connected to the screen is pressed. 'ESP32. Hardware I reused the same hardware as for certain other projects (ESP32 thermostat, VMC regulator, fuel measurement, Linky analyzer and load shedding, NTP server) which you can see on my Elektor Labs page https://www.elektormagazine.com/labs/13670/ybourdon/projects .

I fixed my device near my patch bay which is backed up by a UPS, but you can also connect a small lithium battery (connector provided under the Heltec module) which will recharge automatically and maintain power for around 20 minutes.

The main data being saved, without electrical backup, we lose the consumption of the last hour only.

In order to make counting by interruption more reliable, I preferred to use an optocoupler, not for its ability to isolate galvanic, but to consume approximately 20mA under 5V, with each water counting pulse. This acts like a good filter. No need to add a cap ! Conclusion I have been using this system for several months now.

Before using the Arduino IoT, I had developed a Web server integrated into the ESP32 and I am attaching a screenshot to see the result on a browser.

I didn't want to open my router ports to access my interface from outside the house.

Thanks to the use of Arduino IoT I can now access most of my home automation devices without security concerns!