Measuring home water consumption with Raspberry Pi #piday #raspberrypi @Raspberry_Pi


Cuddleburrito posted a great project to help monitor water consumption in drought stricken California. Found via hackaday.

Living in California during the mega drought is like watching the car in front of you throw their trash out the window everyday, forever. It’s infuriating to watch other people’s destructive behavior, but there’s very little you can do about it. Throughout the Bay Area there are reminders to, “conserve water” on highway signs, business windows, and on the radio. This has led us to be hyper-vigilant of each others’ behavior because we’re constantly reminded how to act. However, without knowing how much water we’re consuming ( in a more useful format than the monthly water bill ), it’ll be very difficult to change our own behaviors or convince others they need to change. In other words we need more data. As Californians, we need to be mega nerds to get us through this mega drought.

I’ve always assumed it would be expensive to itemize water consumption in a house. Each water source would need a water flow rate sensor to get a measurement, which would add complexity and require plumping in most cases. However, a few days ago I suddenly had the realization that most of the time, I turn the water on full blast. All my sinks and showers have a single pull-style knob for on/off. The design makes it difficult to turn the water on minimally, so everyone opens it all the way. Therefore, I’ve made the assumption that all my sinks and faucets have a constant flow rate. All that’s needed is to measure the flow rate once, figure out how long the faucet is open for, and multiply the two numbers together.

System Overview

For this project the electronics and software were more interesting to me than the mechanical components. The least amount of work possible was done on the mechanical parts to get it all minimally working. The switches I used were arcade buttons because they’re inexpensive and I already had them.

Everything is based on a cloud database that the sensor data gets saved to. I use because I’m familiar with their API. They have documentation and example code for most platforms I’d use in the future too. It’s really convenient to be able to swap out devices and components without the hassle of porting the data. Moreover, it’s now trivial to visualize the data anywhere and on any device (e.g. the scatter plot below is made with d3.js ).

A Raspberry Pi runs Python scripts to mashup the technologies involved and get the system to work. The scripts sense button presses, listen for wireless data from the microcontrollers over XBee radios, calculate the water expended, and push the information to the Parse database. Instead of a Raspberry Pi for every room, a Propeller microcontroller is setup in the bathroom and wirelessly sends the data to the Raspberry Pi in the kitchen. This saves a bit of money and adds modularity. The layout I ended up with was largely governed by the poor performance of the XBee radios I’m experiencing. At this point my guess is that there’s too much wifi interference, but this short distance works for now. The plan was to only have a R.Pi in the kitchen until I find a better solution. In the meantime, I’ve unplugged the kitchen sink sensor until this project receives more investment money and I purchase a second Raspberry Pi.

Read more.


998Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Join 35,000+ makers on Adafruit’s Discord channels and be part of the community!

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more

CircuitPython – The easiest way to program microcontrollers –

Maker Business — Chip inventories rise as demand falls

Wearables — How to attach a battery to your next wearables project

Electronics — Check out this shorthand shortcut

Python for Microcontrollers — Python on Microcontrollers Newsletter: CircuitPython 8.0 RC 1 Out, Board Guides, and Much More! #CircuitPython #Python @ThePSF @micropython @Raspberry_Pi

Adafruit IoT Monthly — 2022 in Recap!

Microsoft MakeCode — MakeCode Thank You!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — JP’s Product Pick of the Week — 4pm Eastern TODAY! 1/31/23 @adafruit #adafruit #newproductpick

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at !

1 Comment

  1. Nifty.
    I was just wondering how you actually meaudre the time a fawcett is open. I might have missed that in your explanation.
    Do you have any data on how accurate this method is? I presume that in the end it must be not too far off from your utility bill.
    Though I measure my water too, just at onepoint, with a Hall sensor, I found that just common sense helps most in saving water. I managed to use one fourth of what i used a couple of years ago

Sorry, the comment form is closed at this time.