loading

Low Cost Water Flow Sensor and Ambient Display

Featured
Picture of 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
stace@cs.cmu.edu
http://staceyk.org

Eric Paulos
eric@paulos.net
http://www.paulos.net/

Living Environments Lab
http://www.living-environments.net

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!
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather Materials

Picture of Gather Materials
You will need:

- Breadboard
- Microcontroller (I used an Arduino)
- Mastic
- Piezo Transducer (http://www.radioshack.com/product/index.jsp?productId=2062402)
- 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

Picture of Build the Circuit
IMG_6044.JPG
IMG_6043.JPG
IMG_6043.JPG
Picture 30.png
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

Picture of 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

Picture of 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() {
Serial.begin(9600);
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!
Serial.println("TAP");
delay(100); // delay to ensure Serial port is not overloaded
}
}

Step 5: Create an Ambient Display

Picture of Create an Ambient Display
IMG_6052.JPG
IMG_6057.JPG
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

Picture of 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

Picture of Mount the Sensor and Display onto a Water Pipe
IMG_6061.JPG
IMG_6063.JPG
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

Picture of 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!
1-40 of 59Next »
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 dklabs.co.nr
staceyk (author)  Emperor Dane6 years ago
HOW do you know News??
hello

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?
Aapne banaya hai kya ye or kya ye high temperature par bhi work karta hai plz give me your mob. No. Or contact 08349990591
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!

-Dane
http://electronics.union.rpi.edu/
staceyk (author)  Emperor Dane6 years ago
oh wow, small world :) Thanks for your feedback!
so, where do i get a tshirt? :)
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 90008 months ago

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 HAL 90008 months ago

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

baezl5 years ago
 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? 

what is it that is not working?

stonebits1 year ago
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_2 years ago
It so happens that you forgot to label R1, R2, R3... with their respective values. Could you please look into it? Thanks.
998899002 years ago
The 8 pin IC is used in the showed pictures is not a Lm316! what is it?
dexvils3 years ago
mantap coyy....yeah U`re really good,,,I will try at my home, thanks for share..
albiemorkal3 years ago
hmmm..good
Sol5014 years ago
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!
222fbj4 years ago
fyi - see 'DIY Arduino Water Meter' at http://labs.teague.com/?p=722
Yong20105 years ago
Cool.
powerfool5 years ago
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...
Anyway,
great implementation! Well done!

Dimitris
 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.
jessejwk5 years ago
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.
askjerry5 years ago
This really needs to be entered ASAP...

http://www.refresheverything.com/
OhioUB5 years ago
Your invention was great, but I am not a tech guy.  Has anyone picked up on your idea to sell them?
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 fritzing.org for any plattform).
koendevoegt6 years ago
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...
pavan58596 years ago
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
Geek5066 years ago
Great inst. Thanks for sharing.
greaser6 years ago
Isn't this why beer was invented?
nolte9196 years ago
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.
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 (author)  nolte9196 years ago
Yes, you're absolutely right, the V- and V+ were mislabeled in the image. Thanks for the catch!
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.
conrad24686 years ago
if you have a counter sink.....drill a hole that the wire can go down and install the arduino under the sink
Sparkington6 years ago
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.
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.
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.
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_jr6 years ago
/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.
1-40 of 59Next »