Low Cost Water Flow Sensor and Ambient Display

181,555

193

63

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!

Step 1: 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

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() {
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

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!

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest

    63 Discussions

    0
    None
    ralphshaw

    Question 9 months ago on Step 1

    Hello inventor
    Seen your water flow sensor, it's very good.
    Is it possible to use a similar device to know if there is water flowing in a closed pipe, say copper heating pipe at home or, bigger pipes in plant rooms etc.
    Also, it would be really great if it can be connected to a smart phone.
    Thanks for your time.
    Kind Regards,

    Ralph Shaw

    0
    None
    donfrench

    1 year ago

    What do you reckon is the smallest flow you can reliably detect? The application I have in mind is a leak detector for a vacation home, where a leak might be very small. A gallon a day can do an enormous amount of damage to a home if left unattended for nine months, for example. Any thoughts on this?

    0
    None
    mohits104

    2 years ago

    yeah its work !!

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

    Thx ,

    miroslav

    0
    None
    Emperor Dane

    9 years ago on Introduction

    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

    7 replies
    0
    None
    chnvravitejastaceyk

    Reply 6 years ago on Introduction

    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?

    0
    None
    jagdishparmchnvraviteja

    Reply 3 years ago

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

    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.

    0
    None
    HAL 9000

    3 years ago on Introduction

    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)

    1 reply
    0
    None
    HAL 9000HAL 9000

    Reply 3 years ago on Introduction

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

    0
    None
    baezl

    8 years ago on Step 4

     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? 

    1 reply
    0
    None
    stonebits

    5 years ago on Step 2

    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.

    0
    None
    taufique_

    5 years ago on Step 2

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

    0
    None
    99889900

    5 years ago on Introduction

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

    0
    None
    dexvils

    6 years ago on Introduction

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