Introduction: Water Meter + Arduino = Aquameterduino !

After a bad water damage (our cellar basically filled up whilst we were away for several days), I decided to monitor our water usage for anomalies. Enters Arduino...

The idea of this project is to use an arduino to count every drop of water that goes through the water company meter. Said arduino needs to be connected to my LAN so that I can query it on a regular basis, it also needs to be aware of (real) time so it can timestamp the water consumption.

For this project you will need:
- an arduino
- an ethernet shield + sd card (based on the W5100 chip)
- a proto shield
- a realtime clock (
- a shmitt trigger (e.g. 74C14N)
- a capacity (1 microF)
- some resitors (20kohm and about 100Kohm)
- a reed switch
- a reed switch-enabled water meter (Gioanola, about 75 euros

- a set of passive POE cables (


I asked a professional to mount a basic water meter right behind the Water Company one (which by law, I cannot touch). Said basic meter has a little magnet on one of its internal wheels and is shipped with a reed switch. So, in practice, everytime a liter goes through it, the switch is closed momentarily. Of course this switch needs to be de-bounced. This could be done by sotfware but we'll come back to that...

The arduino will serve basic http requests so that it can be queried over the LAN and will also log its activity onto a SD card. So this arduino will be a very busy one... at times. Hence the necessity for the reed switch signals to be conveyed through interrupts so that we never miss a signal. This basically rules out debouncing the switch through software as interrupts and timer do not cohabitate nicely.

Hardware debouncer it is, then !

Step 1: RC Debouncer

So, the reed switch bounces... We are going to transform the spikes produced by said switch into a nice square wave.

Extensive documentation can be found on the net on this topic (and I found this one particularly useful:

In a nutshell, R x C = the time during which you want to smooth out your signal. In my case, I chose 20ms which translates into 1 microF for the capacity and 20kohm for the R2 (well all I had available was 2x 10k), R1 needs to be 'bigger' than R2, 100k is good (33k+68k in my case).

A Schmitt trigger later and I have a clean square signal ready to trigger an arduino interrupt.

I tested the setup on a bread board (as you should !) before commiting it to a proper shield.

Step 2: Ethernet and SD Card

The ethernet connection is used to answer a handful of basic http requests. A log of all water meter activity is saved on the SD card.

Using an SD card and an ethernet connection together has proven challenging (both use an SPI connection) until I used the W5100 chip based ethernet shield with an integrated SD card.

Great tutorial there:

So that's out of the way.

Step 3: Real Time Clock, Interrupts.


My real time clocks is based on the DS1307 chip, extremely common. Add a coin cell and a (magic frequency) quartz. I liked the form factor of this RTC as it can be plugged directly onto the arduino pins, like a shield.


And interrupts just, well.., interrupt your program so that you can do something based on that event. Try to be quick (like increment a counter and return) so that if another interrupt shows up, you don't miss it.

Associate a callback method and a pin in your code. Every time a (raising) signals shows up on said pin, you get a callback...

Step 4: Putting It All Together

A little lego for grown ups... I stacked up my arduino, the ethernet shield, my custom shield and the realtime clock.

I added a couple of LEDs to my project and a (nice?) box. Given the location of my water meter, POE cables proved handy.

Step 5: Scripting / Code

Arduino code:

I started from the ladyada code (ethernet+sd card), added an interrupt. The ip address of the shield is the only thing to be configured and you can do it via a config file on the SD card. So this script can be installed as-is, no line needs modification.

RTC setup : I set the time of my RTC using the d1307_setTime script. Good enough for my purpose. Do it once and for all, that's the whole point of the RTC module and its coin battery.

Ip address: if config.txt exists on the SD card, its content will override the ip address.

Linux script:

I wrote a script which runs on a linux box and which crontab fires a few times a day. Pretty brute force as it downloads the whole content of the SD card and then 'explores' it. It sends me an email with a reassuring 'everything is OK' or an alarming 'too much water consumed today' !


> crontab -l
00 8,16,23 * * * /bin/bash $HOME/bin/ > $HOME/watermeter.log 2>&1

Step 6: Internet of Things

I though I would experiment the Internet of Things trend and upload my data to a server. I did so (to Pachube / Cosm) but did not find it added much to this project. I left the functionality in the script as it doesn't hurt and might come in handy someday...

In theory you can connect your arduino directly to it, simplifying the project somewhat and you can install triggers/alerts.

In practice the service is in its beta version and needs to become a lot more friendly. At this point it should be viewed as a repository only, which is only a good thing if the service is reliable over time... we'll see. For now, I decided to keep control over my data logging + processing and my alerts on this side of the cloud...


Voila !


3rdiii made it!(author)2016-11-27

How muc was the install?

skmbi made it!(author)2015-08-28

Hi! Try site to send info and get graph and alarm settings.

Im use it.

Look for example here

and radiation monitor

warlock40 made it!(author)2015-02-01

Would it be difficult to add a notification feature to either email or audible alarm. I had a leaking toilet dump hundreds of $$ of water into the drain and didn't notice the usage until the bill. I'd like to add some analytics to the resulting data to tell without looking daily when something goes wrong

nicoo made it!(author)2015-02-01

Hi warlock40, this is the point of This script retrieves the Aquameter log file and performs a bunch of actions based on the water consumption.
It does send an alarm email (which caught a couple of toilet leaks for me !).
Take care,

lvan+der+walt made it!(author)2012-12-26

Very nice project. Im am thinking of doing the exact same thing, in order to curb the ever rising cost of water, and possibly be able to detect water leaks. I have put together the following Fritzing sketch as I am not a electronics bofin at all. Would you be so kind as to check and let me know if this is correct.

lvan+der+walt made it!(author)2012-12-26

Sorry the image

Mchlpl made it!(author)2012-11-13

What you need now is an electrovalve, so that you can remotely cut off water in case of suspicious readouts :)

hankenstien made it!(author)2012-07-23

Another thing that this project made me think of, is if you have a pool that you put up the water company charges you water usage and sewage usage, they assume that the water is being processed in there sewer system, and in some states this can be more expensive then the water usage an the return delivery fee, setting one of these up, could save you alot, especially if you happen to have a pump with a reed switch. I really like your idea, even the case is nice good job all around my friend! Its just one of those that make you think.

nicoo made it!(author)2012-07-26

Thank you for your comment. This meter has proven handy to monitor my sprinkler system too... only to realize that most of our water usage goes into watering the lawn ! This will probably convince me to recycle rain water somehow.

Let me know what you end up building yourself.

Take care,

hankenstien made it!(author)2012-07-20

MAN, that looks like a disastrous, hope you didnt lose too much in the flooding, good invention though.
Good day

About This Instructable




More by nicoo:Hacked roomba + arduino snowballs into a Eurobot 2013 entry...Flashing bootloader into Arduino UNO R3Arduino Sprinkler System + Web control
Add instructable to: