Introduction: Low Cost Water Flow Sensor and Ambient Display

Water is a precious resource. Millions of people do not have access to clean drinking water, and as many as 4000 children die from water contaminated illnesses every day. Yet, we continue to be wasteful with our resources. The overarching goal of this project is to motivate more sustainable water use behavior and raise awareness about global water issues.

This is an instructible on how to crudely detect water flow in a pipe and drive an ambient display. I am using a piezo transducer, some LED's and an arduino. The device is a rough prototype of what will eventually become a persuasive technology that motivates sustainable behavior and raises awareness about water use.

This is a project by Stacey Kuznetsov and Eric Paulos at the Living Environments Lab, at Carnegie Mellon University Human Computer Interaction Institute.

Produced by
Stacey Kuznetsov

Eric Paulos

Living Environments Lab

The video below illustrates a previous version of this project, where a microphone is used instead of a piezo element to detect water flow. You will achieve better performance when using a piezo transducer, so this instructible details the piezo approach.

Special thanks to Briam Lim, Bryan Pendleton, Chris Harrison and Stuart Anderson for help with ideas and design of this project!

Step 1: Gather Materials

You will need:

- Breadboard
- Microcontroller (I used an Arduino)
- Mastic
- Piezo Transducer (
- A few LED's (I used 2 yellow, 2 red, 2 green)
- Candle holder or similar-sized container
- Wire
- 1 Mohm (or other large value) resistor
- 4.7K Resistors (3)
- 1K Resistors (1)
- Low-value Resistors (for the LED's)
- Clipping Wires
- Jumper Wires
- Mastic
- op amp (LM613)

Step 2: Build the Circuit

The circuit consists of an amplifier to increase the signal from the piezo and a voltage divider to lift the base voltage.

There is a high-value resistor between the two inputs form the piezo, which acts as a pull-down resistor for the signal.

Step 3: Test the Circuit

Attach the piezo to the circuit, and hook up the arduino.

The voltage divider sets the base voltage at 2.5V, so the base readings for the signal should be around 512 on the Arduino analog pin (half way between 0 and 1023). Mine fluctuates +/-30 around 520. You may see some fluctuation around this number.

Step 4: Calibrate Your Sensor to Detect Vibrations

When the tap is turned on, the vibrations of the pipe will cause the piezo to generate a fluctuating current. Since the base reading tapers off around 520, you can compute an amplitude around this number to detect vibrations. My threshhold is set at 130, but you may increase or decrease this depending on the types of vibration you want to sense and sensitivity of your particular piezo piece.

To test the signal, use mastic to attach piezo to a flat surface. Try tapping or scratching on the surface at different locations and different intensities see what type of readings you get on the Arduino.

To reduce noise, I recommend computing a moving average of the input. This is a crude way of determining wave amplitude that avoids false positives due to random static current. More advanced methods such as FFT may also be used.

// Sample Code
int sensor = 2; // Analog in
int val =0; // Current reading for analog pin
int avg; // Running average of the wave amplitude
int MIDPOINT = 520; // Base reading

void setup() {
avg = MIDPOINT; // set average at midpoint

void loop() {
val = analogRead(sensor);

// Compute wave amplittue
if (val > MIDPOINT) {
val = val - MIDPOINT;
} else {
val = MIDPOINT - val;

// compute running average fr the amplitute
avg = (avg * 0.5) + (val * 0.5);

if (avg > 130) {
// vibration detected!
delay(100); // delay to ensure Serial port is not overloaded

Step 5: Create an Ambient Display

If your sensor is working properly, you can add an ambient display to show the information.

My LED's are paired such that each color is illuminated by two LED's. To do this, attach the 'in' (short) lead of each color together, and use a low-value resistor before connecting to the Arduino. Connect the ground (longer) lead of all LED's and attach to ground on the Arduino.

Once the LED's are connected, use the candle-holder to house the display. Since the candle holder is made of aluminum, you may want to put an insulator such as a piece of plastic, on the bottom of the container before inserting the LED's to prevent the circuit from shorting out.

Step 6: Use Sensor Data to Drive the Display

It takes me about 10 seconds to wash my hands. Thus, I have programmed the display to show a green light for the first 10 seconds after the tap is turned on. After 10 seconds, the yellow LED"s turn on. The display turns red if water remains on after 20 seconds, and begins flashing the red light if the tap remains running for 25 seconds or more.

Use can your imagination to create alternative displays!

Step 7: Mount the Sensor and Display Onto a Water Pipe

Use mastic or clay to attach the piezo to the tap, and another layer of mastic to secure the display on top.

You may have to readjust your threshold amplitude or 'MIDPOINT' from step 4. The signal may also be slightly affected by the temperature of the pipe.

Step 8: Future Suggestions

You may choose to drive the Arduino off a battery. An upcoming tutorial will show you how to run this display by drawing power directly from the running water itself, or by harnessing surrounding ambient light energy!


mohits104 made it!(author)2016-08-17

yeah its work !!

miroslavbesermenji made it!(author)2015-09-04

Is this applicable for detecting small and very small water flow? When water are leaking (drops and more)???

Thx ,


Emperor+Dane made it!(author)2008-12-14

wait, is this the same stacyk from News SH? awesome instructable., really well done. as an alternative to an electret mic, you could also use a headphone speaker as a microphone. i'm so going to put one of these in my apartment. and integrate usage over the course of the day, VU meter style Dane

staceyk made it!(author)2008-12-14

HOW do you know News??

chnvraviteja made it!(author)2012-09-12


It's nice to see this innovative project. actually in my project i want to include this one and i want make this flow sensor.....can u help me in making prototype of this and what would be the cost to make this prototype?

jagdishparm made it!(author)2015-07-09

Aapne banaya hai kya ye or kya ye high temperature par bhi work karta hai plz give me your mob. No. Or contact 08349990591

Emperor+Dane made it!(author)2008-12-14

Actually, a DJ at RPI GZ informed me of it like 3 years ago and i have a rather good memory of names and numbers. Kinda odd, but then again im an EE.
Regardless, awesome instructable!


staceyk made it!(author)2008-12-14

oh wow, small world :) Thanks for your feedback!

Emperor+Dane made it!(author)2009-06-13

so, where do i get a tshirt? :)

trike+road+poet made it!(author)2010-05-16

be aware that in an apartment, you will be detecting the vibration from your neighbors water use, as well as sampling some of the vibration of the in-wall heating systems, (some systems are so close together you may get a bleed-over effect, especially of the heating system is hot water and uses zone pumps.)  you might want to wrap your pipes where they come through the wall with a lead collar, or use mastic (RTV) to seal the pipe and the wall so that the house structure dampens these extraneous vibrations and gives you an accurate reading of just your usage.

HAL+9000 made it!(author)2014-11-17

I love the idea of having realtime feedback on one's water usage! One of the most important things that I've learned while in school has been that the best way to learn something (whether it's how to solve a calculus problem, programming syntax, etc.) is having immediate feedback and corrections for everything you do. it prevents you from continuously making mistakes. I think something like this implemented in every home could really reduce water/energy consumption, as opposed to seeing your water use in a monthly bill (which is hardly immediate at all)

HAL+9000 made it!(author)2014-11-17

of, like you said: "persuasive technology that motivates sustainable behavior"

baezl made it!(author)2009-12-12

 Hey I really liked your project so I wanted to try my own. I think I have all my parts write but its not working. Can you help me out? 

diy_bloke made it!(author)2014-06-13

what is it that is not working?

stonebits made it!(author)2013-10-19

Thanks for posting this -- it's exactly what I was looking for: doesn't require interacting with pluming, "reasonably" low cost, and I can even get the parts at Radio Shack.

taufique_ made it!(author)2012-12-26

It so happens that you forgot to label R1, R2, R3... with their respective values. Could you please look into it? Thanks.

99889900 made it!(author)2012-12-05

The 8 pin IC is used in the showed pictures is not a Lm316! what is it?

dexvils made it!(author)2012-06-08

mantap coyy....yeah U`re really good,,,I will try at my home, thanks for share..

albiemorkal made it!(author)2011-09-10


Sol501 made it!(author)2011-07-17

I think it's a little sad that you didn't put a watering pot or something under the faucet when demonstrating your little idea... but the idea itself is great - i think it's verry important to save as much water as possible!

222fbj made it!(author)2011-07-12

fyi - see 'DIY Arduino Water Meter' at

Yong2010 made it!(author)2010-06-07


powerfool made it!(author)2010-05-16

Well done!

I've been thinking for some time now to create something like that but I didn't know the way, I didn't think about piezo. I will try to make something that measures how much water passes the tap and displays that on a 2 digit display. I think to actually see the number of litres that are being wasted is more shocking. But I still haven't figured how to measure the quantity of water passing through...
great implementation! Well done!


thread_soul made it!(author)2010-05-17

 It is possible you could use the piezo/vibration method here.  I would guess there is a correlation between the vibration level with the water pressure / flowrate.  You could find out by opening the faucet a small amount, record the signal voltage level from piezo circuit then collect and measure the amount of water that came out in a defined amount of time.  Increase the opening of faucet and repeat.

After this you have data relating the vibration signal level to flow rate (volume/time).  If it is linear relationship, you can interpolate/extrapolate a function to create the readout.  If not linear, but is still structured and not random, you can quantize the vibration level depending on how accurate you want the flowrate readout.

could be an interesting way around the usual methods of flowrate sensing, which aren't typically very suitable for small-scale unobtrusive projects.

let us know if you do anything like this, it would be interesting to see the results, I myself would use something like that.

jessejwk made it!(author)2010-05-16

I like the idea a lot, but I don't have an arduino on hand, so it wouldn't be all that low-cost for me. So I was thinking: couldn't you have a wire on either side of where the water flows out of the faucet (so that when you turn on the water, it completes the circuit), connected to a 4017 decade counter IC (one of those things that counts to ten at a set rate and costs less than a dollar). Hook that up to some LEDs and you have a less advanced but functional version of this. Maybe there's some reason this wouldn't work, I'll have to try it, but it seems to fit my needs more.

askjerry made it!(author)2010-05-16

This really needs to be entered ASAP...

OhioUB made it!(author)2010-02-05

Your invention was great, but I am not a tech guy.  Has anyone picked up on your idea to sell them?

Stefan_Hermann made it!(author)2009-08-28

Very nice project. I like it a lot and hope, it will inspire more projects in this direction. Only one point to add. Instead of using fotos from the bread-boary, you can use sketches from Fritzing (you can get it for free on for any plattform).

koendevoegt made it!(author)2009-07-06

I don't seem to be able to find the code that actually steers the LEDs. Can you please provide the entire code. (Or point me to what I've overlooked) I'm an arduino n00b...

pavan5859 made it!(author)2009-06-10

nice way to detect water flow and now i want to use a temperature sensor also using arduino so that i can run the pump to get rapid hot water its a small project im doing in my coll and i m running out of time ........ can u plz suggest me with the sensor and the relay for the pump or anythng else

Geek506 made it!(author)2009-03-26

Great inst. Thanks for sharing.

greaser made it!(author)2009-03-25

Isn't this why beer was invented?

nolte919 made it!(author)2009-01-22

This is a really interesting idea. I was just looking for a flow sensor on Google and I can't seem to find one for less than around $100. It seems a shame to pay so much if all you need to know is if water is flowing or not rather than actual flow rates. I have a few questions at a matter of clarification. You list parts and you have a schematic but you don't say what parts go where. I'm curious in particular about the resister values, R1, R2, R3, R4, R5. And is Q1 the Piezo Transducer? I can think of a couple applications where this idea would be quite useful.

nolte919 made it!(author)2009-01-22

In one of the pictures in step 2 you do indicate resister values but that only leads me to further confusion. Did you mistakenly reverse the labels of v+ and v- on the opamp input? If those are labeled correctly then I am super confused.

Given that the labels of v+ and v- are reversed in that picture than these are the values:
R1 = 1M
R2 = 4.7k
R3 = 4.7k
R4 = 1k
R5 = 4.7k
Q1 = piezo transducer

Not to get nitpicky on you but you might change the schematic so there's a dot between R1, R4 and Q1. The way it is now it looks like the wires cross over each other but to not connect.

staceyk made it!(author)2009-01-28

Yes, you're absolutely right, the V- and V+ were mislabeled in the image. Thanks for the catch!

danretus6 made it!(author)2009-03-24

Hi staceyk, I like your project. I want to know which type of piezo transducer did you use. I went on radio shack website but I cannot find the piezo transducer.

conrad2468 made it!(author)2009-01-11

if you have a counter sink.....drill a hole that the wire can go down and install the arduino under the sink

Sparkington made it!(author)2009-01-09

Maybe you should rig a solenoid to incoming water supply to the tap so when the red light comes on. It automatically turns off the water so you don't have to. There for saving water for people ignore the warning red LED. Great project anyway.

watchurmouthyoungman made it!(author)2008-12-14

good idea but its not that good looking... :( make it where like the the color of the water actually changes! thats always cool.. where the LEDs like point toward the water and cooooolll stuff.

disgruntldtoad made it!(author)2008-12-15

That would actually be a pretty good idea, and probably rather easy to implement. How ever, I would think it would take some bright LED's to illuminate the water in the daytime, so maybe buying a much brighter multi color LED and just working with it instead of a few of them.

stalledaction made it!(author)2009-01-02

That and seal all the circuitry and LEDs in some sort of clear sealant like hotglue, epoxy, acrylic, etc. Or if you have a clear sink bowl have the leds diffused under it to illuminate the entire bowl. That'd be cool.

Simpson_jr made it!(author)2008-12-22

/serious mode off Can't you charge the water with a lot of volts when greedy users abuse the tap ? That will teach 'm ! ;-) /serious mode on Sorry, I couldn't resist it (don't try this at home...). I think it's a great idea for saving water on all kinds of locations... A friend of mine is high tech botanist on a low budget basis, with a few adaptations this could be exactly what he's looking for.

balam made it!(author)2008-12-18

very nice I am wondering about the liking in of water and shorting the circuit that could fry the arduino board. how do you make this water proof

thatmantheuser made it!(author)2008-12-19


airwelldriller made it!(author)2008-12-13

Some air wells built by Neolithic men are still producing. (Huge bang per buck!) In the last three years I have found references to air wells in France, England, Lithuania, Afghanistan, Persia, China, and the South Pacific. Air wells work by taking advantage of the fact that different materials and structures heat at different rates during the day and cool at different rates during the night. The Russell air well - patented in the 1920's - produces 25,000 gallons a year in a 30' x 30' concrete structure. The air well discussed in "Naturalist on the Thames" produced about 219,000 gallons per year, but the writer did not tell its dimensions. Evidence of working air wells is visible to all of us; dew spots on our windshields, frost on our roofs, the need to de-water utility tunnels and well pits that have no detectable leak, the musty smell in "dry" basements. The simplest air well is simply the 12' wide by 4' high pile of rocks that the Afghans use to water a newly planted tree. (What does a newly planted tree in the desert require? A couple of gallons a day?) Air wells are called air wells, dew ponds, ship ponds, mist ponds, cloud ponds, fog ponds, rock piles, gravel mulch... and in my opinion a cistern is probably an airwell, too. My study suggests that if the money put into 450 miles of Interstate highway were put into low-tech airwells (insert lots of if's, but's, and maybe's) it might produce 72% of Denver's current annual water requirements. Would you like to see an Instructable on a desktop (high-tech) model that I built that produced about a teaspoon of water between 0001 hours and 0500 hours... but the had water evaporated by 1000 hours?

niceday8888 made it!(author)2008-12-18

Thank you for explaining air wells, I learn something today. I love reading the comments there is so much to learn from others.

PyroMonger made it!(author)2008-12-16

you should add a buzzer to the circuit that buzzes once wen the light turns yellow and then has a continuous buzz if the light turns red to warn people to turn it off

omkar_hummer made it!(author)2008-12-15

you wasted much water while testing your device!!

teamcoltra made it!(author)2008-12-14

I understand the need to conserve water, although I live RIGHT ON TOP of an aquifer... Because when other states are in drout we ship our water to them (typically CA)... I wish this would focus more on our OWN need for water rather than people in another country. People are soo worried about people in other countries but in all honesty we are in some serious crises here that we need to take care of first. That being said: Very good Instructable, people keep putting the message before the well written "how to" article this is supposed to be.

Indigno made it!(author)2008-12-14

Since when do we ship our excess water to third world countries? It's not like the countries that don't have clean drinking water are down stream from us. The only thing that is saved by this device is one's own personal water bill.

About This Instructable




More by staceyk:Arduino PCR (thermal cycler) for under $85DIY Projects, Communities and CulturesAir quality balloons
Add instructable to: