Skip to content

RedHatJef/FlowMeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Project Overview

Here in Austin, the water supply is very hard1 due to local geology (mostly limestone), treated with chloramine, and at times tastes like dirt (from algal blooms2). This isn't great for general use, is annoying for making coffee (scale build-up), and isn't compatible for beer making.3 As a result, I built a reverse-osmosis water system with a 35 gallon reservoir, and this is the water used for special things like tea, coffee, and beer brewing. Parts were sourced from Buckeye Hydro and they were very helpful in getting me the correct sized system with the best options given my water quality, pressure, and expected usage throughout the year. This system takes in water with a TDS of around 200 and results in water with a TDS of around 6-7, so for every gallon of water produced by the system, around 40 gallons goes down the drain.

The goal of this project is to build a system to measure the water going into the RO filter system and keep a running total - so I can see at the end of the year how many times I've used the RO system to fill the tank, how many gallons of water were used, and then I can back-calculate how much it cost.

A future improvement would be to upgrade the TDS meter system - right now I have a simple LCD panel but I would like to eventually keep track of the input and output TDS over time. This will help to see how the water quality changes throughout the year (it generally gets worse during the summer) and how the performance of the RO filter is working over time (to better understand when it might be time to change the filters).

Architecture

RO system general notes

First, some quick math. It takes around 6 hours to fill the 35 gallon reservoir with purified water. My rejection rate is about 97% ((200 - 6.5) / 200). You'd think that we could just say "hey we rejected 97% of the water" but it's not that simple - things like flow rate over the filter and water pressure will impact how much water is required. In reality the amount of water used is likely anywhere from 120 gallons to 500 gallons - a wide range. This is why I'm looking to start measuring it.

Measuring water flow

I was able to find a small water sensor with the right quick-connect fittings on it and a 3-pin connector I can prototype easily with, so it'll slot right in to the RO system connections I already have and plug right up to a breadboard system for testing.

The sensor is rated to 0.8MPa (116psi) and a working range of 0.3-10L per minute. (0.08-2.64 gallons per minute) Since it takes around 6 hours to fill the tank, and we're talking about something in the range of 120-500 gallons, that turns into a range of 0.3 gallons per minute up to 1.4 gallons per minute. We're easily in range for what this sensor can handle.

The sensor's output is in the form of a small magnet that passes a hall effect sensor (a transistor that activates by nearby magnetic fields) and outputs pulses as the impeller turns. The manufacturer claims that the pulse frequency is as follows:

Frequency: F=38 * Q (L / Min), error: ±2%. F=constant * units of flow (L / min) * time (seconds).

However, I had a sneaking suspicion that this was an approximate value and would vary based on impeller imperfections, pressure, etc. I needed a way to measure the actual flow rate, so I quickly built a test rig out of a 5-gallon bucket, some clamps, and a funnel.

It all sounded like a great idea in my head. Until it wasn't. The flexible tube used to connect the funnel to the sensor and down-tube was ... too flexible. My keyboard got a bath. (click the image for a video of the incident)

After screaming some unprofessional words and draining my keyboard out, I was able to get some measurements and got a value closer to 33.44 pulses per liter. (click the image for a video)

Programming

The program built was relatively simple:

  • An external interrupt was used to catch the rising edge of the pulses, and a simple (volatile uint8_t) accumulator was used to store "pulses since the last interrupt"
  • During the normal "update" loop, a critical section was entered (turn interrupts off, do important thing, turn interrupts back on) to drain the accumulator into a larger "total pulses" variable.
  • A dedicated FlowStats class was used to convert the number of received pulses into a total volume of liquid.
  • A simple menu system was used for
    • Selecting liters or gallons
    • Calibrating the sensor
    • Clearing the result
    • Printing out system information (like number of boot cycles)
  • Serial EEPROM was used to store
    • The calibration contsant (Q)
    • Number of boots
    • Preferred units

Case Design

I wanted the final product to look professional - not some chunk of messy wires and connectors. Over to Fusion360, where I designed a basic case with slots for USB power/communication, the sensor wires, and holes for buttons and the display. The display was especially problematic because I wanted it secure but not glued in place, so a retainer was designed to apply just the right amount of pressure. Threaded screw holes were built into the model to hold everything in place. A set of through-holes were used through the back panel - to be used to secure the device onto the RO system with some sheet metal screws.

Real-World Lessons Learned

After fully-assembling the system, plugging in the water lines, and finding a way to get USB power over to the system, it was time for a test. The water flow calibration worked perfectly, and after a short time, I left the system to run while I filled the RO reservoir.

Unfortunately, upon my return, a large puddle of water appeared on the floor under the system. As it turns out, despite working well within the max pressure the unit was rated at, some water flow sensors are not sealed as well as others. A slow drip of water appeared around the case of the flow sensor itself, and it took several weeks through the amazon return process to get a non-leaking unit.

Conclusions & Next Steps

This is an excellent start, and now that the basic flow meter is built out, version two will include TDS sensors to replace the stand-alone LCD sensors.

Additionally, keeping a lot of data - recording TDS and flow over time - and potentially inlet water pressure - is a new goal. This will require an SD card and RTC, which will then require a slightly beefier processor. The next version will be based on an AVR128DA32 and a custom PCB - this will allow for better case packaging, better programming, and more memory to deal with the SD card library which is notoriously large.

Credits

Title photograph by Genevieve Daniell — see more of her work at www.genevievedaniell.com

Footnotes

  1. 2024 Cedar Park Water Report

  2. Earthy Tastes and Odors in Drinking Water

  3. Water treated with Chlorine (as was the case when I lived in Orlando) can be boiled to remove it. Chloramine cannot be removed by boiling - sodium metabisulfate (campden tablets) must be used. Leaving Chloramine in the water will negatively impact the yeast growth cycle and result in awful off-flavors in the final product. Additionally, hard water makes brewing lighter styles of beer a bit more tricky. In general, you can use tap water for brewing, but it's not always the best idea.

About

A digital water flow meter for measuring reverse-osmosis water purification system performance.

Resources

Stars

Watchers

Forks

Contributors