An open source water meter that detects leaks and measures usage

Similar projects worth following
YDrip is an open-source water meter designed to detect costly water leaks and track your home water usage. The hardware design is flexible enough to easily repurpose it for measuring residential gas and electricity meters, as well as any signal that requires continuous reading while maintaining a long battery life. Existing commercial devices lock data your behind proprietary apps, may require professional installation, and can be expensive. YDrip aims to solve these issues and more.


What problem does it solve?

YDrip primarily addresses the issue of costly water leaks and provides real-time usage information to help homeowners identify ways to conserve water. It can also assist municipalities in reducing consumption when deployed at scale, as population growth and changing climates continue to put a demand on water reserves. For example, Arizona recently implemented restrictions on new home construction as they face challenges related to declining groundwater levels.

How do most people deal with leaks and monitor usage today?

Many municipalities still rely on manual reading of meters by human operators. This means homeowners are charged based on estimates from past bills and only discover the actual cost 1-2 months later. By that time, a water leak could have already caused significant financial losses.

The minority of municipalities that have installed smart meters often lack effective leak notification systems. Their websites can be difficult to use, and reporting delays of hours or days are common. Additionally, profit incentives often don't align with conservation efforts, which is why some municipalities have started to decouple the profit motive.

Beyond leak detection, it is challenging to experiment with habit changes to reduce consumption without near real-time data.

What are the problems with existing solutions?

Existing commercial devices have various limitations:

  • They often restrict access to your data through proprietary apps.
  • Some require internet connectivity, turning what should be an appliance into a device with an expiration date tied to the company's lifespan.
  • If data is accessible, it is often complex or incompatible with integration into other services.
  • Some devices necessitate professional installation and can be expensive.
  • While non-invasive solutions exist for reading water and electricity meters, there are few to none available for gas meter reading.

How does YDrip solve these limitations?

  • The YDrip firmware is open source meaning you are free to use your data how you like. Opt-in hosted solutions will be available for those that want a turnkey solution.
  • YDrip will always function without an internet connection on your local network.
  • ESPHome and Home Assistant compatibility will be supported at launch.
  • The next version of YDrip will support non-smart mechanical gas meters without using light to read the dial which can be inaccurate and hard to install.


YDrip shall:

  • 🗹 be open source
  • 🗹 be compatible with a wide range of water meters that have a rotating magnet mechanism
  • 🗹 function without an internet connection
  • 🗹 be wireless for remote monitoring of water usage and leak alerts
  • 🗹 allow users to customize settings such as leak detection sensitivity and data transmission frequency 
  • 🗹 be compatible with popular home automation platforms, such as Home Assistant
  • 🗹 be battery operated with a life span measured in months
  • 🗹 (in progress) low cost
  • 🗹 send leak a notification as soon as one is detected
  • ☐ be waterproof and withstand outdoor temperatures
  • ☐ include algorithms to detect abnormal water usage patterns that could indicate leaks or unusual consumption

Current System Design

Hardware Design Decisions

The main limitations on the hardware design are to create an affordable product that runs on batteries. Below is an explanation of why each IC was chosen:

ESP32-S3 from Espressif: The ESP32 line was chosen for it's compatibility with open source software, WiFi capability and low cost. Using WiFi as the wireless protocol removes the need for a hub, which adds cost and complexity. However, this makes meeting battery life and range requirements more difficult vs a standard like LoRa.

SLG46826 from Renesas: A low cost programmable digital logic chip used for deep sleep logic like rotation counting, interrupt generation and sensor duty cycling to reduce power.  Most of the logic...

Read more »

  • Passive Gas Meter Reading

    ydrip09/09/2023 at 21:08 0 comments

    One of the larger goals for this project is to build an ultra low power platform to measure a variety of sensors. The next logical step after water meters is measuring gas meters for a few reasons. There are no passive devices on the market that do this for 'dumb' mechanical meters as far as I know. Second, natural gas companies usually charge months after a home owners usage (similar to water), which can lead to surprise bills. However, gas meters work a bit differently than water meters, which presents new challenges.

    Source: Wikipedia

    Basic mechanical gas meters use a diaphragm that expands and contracts with the flow of gas. This in turn moves levers and gears to eventually turn a mechanical dial indicating the usage. There are no magnets in this design so I decided to measure the change in the earth's magnetic field caused by the moving metallic parts instead.

    In the previous two post I discussed how the earth's magnetic field was adding a variable DC offset depending on the orientation of the sensor. In this case, I'm using it to my advantage. I'll do a more detailed write up on how I modified the design to do this in the next post. For now, check out the video demo above.

  • Ultra Low Power Design with Mixed Signal Programmable Logic

    ydrip08/31/2023 at 01:19 0 comments

    The most interesting aspect of YDrip is likely its programmable logic. This is where a lot of the heavy lifting happens, including tasks such as leak detection and revolution counting. While it's possible to use a low-power microcontroller as an alternative, the drawback is that it would significantly increase power consumption. This isn't ideal for a product designed to remain operational over many months. Some microcontrollers, like Atmel and TI's MSP, come with customizable hardware blocks capable of performing basic functions like hardware-based counting. However, their capabilities are somewhat limited. This is why I ultimately decided to opt for a complete hardware solution.

    My initial approach was to use discrete logic chips until I found the GreenPAK product line from Renesas. Specifically, the SLG46826 model. It's reconfigurable, energy-efficient, and cost-effective ($1.60 for individual units). The package includes features such as analog comparators, counters, logic gates, oscillators, and more.

    Analog to Digital

    Starting from the left, the sine wave from the TMR sensor is fed into one input of the analog comparator. The other input is a reference voltage of 1600mV, which is the midpoint of the signal. Any voltage from 32mV to 2V can be selected in increments of 32mV. In earlier designs I used two comparators. One for each differential output of the TMR sensor and XOR'd them together. This provided no benefit so I removed the second one. Using a differential signal would help if the difference between them was amplified, but I was not doing that at this point. Here is an example of a differential signal:

    The red signal is the difference between the two signals above it and is twice as large. This improves the signal to noise ration and shows why differential outputs are used.

    Pulse Counting and Leak Detection

    The high/low output of the comparator splits into two paths. The top path measures the total water usage. It consists of two programmable 8 bit counters. When they overflow that triggers a third counter configured as a one shot counter to send a short wake-up pulse to the ESP32S3.

    The bottom path is the small leak detection logic. It low pass filters and counts the pulses. This filter is configurable via I2C. That value gets stored in two 8 bit counters and another one shot counter is used to send a leak interrupt signal.

    Wake-Sleep Controller

    A critical part of achieving a long battery life is duty cycling the magnetic sensor. It draws about 300uA. The wake-sleep controller can duty cycle power to the sensor and have the analog comparator only sample during 'on' times. This brings the system power down to only 55uA! See the previous post about power consumption. The main clock for the system is brought in from an external 32kHz RTC because the internal low power 2kHz oscillator is a little too slow. 

    Clock Divider

    Finally, a series of flip flops are used to divide down the 32khz clock to 64Hz. This slow clock is used to detect long running leaks by the low pass pulse filter.


    By utilizing a mixed signal programmable logic IC this design was able to achieve a standby current of 55uA while also maintaining a variable wake-up time and leak threshold. Almost all of the logic blocks have been utilized in the SLG46826 making maximum use of it's capabilities.

  • V2.5 Prototype - Adding Mag Sensor Amplification

    ydrip08/24/2023 at 19:35 0 comments


    This version of YDrip was kindly sponsored by PCBWay. They have been my PCB vendor for version 1 and 2 so I'm thrilled they decided to sponsor the manufacturing for v2.5. I've used them in the past because their website provides real-time updates with the status of your product and their support engineers provide great design feedback to make sure their are no manufacturing delays. The ordering process is also extremely easy with their KiCad plugin, which automatically packages your board design, opens a browser, and adds it to your shopping cart.

    v2.5 prototype STL printed enclosure and PCB

    This was my first time ordering 3D printed STL parts from PCBWay and I'm very satisfied with the result. The 0.8mm lip that connects the two halves of the enclosure printed perfectly along with all of the ribs for rigidity. Their part finishing is also well done with no signs of support marks or warping. The PCB quality is what you've come to expect with no flaws and good enough dimensional accuracy to friction fit into the case. Thanks PCBWay.

    Fully assembled enclosure

    Electronic Design Changes

    The ALT021-10E is an ultra sensitive magnetic sensor (0-0.25 mT). It's so sensitive that I've been able to use it without an amplification stage which has reduced BOM costs and complexity. Unfortunately, I've run into a few problems.

    1. The earth's magnetic field can interfere with measurements depending on the device position.
    2. Some water meters have very weak magnets that are not measurable with the current design.

    To fix these issues, I decided to add an op-amp to amplify and offset the output signal. I chose the SLG88103104 from Renesas which has a stunning 375 nA quiescent current per channel. It also has a shutdown pin which I can duty cycle with the sensor, but it almost wouldn't make a difference in the total power budget.

    The opamp is setup as a differential amplifier with both sides of the wheatstone bridge sensor going to the +- inputs of the amplifier. (Ignore the resistor values. They are just place holders)

    A better design would use an instrumentation amplifier to avoid loading the wheatstone bridge which could reduce accuracy if not take into account. One way to mitigate this is by using much larger input resistors than the bridge resistance (10k in this case). Here is an example from the datasheet. This app note from TI goes into more details about the tradeoffs for each approach.

    This is great, because instrumentation amps cost more and drain more power. The addition of the amp solved my initial problems, but I ran into new ones.

    New Problems...

    Up until now I've been reusing some parts like the mag sensor since they were out of stock at the time. This meant I didn't have to deal with device to device variances which would impact my amplifier design. Silly mistake.   

    The ALT021 wheatstone bridge DC offset variance is +- 20mV. We can see that in the datasheet and following plots.

    Green & Yellow = Sensor 1

    Pink & Blue = Sensor 2

    Blue plot is behind the green. See the measurements window on the bottom right for the DC offset

    Sensor 1 has a difference of 27mV between differential pairs and sensor two has a difference of 9mv. Here are the same devices rotated by 90 degrees.

    There is a 2mv - 4mv change due to the earth's magnetic field.

    This last plot is with a magnet spinning near the sensors.

    In a perfect world both signals would be centred around Vcc/2 or 3.3V/2 = 1.65V with no magnetic field. The problem starts when you try to amplify the difference between the two differential pairs. The difference in DC offset between sensor 1 and sensor 2 will also get amplified resulting in an output signal with an even larger offset. Here is a simulation with sensor 1.

    The bottom two lines are 50mV sine waves with 180 degree offset at 1.41V and 1.68V (sensor 1). We can see the output signal (green) is offset by about 2.6V. Let's take a look at sensor two which...
    Read more »

  • Low power small leak detection

    ydrip07/19/2023 at 15:25 0 comments

    I have made modifications to the programmable logic to identify minor leaks and trigger the ESP32-S3 to alert the user, which will have a significant positive impact on battery life. Software-based detection can identify large leaks when the ESP32-S3 wakes up to report regular usage. For instance, if the usage remains consistently high for an extended duration, however this is not implemented yet. All variables can be customized through the YAML file.

    Here is what the Home Assistant Card looks like


  • Green Hacks Contest Submission

    ydrip07/03/2023 at 23:05 0 comments

    I wanted to share that this project will be submitted into Hackaday's Green Hacks contest. This opportunity came at the perfect time because the costs for the development of version 3 of YDrip will be significant. This version will be weatherproof and potentially capable of reading diaphragm-style gas meters (some testing is still required). To achieve this, I am planning on injection molding the enclosure, which has a significant upfront cost.

    The theme of the contest is to:

    Build a hardware solution that recycles electronics, makes energy harvesting or storage more efficient, or contributes to the sustainability movement.

    YDrip contributes to the sustainability movement by giving home owners and business the tools to reduce water consumption. It does this in two ways. The first is by detecting leaks before they turn into costly problems. The second is by giving users real-time water usage data to empower individuals to make informed decisions to conserve water. By visualizing consumption patterns and setting goals, individuals can modify their behavior and adopt water-saving practices. This can include water decisions about whether it is time replace that appliance or how long to water the lawn.

    A Unique Solution

    The YDrip project addresses a gap in the open source market by offering a versatile solution. Its low-cost and low-power design, combined with programmable digital logic, enables it to be repurposed for various applications. For instance, the hardware's fundamental elements can be utilized to monitor gas meters, and by adding an IR LED, it becomes capable of measuring smart electricity meters. This flexibility and adaptability make YDrip a valuable option for a range of monitoring needs.

  • V2 Prototype - Source Code Release

    ydrip07/02/2023 at 01:31 0 comments

    You can find the initial release of the ESPHome plugin for YDrip on Github today. The software is basic, but functional. It puts the device to sleep when connected to ESPHome. The wake up period is based on the number of water meter magnet revolutions i.e consumption. Leak detection is still a work in progress.

    Version 2 of the hardware and enclosure can also be found on Github.

  • V2 Prototype - Power Measurements

    ydrip06/30/2023 at 22:43 0 comments

    It can be difficult to estimate battery life for IoT devices, but it's still a good idea to take measurements during development to see if you're even in the ballpark. Commercial water meters that are used by cities last 10-20 years. Some can even use the rotation of the magnet to harvest energy. YDrip won't have that advantage due to the farther mount distance. WiFi will also be a challenge because it wasn't designed for low power, however WiFi 6 and the new ESP-C6 may help with that in the future. For now, I'm targeting months of usage on a single battery. Let's see if that's possible.

    The first measurement shows the current draw (at 4.5V) while the ESP32 wakes up from sleep and transmits the water usage. Average current is 110mA over 6 seconds with fast connect enabled. This is fairly high and will limit how many times the device can update the server, but this is expected. There is lots of room to optimize here.

    Read more »

  • ESPHome and Home Assistant Integrations

    ydrip06/24/2023 at 19:56 0 comments

    Demonstration of ESPHome and Home Assistant integration.

  • Water Meter Test Setup

    ydrip06/23/2023 at 22:54 0 comments

    This is the test jig I use for testing YDrip when I need to play with different variables like rotation speed, mounting angle and distance. It consists of a dissembled water meter magnet attached to a DC motor. The brass housing sits on top of both to simulate a real instillation. The The ATtiny412 counts the revolutions using a hall effect sensor and acts as a source of truth.

  • V2 Prototype - Battery Powered

    ydrip06/19/2023 at 19:12 0 comments

    The main goal for V2 was making it battery powered which turned out to be extremely difficult. First, the PCB and case was expanded to make room for three AA batteries.

    Then I started replacing/adding a few components:

    The major hurdle was finding a replacement for the LIS3MDL magnetic sensor. Having already exhausted my off the shelf sensor solutions I had to make something from scratch.

    Read more »

View all 12 project logs

Enjoy this project?



shahtajqaiserofficial wrote 9 hours ago point

Are you Looking for a dress that hits the perfect balance between casual and formal? Check out our collection of semi formal dresses at Shahtaj Qaiser. Buy the perfect semi-formal dress for your next event. Shop now!

  Are you sure? yes | no

ECS wrote a day ago point

ECS offers the best women scarves online in Pakistan. Check the best quality scarves online at ECS. Get the latest designs of scarves for women online today at great prices.

  Are you sure? yes | no wrote a day ago point

Borjan offers the best quality Women Shoes online in Pakistan. We provide wide range of women shoes in all over Pakistan at the best prices. So, grab your favorite shoes for women today and enjoy.

  Are you sure? yes | no

jazminpkonline wrote a day ago point

Discover embroidered fine slub online at Jazmin Clothing. We offer the best quality embroidered fine slub online all over Pakistan.

  Are you sure? yes | no

mohagni.hive2 wrote 2 days ago point

Mohagni offers the new latest dress design online in Pakistan. We offer various designs and styles with many colors, which can be used for any event. Find the finest quality dresses from mohagni and buy your favorite one.

  Are you sure? yes | no

walkeazeshoesandbags wrote 2 days ago point

Check out the best quality Wallets for Women online in Pakistan. Explore the variety of ladies' wallet designs online at Walkeaze. Order your favorite wallets online at reasonable prices.

  Are you sure? yes | no

houseofflowers wrote 2 days ago point

Experience the beauty of nature with Bookey Flower, your ultimate destination for exquisite floral arrangements. From elegant bouquets to stunning centerpieces, our house of flowers offers a wide variety of fresh blooms for every occasion. Check out our awesome flower arrangements! We put so much skill and love into each one.

  Are you sure? yes | no

nodemcu12ecanada wrote 06/23/2023 at 18:18 point

Just reading the water meter remotely with a WiFi cam can be helpful at detecting leaks early.

  Are you sure? yes | no

ch.dugasduvillard wrote 06/09/2023 at 06:40 point

Hi, I'm very interesting by your project. I'm looking to create something similar since a long time.

Can I ask you how you get the value from meter ? I have 2 meters at home one for heat water and one for cold water that I'd like to connect.


  Are you sure? yes | no

ydrip wrote 06/09/2023 at 19:23 point

That's interesting. I've never come across different meters for hot and cold. Do you mind posting the model number and which country you're in?

Most water meters have a spinning disk inside of the brass housing (on the left in my first picture) that spins based on the volume of water passing though it. The city installs a reader on top of the brass housing which reads the number of rotations. That info is read by a utility worker every few months or sometimes transmitted over-the-air to the water company.

The difficulty with building your own device is proximity to the magnet. The city reader is usually in the way so you need to position any 3rd party reader on the side, which means you need a very sensitive sensor. I'm planning on posting more details here and on my website about all of this.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates