Arduino based water dispenser. (Flow Meter, Solenoid Valve)

I started this project so that I could easily dispense a preset amount of water into my brew kettle when brewing beer.  My local brew club has a brew house and currently has hoses attached to the water filtration system.  Instead of waiting to fill up jugs of water this device will allow me to set 6.5 gallons, turn on the water and it will automatically shut off at the preset volume of water.  This lets me get started on other things while the water is dispensing and assures an accurate water level.

Parts include:

Arduino Uno $25 but will be replaced with a $3 ATMega Chip Later
YF-S201 Water Flow Meter $11
LCD Display Panel $5
ECHOTech Solenoid Valve $9


The flow meter is hooked up to the Arduino and there is a basic program uploaded that displays the flow rate and total volume of water that has passed through the flow meter.

Below is a video of the flow meter working.  I had to tweak the program to take measurements every 1/8th of a second.

The flow meter in action.

TODO: Wait for solenoid to arrive.
TODO: Code the reset button, Volume Up and Volume Down buttons.
TODO: Hardwire circuit to breadboard for compact mounting.
TODO: Mount in project box (waterproof).


      1. This looks to be exactly what I’m looking for – I make my homebrew in 10 gallon batches and push my beer through a filter into 2.5 gallon and 5 gallon corney kegs.

        At present I have to stand and watch to make sure the kegs don’t overflow and I never seem to get the same amount in each keg so when I dispense them (I use kegbot on my kegerator) it is never accurate. I’m searching for a way to press a button which will open a solenoid, allow 2.5 (or 5) gallons to flow then shut off automatically as it takes more than half an hour to filter each keg but the time varies with each one so I can’t use a timer.

        Do you have the code yet which operates a solenoid valve?

        Thank You

        1. Sorry Mark, All I have had time to do is in the code I linked to in the article. But to turn off the solenoid I think you will need to incorporate a relay or optocoupler in because the arduino is not going to have the power to deliver to the solenoid.

  1. I just complete my project that does this same thing. I used the adafruit flow meter code. Then a 5V relay to trigger the solonoid valve.

    1. Am very interested. I have a made a manual counter that uses a mom-on button for opening the solenoid. Im looking to incorporate a keypad to have a settable amount. And then a button will be pressed to open the solenoid until the target is reached them It will shut off

  2. Just seeing this – looking for similar setup for controlling water to residential units. I have a mobile home park I supply water to each lot – 3/4 and 1″ mostly lines of pvc and older galvanized – wanting to upgrade to newer 1″ pex with electronic flow meters and electronic selenoid valves of some sort to be able to shut water off in case of leaks or if they dont pay the utility bill… any ideas welcome. I have raspi 2 units at my disposal but looking mostly for components to be able to hook these up… needs to be for drinking water safe … any ideas? Your code base will certainly help me in this project… just need to add a few more things to be able to make it store the flow data and send to a master node/server to monitor remotely and be able to identify excessive use or potential breaks and auto-close the valve. Also needs to be in a case buried in the ground – like a irrigation system box of some sort – so worried how to supply power and still have accessibility but be able to lock out the tenants for their own safety and for the protection of my equipment… If you have any ideas – please let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *