Water Leak Detection using Arduino.

This project allows you to connect at least 4 “leak ropes” to an Arduino and provide an audible alarm if water is detected on one of the ropes.

The circuit is a voltage divider with some protection. CMR electrical who supply the leak rope state you should use AC voltage not DC to prevent corrosion. I haven’t done that, so take note.

When you first power it up, you need to press the calibrate button - this will write the current analogue readings into Eeprom and will be remembered between reboots.

From that point, the code just compares the live reading to the baseline reading and and works out the percentage deviation from that value.  The rest of the code is the Enigmatheatre API mode code for Homeseer - you can either ignore or remove the code if you are not using HomeSeer - or adapt it to make it transmit data over UDP to your particular app.

Please note my version of the API is very much out of date, you will need to get the API generated by your installation and merge my code back into it - it wont work as is.  Hopefully it should be easy to distinguish my code from Greig’s.

The conductive wire on the leak rope is stainless steel, which means you can solder it.  I used bootlace ferules to crimp wires which were then soldered.

The end of the rope has a 6 meg resistor added - this acts to provide a slight input bias downwards, so if it becomes disconnected we can detect that by a rise in the input value.

Homeseer thread in the Plugin Sub forum is HERE and the Youtube video about the project can be found HERE

The Leak rope Circuit

Essentially I’m creating a voltage divider between the two power rails and feeding that into the Arduino Analogue input.

The Leak / Water Detection Rope was bought from here. 10 meters cost £50 + carriage.  (Avoid their expensive standard £16 courier charge and request they pack it in a jiffy bag for about half the price)

The Enclosure came from Hobby Parts and Supplies.

Visual Micro - The Arduino IDE for Visual Studio can be found here

The display

The display is a very common HD44780 based 20x4 LCD display.  It uses a little i2c daughter board to simplify connectivity.  Search Ebay for “HD44780 20x4 i2c”. I got mine from flux workshop, but there are many suppliers.

I used the following i2c scanner in order to find the correct address of the device.

The Code

You can find the source code HERE.  

In the Enigmatheatre Plugin you need to create a new board in API mode, it will generate the skeleton API code with your IP address etc.  You then you need to merge in my code into the relevant sections.

The key thing is to comment out:

//#include <EEPROM.h>

Because I use an enhanced version of the library and it will fail to compile of they are both present.

There are 5 sections that need to be pasted in your own generated API template file which are clearly commented.

13/5/2019 - I’ve updated my code for the current v1.0.0.118 API Code, so in theory you just change the IP’s in the code - or at least it should easier to merge into your own API code now.