Close
0%
0%

Water Flow Monitor

Measuring and totalizing water flow from our well, IoT style

Similar projects worth following
I've got a well on an off-grid property, and I'd like to keep track of how much water we pump using our solar-powered pump system. Needs to be bulletproof and reasonably accurate. I should be able to run it off the battery bank from the solar pump system, so power shouldn't be a limiting factor, but I'll want to keep the draw low so I don't deplete the batteries on these long, dark Idaho nights.

Requirements:

  • Well puts out about 3-4 gallons/min max, so sensor needs to work in that range
  • Sensor wetted parts need to be NSF-rated for potable water
  • System does not need to be weatherproof -- will be mounted indoors
  • Power draw should be as low as reasonably achievable when nobody is interacting with it
  • Needs to support a local display that can show the following:
    • Total volume used
    • Flow rate average over time
    • Flow rate by period (means an RTC is needed)
  • Ability to download logs from meter without the need to shuffle SD cards, either via Bluetooth or WiFi
  • (Optional) Keep track of environmental factors -- air temp, humidity, supply voltage, pump run status, tanks and well sensor status
  • (Optional) Interface to APRS gateway for monitoring and alerting remotely via amateur radio

  • Calibrating the flow sensor

    Dan Maloney12/06/2020 at 03:46 0 comments

    I bought a flow sensor from Amazon: https://www.amazon.com/gp/product/B086W73NXN

    It's made by Gredia, whatever that means -- I could find exactly zero information on the manufacturer and no data sheets on the sensor. All I knew is what was in the Amazon description - 3/4", brass, Hall effect, up to 30 liters per minute. Brass seemed good because I want this sturdy and safe for drinking water, and 3/4" worked because all the piping in the pump house is 3/4" and I don;t wan to introduce any flow restrictions. One problem: it's only available with British Standard Plumbing (BSP) threads.

    I bought adapters that claimed to go from BSP to NPT threads: https://www.amazon.com/gp/product/B07Q6SSTRB. These have bonded washers that are supposed to go over the male BSP threads and form a seal against the sensor when the adapter bottoms out and squashes the bonded washer. But the sensor doesn't have a flat bearing surface for the washer to bear against, so I put an O-ring in the BSP side of the adapter which seal the end of the male BSP spud to the flat surface of the female thread in the adapter. I see that they now have these adapters that basically do the same thing: https://www.amazon.com/GESHATEN-Connector-Adapter-Industrial-Fittings/dp/B089D8NF7H

    Next I decided to replace the connector on the sensor with screw terminals. I just added a scrap of perfboard and wired the three leads to screw terminals.

    My idea for calibration hit me while I was in the shower -- rig up a scale to weigh water flowing through the flow sensor and count the number of pulses. The weight tells you how much water you have, and you can figure out how many pulses per liter the sensor sends back. My first thought was to use a load cell and an HX711 amplifier to build a digital scale. I worked on that for a few nights before coming to the conclusion that I have a bad load cell -- I could never get a stable reading. Then it dawned on me that I cold build a much, MUCH simpler calibration rig:

    It's a little hard to see what's going on, so I'll explain. The blue pipe is 3/4" PEX, and the brass bit near the lower end of the pipe is the flow meter, followed by a quarter-turn valve. I made the pipe above the flow sensor long and vertical so that the flow through the sensor would be as close to laminar as possible. Water feeds into the calibrator through the white hose on the back of the upright.

    The two buckets on the board are a crude balance. The back bucket catches the water coming out of the flow sensor, while the other bucket has either a 1-kg or 5-kg weight in it. There's a piece of conduit under the board to act a a fulcrum, and a switch under the teeter-totter:

    The switch stays closed until there's enough water in the first bucket to tip the balance. My code starts counting pulses from the flow sensor and waits for the input connected tot he switch to change state. When it does, it stops looping and displays the number of pulses. Here's the code:

    #include <Arduino.h>
    
    
    volatile int pulses; // Measures flow sensor pulses
    unsigned char flowsensor = 12; // Sensor Input
    unsigned char limitsensor = 14;
    volatile bool flag = false;
    
    ICACHE_RAM_ATTR void flow () // Interrupt function
    {
       pulses++;
    }
    
    ICACHE_RAM_ATTR void limit () // Interrupt function
    {
       flag = true;
    }
    
    
    void setup() {
       
       pinMode(flowsensor, INPUT);
       pinMode(limitsensor, INPUT);
       digitalWrite(flowsensor, HIGH); // Optional Internal Pull-Up
       digitalWrite(limitsensor, HIGH);
       Serial.begin(115200);
       Serial.println("Starting...");
       attachInterrupt(digitalPinToInterrupt(flowsensor), flow, RISING); // Setup Interrupt
       attachInterrupt(digitalPinToInterrupt(limitsensor), limit, RISING); // Setup Interrupt
       sei(); // Enable interrupts
    }
    
    void loop() {
      if (flag == true) {
        Serial.println("Done");
        delay(100000);
      }
    
      Serial.print("time: \t\t");
      Serial.print(millis());
      Serial.print("\t\tpulses: \t\t");
      Serial.println(pulses);
      delay(100);
    }

    I used a Wemos D1 Mini because I had one handy, and because I managed to fry one Nano...

    Read more »

View project log

Enjoy this project?

Share

Discussions

elizakp1410 wrote 03/05/2024 at 00:59 point

Hi Dan! Did you ever figure this project out? I am working on something similar in Utah and would love any insights you could offer. I'm trying to figure out a way to measure how much water comes through a canal when farmers open it for their water turn, so if they lease water rights to the state we can estimate how much water a water turn contains. Just trying to save the Great Salt Lake, no biggie ':D

If you have any thoughts on this, feel free to email me at Eliza.kay.peterson@students.iaac.net

  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