# Kegbot (flow meter and digital taplist) project



## Moad

I got tired of kegs kicking at inconvenient times, I had some arduinos laying around and I am a bit of a nerd so thought I would make a kegbot system. It is a small server running on either a raspberry pi, linux machine or a tablet. An arduino board connects to the server and the flow meters connect to the arduino. Basically the arduino reads the signal from the flow meters and sends that to the server.

So far I have soldered the flow meters onto some cable and a 3 pin connector per flow meter (Jaycar)

I've attached a USB connection to the project box to go from the Raspbery Pi (kegbot server) to the arduino. The sockets for the connectors have been fitted onto the box, this should make soldering easier too. The arduino sketch has been uploaded and tested, the raspberry pi loaded with kegbot and tested.

Left to do is finish soldering the sockets and then hook them up to the arduino in the box. Then I need to screw on the barbed fittings to the flow meters and fit them into my keezer. Then run the connectors out of the keezer into the project box and I will be up and running.

I'm hoping to have it all running this weekend with a keezer tidy up happening, more to follow.


----------



## megabyte

Nice! Keep us posted.


----------



## contrarian

Where do the flow meters sit in your system? Any issues with foaming from them? It certainly is one of the most annoying things about kegs! When mine go they tend to go in clumps too!


----------



## Moad

contrarian said:


> Where do the flow meters sit in your system? Any issues with foaming from them? It certainly is one of the most annoying things about kegs! When mine go they tend to go in clumps too!



I haven't actually poured beer through them yet. I've read that they need to be as close to the keg post as possible so that's the plan. Hoping to get some time this arvo to finish it off


----------



## Moad

Success!

I finished a uni exam early tonight (this morning?) so had some time while the family was asleep to test a flow meter and finish the keezer rebuild.

I connected up the lines, beer poured fine so I grabbed one of the finished flow meters. I hooked up some water in a mini keg and poured through but it wasn't registering in the kegbot server. hmmm.

Hooked up another one I had prepared earlier and success! Registering pours. I still need to tweak the ticks/ml setting to calibrate the flow meter but it works a treat. No foaming issues although I am running an extra .5m on my lines so it could counter the foaming. In any case, I am stoked! Will finish the build off tomorrow night and fix the flow meter to the keezer a bit better.







Need to finish the soldering of the flow meters and sockets on the project box and then attach them to the keezer and the beer lines.


----------



## malt junkie

Buggered if I can find the flow meter on JayCars website. Might just have to ebay it.


----------



## BrutusB

malt junkie said:


> Buggered if I can find the flow meter on JayCars website. Might just have to ebay it.


I couldn't find it either. I did research these a while ago and found the accuracy wasn't too flash. Excited to hear how how these actually perform!


----------



## Moad

malt junkie said:


> Buggered if I can find the flow meter on JayCars website. Might just have to ebay it.



Jaycar don't sell them any more, I got mine from AliExpress. They sell on eBay as well if you just want one or two.

http://m.ebay.com.au/itm/1-30L-min-1-75MPa-1-2-quot-Hall-Effect-Flowmeter-Control-Water-Flow-Sensor-Arduino-/201693323507?txnId=1509142147010


----------



## Moad

I did some quick calibration and got it to 450ml for a schooey, I'll play tonight and report back on consistency once I dial it in.

It was 2.30 and I sank 3 schooners in half an hour calibrating hahaha


----------



## malt junkie

Moad said:


> I did some quick calibration and got it to 450ml for a schooey, I'll play tonight and report back on consistency once I dial it in.
> 
> It was 2.30 and I sank 3 schooners in half an hour calibrating hahaha


Dialing these things in has ruined many a liver, good luck!


----------



## klangers

I'd be interested to hear about the longevity of these meters, and expecially how well they endure beer line cleaning. 

The flowmeters appear to be a turbine type, ie, positive-displacement. As the turbine turns, a hall effect sensor is tripped for every (x) volume units. This should help with the low-flow accuracy. Unfortunately it'll also add a bigger pressure drop, and thus I'm interested to hear if foaming becomes an issue. I doubt it, as you have placed them near the kegs and they have a 1/2" bore.


----------



## Moad

I had zero foaming issues from tests last night, I'm planning to finish it all off tonight. 

For the price, I'll happily replace them once a year


----------



## Moad

Accuracy seems a bit off, will do some more playing tonight. Last night I finished the soldering and wired up resistors. All tested I just need to mount the flow meters in line and attach them to the freezer wall, following that I'll play some more with the calibration. Then I need to mount a screen near the taps and I am done! Until I want to add solenoids....


----------



## mr_wibble

Moad said:


> Accuracy seems a bit off, will do some more playing tonight.


Off by how much?
Various sources cite either 3% or 10% accuracy.

How are you watching for the "ticks" (pulses) from the sensor?
Could you be missing some of them?
Do you use rPi interrupts for detection? (As opposed to simply polling the state of the pin).
Have you tried using an rPi asynchronous (rising/falling edge) type interrupt?

I've only really dabbled a bit with my rPi, so I can't speak from experience here. But on arduino with a similar kind of reading (a rotary encoder) without using hardware interrupts it would easily miss signals - even something simple like turning the encoder knob anything but dead-slow would cause it to mess up.


----------



## Moad

The arduino handles the interrupts and passes the information to the Rpi. Thats about the limit of my understanding.

edit: with regards to the interrupts, there is a version which runs on the Rpi that uses the Rpi for the interrupts but I didn't look into it too much. I'm using the stock arduino sketch for kegbot. It seems more likely to be over by 3% rather than under so it isn't mising ticks. I'll add more info on this as I use it a bit more.

I am seeing about 3% variation (testing with a 2L erlenmeyer) which is acceptable for this application IMO. it means over the keg I would be out by a schooner max. My starting volume is probably going to be out by more than that so I am happy with that. I'll see over time if it varies more or less and report back.

The build is now functional, connected everything up and am happy to report it is all working as expected.

Next up is mounting a tv on the deck for taps and media streaming/tv, I am trying to code up a custom interface to display all 6 of my taps on one screen rather than the 2 by default.


----------



## Moad

A little more info after playing with these for a bit. 

The frequency of the pulses to measure the volume of liquid is linear based on the flow rate. I think what this means is that the flow rate needs to be consistent for the volume measurements to be accurate.

I realised this when I ran out of gas and my pour was slow, the volume was way off. 

Real world result is that the readings during a party where lots of people are pouring may be off if you have a check valve or some other reason for the flow rates to change (like flow control). 

I am going to remove the check valve I have to help with this, for normal usage though the yf-s201 sensors are pretty good. Even if its within 5-10% I am happy


----------



## Moad

Happy to report I now have the meters accurate to 1-2%

The key is consistent pressure and no air/co2 in the lines


----------



## Moad

I rebuilt the server software onto a linux machine as the raspberry pi couldn't handle all the python.

Finally resolved the last issue I was having last night, next is to mount a TV and tablet on the deck.

http://smartykegs.thickasthievesbrewingco.com

You can check out my night of calibration... 4.5L wwweeeeoooowwwww


----------



## dblunn

Hi Moad,
that looks great but how do you stop SWMBO from seeing that web page?


----------



## mr_wibble

dblunn said:


> Hi Moad,
> that looks great but how do you stop SWMBO from seeing that web page?


What about when SWMBO has a higher score than you :blink:


----------



## mr_wibble

Could you please give us a few notes on how you performed the calibration ?


----------



## Moad

She does not know the URL, if she does find it...I will change it. 



Calibration I used water to get each meter ball park measurements using a 500ml flask. I then hooked up the beer and poured ~250-350 mls into a schooner and weighed it vs an empty schooner. 

I assumed 1g = 1ml which is probably wrong but the measurements I am getting from kegbot seem pretty good to me. Around 415-430 for a full schooner with a small amount of head. Slightly over estimating is good for me

I then adjusted the tick/ml and poured again. I will keep testing as I pour for a little while, until I am happy it is reliable and consistent


----------



## dblunn

Mr Wibble said:


> What about when SWMBO has a higher score than you :blink:


Jeez, I never considered that ever happening.



Moad said:


> I assumed 1g = 1ml which is probably wrong but the measurements I am getting from kegbot seem pretty good to me. Around 415-430 for a full schooner with a small amount of head. Slightly over estimating is good for me


Use the FG, so if it were 1.010 then 1 ml would be 1.01 g . That is only 1% so not worth worrying about.


----------



## contrarian

How are you measuring the starting volume? I guess if it's a full keg it isn't too hard but measuring partially filled kegs could be a bit tricky. Apologies if this has been answered in a previous post.


----------



## Moad

Rough guess for existing kegs, I could weigh them to be accurate.

The whole thing is a bit of fun and to roughly know when I'm going to kick a keg so not trying to be accurate to the ml


----------



## cspencer

Moad said:


> Rough guess for existing kegs, I could weigh them to be accurate.
> 
> The whole thing is a bit of fun and to roughly know when I'm going to kick a keg so not trying to be accurate to the ml


I weighed my kegs while empty and stuck a sticker with the weight on the keg. when hooking up a new keg, weigh it and deduct the kegs weight and put that into Kegbot as the starting volume.

I've stopped recording the drink lately as my system is a manual glass weighing mod after each pour, worked well and now interested in using these flow meters, thanks for the feedback. The Swissflow meters @ $60US each make it an expensive option

if your interested http://kegbot.spencertribe.com:8000

Had a few parties using it and the manual weighting gets way out towards the end of the night, lots of missed pours or double pours recorded.


----------



## Moad

I got a double pour last night, have you done any troubleshooting on that?


----------



## cspencer

Moad said:


> I got a double pour last night, have you done any troubleshooting on that?


To be honest I thought it was a User (drunk User) problem as my system is a user tap on the screen when they have the glass on the scales. 
So never looked further into it. It's possible the System is posted the same data twice to the server.


----------



## Moad

I've only seen it once in 100 pours, it was an identical pour. Could have been no acknowledgment from the server to the core. 

Anyway even with this and one or two pours registering way off I am loving the system. I've dialed all my taps to within 10ml on a schooner now, the test will be if the flow rate needs tweaking on a new keg. I'm wondering if the viscosity of the beer affects the measurements. I'll be tapping a dark IPA after a helles so that should be a decent test


----------



## cspencer

Moad, good to see it's working well so far. Which connectors did you use to connect the flow meter too your beer lines? I'd like to use a 8mm quick connector thing but can't see them on the kegking site


----------



## Moad

cheers mate, they are just 3 pin connectors and 5 pin sockets from Jaycar. They fit together and you just use 3 of the 5 pins on the sockets, just in case you weren't sure!

https://www.jaycar.com.au/3-pin-din-line-plug/p/PP0302

and

https://www.jaycar.com.au/5-pin-din-panel-socket/p/PS0348

I'm sure there are better options but these work for me and were available on the day


----------



## cspencer

Moad said:


> Jaycar don't sell them any more, I got mine from AliExpress. They sell on eBay as well if you just want one or two.
> 
> http://m.ebay.com.au/itm/1-30L-min-1-75MPa-1-2-quot-Hall-Effect-Flowmeter-Control-Water-Flow-Sensor-Arduino-/201693323507?txnId=1509142147010


Moad Sorry I meant the connecting to the Beer line, i've got 8mm (I think) beerline and the flowmeter you linked early looks to be a 1/2" thread (which sort NPT etc I'm not sure)


----------



## Moad

ahhhh!

I use 5mm line (remember its ID not OD) so needed a small barb.

https://www.aliexpress.com/item/2Pcs-6mm-Hose-Barb-Tail-To-1-2-Inch-BSP-Female-Thread-Connector-Joint-Pipe-Fitting/32685171357.html?spm=2114.13010608.0.0.iNrh7s

Doesn't affect flow rate or foaming etc.

Cheers


----------



## stuartf

Hey moad, really interested in getting something like this set up on my kegerator. How difficult for a non-IT person to build? Also I was thinking of adding in pressure sensors so I can confirm what pressure each keg is at, not sure how easy that would be to do though?


----------



## malt junkie

stuartf said:


> Hey moad, really interested in getting something like this set up on my kegerator. How difficult for a non-IT person to build? Also I was thinking of adding in pressure sensors so I can confirm what pressure each keg is at, not sure how easy that would be to do though?


Each flow sensor requires an interrupt circuit, each pressure sensor also requires an interrupt circuit, so an arduino could only handle I think 6 taps with flowmeters or 6 pressure sensors or three with both.


----------



## Moad

Not sure about pressure sensors but malt junkie is right, using the arduino mega you can have a max of 6 taps. The back end will read multiple boards, you just have to assign them serial numbers.

Non IT savvy you could work it out with some help (which I am happy to offer). The hardest part is the server side which took some effort for me with minimal linux knowledge. Where are you located?

Something I have noticed after tapping a new keg tonight and I think I mentioned this earlier about pressure being consistent... Because of the minimal headspace in a new keg the pressure drops off quickly when you pour which alters the flow rate. This has affected the measurement of flow for the first few schooners. Once you are ~2L into the keg it isn't an issue but something to be aware of.


----------



## Moad

My system has been really great and consistently within 1L.

over the course of the keg I tweak the flow tick rate a little but not a big issue.

I’ve rebuilt the back end a few times so have a pretty good handle on it now. Got some nfc tokens and swipe on the tablet to automatically assign the pour.

Strongly recommend doing this for anyone with a kegging system and a mild interest in electronics. Happy to assist, the kegbot forum is pretty much dead but I’ve been trying to contribute.


----------



## Dubzie

Thanks for bumping this post.
Recently built a kegerator that will hold 6 kegs and wanted to get some sort of measurement system so i know when I have to put a new brew down.
Considering the flow meters are only $4.60 on ebay it's going to be quite a cheap project to get setup.


----------



## meathead

Dubzie said:


> Thanks for bumping this post.
> Recently built a kegerator that will hold 6 kegs and wanted to get some sort of measurement system so i know when I have to put a new brew down.
> Considering the flow meters are only $4.60 on ebay it's going to be quite a cheap project to get setup.


Do you have a link to these?


----------



## DTrain123

I just noticed this thread. I was wondering if maybe using load cells connected to an Arduino to measure the weight of the keg would be more accurate/easier to use than the flow rate sensors? It would require building little individual weighing platforms for each of the kegs to sit on. 

There's an article here that gives a rough guide on how to interface an Arduino with a load cell: https://www.hackster.io/MOHAN_CHANDALURU/hx711-load-cell-amplifier-interface-with-arduino-fa47f3

The load cell accuracy wouldn't be affected by the CO2 pressure and pour rate. There also wouldn't be any need to weigh the keg before hand or to guess how much the starting volume of beer is. As long as it knows the empty weight of a keg, it could calculate how many kilograms of beer you have remaining at any given time.

Although now that you've already got the flow sensor system working, it's probably a bit late to go changing it now.


----------



## Dubzie

meathead said:


> Do you have a link to these?


Click on the eBay in my original post, linked them already


----------



## Moad

Anyone else hooked up Amazon Alexa to ask whats on tap and how much is remaining?


----------



## stacker

old thread but anychance you want to post up a build guide and software code. love to build something like this myself.


----------



## mischa6262

stacker said:


> old thread but anychance you want to post up a build guide and software code. love to build something like this myself.


Look up raspberrypints theres good info on setting it up i have nearly all the gear to do it myself just havent got around to finishing it off yet haha


----------



## mischa6262

Dubzie said:


> Click on the eBay in my original post, linked them already


mate my only query with those would be the min flow rate of 1L/min seems a bit high?, and can they handle the cold inside a fridge? i got some a while back and they are rated to -20deg and min flow rate of 0.6L/min - 5 L/min cost me i think about 45$each


----------



## Moad

mischa6262 said:


> mate my only query with those would be the min flow rate of 1L/min seems a bit high?, and can they handle the cold inside a fridge? i got some a while back and they are rated to -20deg and min flow rate of 0.6L/min - 5 L/min cost me i think about 45$each



I’m still using these a couple of years later, work great and no issues. I find the whole setup to be accurate within 1-3 schooners which has been useful for me.


----------



## bmloho

Moad said:


> I’m still using these a couple of years later, work great and no issues. I find the whole setup to be accurate within 1-3 schooners which has been useful for me.


Have an interest in this....

I have been trying with XAMPP and phthon2.7 on an old windows laptop. 

The file structure on GitHub is driving me nuts.

Have you any clues where the main web config files and the database structure can be found.
Thanks


----------



## Moad

bmloho said:


> Have an interest in this....
> 
> I have been trying with XAMPP and phthon2.7 on an old windows laptop.
> 
> The file structure on GitHub is driving me nuts.
> 
> Have you any clues where the main web config files and the database structure can be found.
> Thanks



there was the first update in 5 years released this week... the original dev looks to have taken some interest again.

min a complete Linux noob and have to hack it together every time I rebuild. The forum is still active at forum.kegbot.org


----------



## Grmblz

Hi Moad how's this as an alternative perhaps? IoT Home Beer Keg Scale No need for flow or pressure tweaks. I'm looking for something simple, just set and forget (zero programming skills)


----------



## bmloho

Moad said:


> there was the first update in 5 years released this week... the original dev looks to have taken some interest again.
> 
> min a complete Linux noob and have to hack it together every time I rebuild. The forum is still active at forum.kegbot.org



I have had a bit of experience with Linux. But still its a massive learning curve.

It knocks out a lot of potential users.

Having a simple hosted solution, our downloadable package that plugs in to Wordpress or Joomla.

Would certainly gain some widespread acceptance.

I will keep at it.


----------



## Moad

bmloho said:


> I have had a bit of experience with Linux. But still its a massive learning curve.
> 
> It knocks out a lot of potential users.
> 
> Having a simple hosted solution, our downloadable package that plugs in to Wordpress or Joomla.
> 
> Would certainly gain some widespread acceptance.
> 
> I will keep at it.




There is a pretty good updated guide on the forum for kegbot. it is essentially:

Install Ubuntu (use noobs it's very straight forward)
Run the kegbot scripts
Profit


I have to reinstall every year or two for whatever reason and there is enough info to put it together. Happy to answer any questions but you'll get a lot more help over at the kegbot forums


edit @bmloho Kegberry Single-Line Install Script


----------



## KegLand-com-au

klangers said:


> I'd be interested to hear about the longevity of these meters, and expecially how well they endure beer line cleaning.
> 
> The flowmeters appear to be a turbine type, ie, positive-displacement. As the turbine turns, a hall effect sensor is tripped for every (x) volume units. This should help with the low-flow accuracy. Unfortunately it'll also add a bigger pressure drop, and thus I'm interested to hear if foaming becomes an issue. I doubt it, as you have placed them near the kegs and they have a 1/2" bore.



The chemical resistance of these flow meters is really good so I do not see that being an issue. We use similar type in our Fill O Meter and by the looks of the photo they are from the same factory. My only issue with these is that I dont feel they are that sanitary the way the flow meter is designed. I would really prefer to see a no-contact method of reading liquid level in the keg in my opinion. Capacitive sensors exist and are sanitary but very expensive.

This company here uses the similar type of hall effect flow meter too:





Keg Level Tracking and Management | Kegtron


Kegtron designs and manufactures keg level monitoring and management systems for home and commercial use. We bring intelligence to your taps.




kegtron.com





We purchased some of these some time ago but due to how difficult they were to sanitise and clean we did not stock them.


----------



## kadmium

KegLand-com-au said:


> The chemical resistance of these flow meters is really good so I do not see that being an issue. We use similar type in our Fill O Meter and by the looks of the photo they are from the same factory. My only issue with these is that I dont feel they are that sanitary the way the flow meter is designed. I would really prefer to see a no-contact method of reading liquid level in the keg in my opinion. Capacitive sensors exist and are sanitary but very expensive.
> 
> This company here uses the similar type of hall effect flow meter too:
> 
> 
> 
> 
> 
> Keg Level Tracking and Management | Kegtron
> 
> 
> Kegtron designs and manufactures keg level monitoring and management systems for home and commercial use. We bring intelligence to your taps.
> 
> 
> 
> 
> kegtron.com
> 
> 
> 
> 
> 
> We purchased some of these some time ago but due to how difficult they were to sanitise and clean we did not stock them.


What about an airlock of sorts that measures the volume of gas being displaced from the keg?


----------



## KegLand-com-au

kadmium said:


> What about an airlock of sorts that measures the volume of gas being displaced from the keg?



We have a new RAPT gas controller device that will be able to measure volumetric gas that goes through the device. So this new device will primarily be used for carbonation, leak detection and can give you an indication of how much gas you have left in the CO2 cylinder.

This is very much in the infant stages of development at this stage but as you have suggested we might be able to use this for gas displacement in a beer keg and use this to work out how much beer is in the keg.

So far we are getting an accuracy on the device of 5-10% but as we develop the product further I am hoping we can get the device to measure volumetric gas flow even more accurately. Even if it's only used for carbonating it's quite a useful device. So you can crank the gas pressure up to 50-60psi and then it will carbonate your beer really fast and once a specific volume or grams of gas has been measured it can turn off a solenoid preventing you from over carbonating. I think it will be are really popular product once completed but we still have a lot more work to do no this one.


----------

