Arduino Keg Sensor for Level, Temperature, and Pressure with Display

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

UncleD

Well-Known Member
Joined
Dec 1, 2018
Messages
190
Reaction score
190
Needless to say I've had some free time on my hands with the quarantine. I've always wanted to be able to see the level in my keg without having to lift it, and always thought it would be nice to have temperature and pressure as well. I decided to build a keg sensor that monitors all of these values and displays them. I also added periodic storage to a cloud database so I can trend the data. I plan to add thresholds to each of the parameters so I can receive a push notification if any of them go above or below desired setpoints. I figured you guys would find this pretty cool, I certainly like it!!

The sensor is integrated into the corny keg lid, and can be unplugged from the display...
IMG_6322.JPG


The display sits on the tower behind the tap, so no modifications to the kegerator were required...
IMG_6340.JPG


Here's a couple of the trends, I've had a few beers since the picture above was taken :p
Trends.PNG


Let me know what you guys think!
 
Nice! How are you sensing level in the keg?

Brew on :mug:

Thanks @doug293cz! I'm using a time-of-flight sensor to measure the distance to the top of the beer level. Calibrated at a high and low, and interpolating between the two points. Its in a waterproof enclosure that I 3D printed and installed just below the lid along with the pressure and temperature sensors.
 
Pretty cool! Pictures of the sensor setup would be nice.

I was looking around and I realized I didn't take any pictures of the sensor! I'll probably be building another one soon because I bought a few of each of the sensors (they are pretty cheap so it usually makes sense to buy a few!). I'll take some pictures of the sensor enclosure that I 3D print and how I mount it in the corny keg lid. I'll make sure to post them up here!
 
Yes, we need this!

Happy to hear you like it!

I'm happy to put together a DIY for this. All of the parts can be bought online, but the sensor and display enclosures are 3D printed, and I am happy to share those files as well, but I know most people don't have 3D printers. I could also print the parts and send them if people are really interested, or even go as far as putting together kits with everything.

Is there interest for any of this?
 
I would be interested in this. I do have a 3D printer myself.

Cool! I'm going to separate the sensor and displays as separate "projects". I'll start with the sensor, the sensor can be built by itself and a I'll provide a library to download that can be included in any C++ project on Arduino, Raspberry Pi, etc. Stay tuned....
 
I built another one of these and took a couple pictures of the sensor for you guys...

IMG_6509.JPG
IMG_6511.JPG
IMG_6512.JPG


The black is a food-grade epoxy, making this completely sealed and waterproof so it's easy to clean between kegs. I hope you guys dig it!
 
Very much so!If a kit, or even a finished lid were sold one day I'd definitely be interested. My frig shows me its temp, and my CO2 gauge at my regulator works for that, but as to volume of my keg I'm always curious.
 
A ToF camera requires an IR emitter and receiver, a microcontroller, and some support electronics.
This is one bare (sans enclosure) example. The OP's printed box is likely sexier than the camera assembly :D

1597704144425.png


Cheers!
 
I assume that's the other side (without the emitter and receiver and controller)?
 
Here I was thinking that I'd build something to weigh the keg in my keezer. This is is far more sophisticated.
 
To @Dexlor, load sensors have been tried, but there are intrinsic issues - like putting devices at the bottom of a cold cabinet that might get swampy at times (which pretty much kills any notion of using an actual digital scale) along with load cell drift innate to the tech...

Cheers!
 
Last edited by a moderator:
To @Dexlor, load sensors have been tried, but there are intrinsic issues - like putting devices at the bottom of a cold cabinet that might get swampy at times (which pretty much kills any notion of using an actual digital scale) along with load cell drift innate to the tech...

Cheers!
I'm sincerely interested in seeing how this works longer-term & under pressure. I really wish load cells would work long term as they seem like they would be awesome, but yeah - with the drift it just isn't fit for purpose. Flow sensors are great for measuring pours, but the idea of being able to take a direct keg measurement just feels like the holy grail if it works.

This is an awesome project @UncleD . How long has this been in place? Have you noticed any leaks of CO2?
 
Last edited by a moderator:
To @Dexlor, load sensors have been tried, but there are intrinsic issues - like putting devices at the bottom of a cold cabinet that might get swampy at times (which pretty much kills any notion of using an actual digital scale) along with load cell drift innate to the tech...

Cheers!

Ah, I had just started looking into load sensors and hadn't encounter mention of drift. Sounds like that's off the table.

I would be absolutely willing to pilot any hardware/software config for this project and report back.
 
A ToF camera requires an IR emitter and receiver, a microcontroller, and some support electronics.
This is one bare (sans enclosure) example. The OP's printed box is likely sexier than the camera assembly :D

View attachment 694323

Cheers!

Depends on how sexy the wiring job is... He did say there was a temp and pressure sensor in there as well, so I was mostly curious how it was all working in that box on only 4 pins. Could be an ESP type board in the box, but with I2C I guess they could all be on the same 4 with logic in the external display box.

Although now that's got me thinking. Depending on the ToF power draw, you could hook this up with a D1 mini and a couple AA batteries and perhaps skip drilling the lid.
 
Given all the problems folks have had with Tilt and iSpindles communicating through SS fermenters and fridge walls, an in-keg wireless solution may prove equally problematic...

Cheers!
 
Given all the problems folks have had with Tilt and iSpindles communicating through SS fermenters and fridge walls, an in-keg wireless solution may prove equally problematic...

Cheers!
Tilts and Ispindles need to be independent of the keg and float This unit is solidly attached to the lid - could an external antenna be added to the D1 mini?
 
That would preclude the proposed "skip drilling the lid" solution...unless you mean extending the D1's existing antenna inside the keg...

Cheers!
 
Yeah, a D1 plus antenna inside the keg should help. I'm also about to upgrade a mesh WiFi, so perhaps it wouldn't be as big of an issue with a closer AP anyways.
 
That would preclude the proposed "skip drilling the lid" solution...unless you mean extending the D1's existing antenna inside the keg...

Cheers!
Reroute the wire through the pressure valve on the lid and set up a spunding valve and have the wire exit through a port on the spunding plumbing. .
 
So thinking about this device compared to a flow meter (using RaspberryPints as an example host)...

Unlike a flow meter which can (and does) trigger flow counts "automagically" via the meter pulses plumbed into Arduino interrupts, and then "are self-terminating" wrt pour amounts (the stopped meter can then be detected by the counting code), I believe a device like this has to be constantly polled and the detected liquid column height banged against the "previous" legit measurement to detect a difference. That's going to put a bit of extra stress on communications, so one would want them to be solid...

Cheers!
 
Reroute the wire through the pressure valve on the lid and set up a spunding valve and have the wire exit through a port on the spunding plumbing. .

Running a wire through a keg PRV totally disables the ability for the keg to hold pressure. That can't be what you meant ;)
And running a wire through a spunding valve would totally disable it's ability to hold pressure as well...

Cheers!
 
So thinking about this device compared to a flow meter (using RaspberryPints as an example host)...

Unlike a flow meter which can (and does) trigger flow counts "automagically" via the meter pulses plumbed into Arduino interrupts, and then "are self-terminating" wrt pour amounts (the stopped meter can then be detected by the counting code), I believe a device like this has to be constantly polled and the detected liquid column height banged against the "previous" legit measurement to detect a difference. That's going to put a bit of extra stress on communications, so one would want them to be solid...

Cheers!

I'd think waking up and checking every so often (e.g. iSpindel style) should work just fine. Unless you've got a bunch of people over drinking, every 30-60 minutes should be way more than enough. At least in my use case, I'm not looking for real time data, I'd just want to know when a keg is getting down to the last few pints.
 
I'd think waking up and checking every so often (e.g. iSpindel style) should work just fine. Unless you've got a bunch of people over drinking, every 30-60 minutes should be way more than enough. At least in my use case, I'm not looking for real time data, I'd just want to know when a keg is getting down to the last few pints.

I was think along the same lines as you. Logic can even be included to check more frequently if the was a recent drop in volume (so that if you are having a party, it pings more often to keep an accurate gauge).
 
If it was an hour I guarantee you half my pours alone would be missed each day :D And if there was a gathering...

No, ideally it really needs to be polled pretty near constantly. Using fixed intervals could have your friend's pour registered but yours maybe not.
You could try some adaptive method - eg: keep an eye out for some time after a pour to see if there's another one coming, then eventually time-out and revert to a slower polling cycle - but even that can miss events...

Cheers!
 
If it was an hour I guarantee you half my pours alone would be missed each day :D And if there was a gathering...

No, ideally it really needs to be polled pretty near constantly. Using fixed intervals could have your friend's pour registered but yours maybe not.
You could try some adaptive method - eg: keep an eye out for some time after a pour to see if there's another one coming, then eventually time-out and revert to a slower polling cycle - but even that can miss events...

Cheers!

I think you and I are saying the same thing. However, it would only miss pours until the next time it polled, right? You just compare the distance since last measure then your right back on track and the device could start polling more frequently. The goal is to measure remaining volume, not the amount of glasses poured, right?
 
If it was an hour I guarantee you half my pours alone would be missed each day :D And if there was a gathering...

No, ideally it really needs to be polled pretty near constantly. Using fixed intervals could have your friend's pour registered but yours maybe not.
You could try some adaptive method - eg: keep an eye out for some time after a pour to see if there's another one coming, then eventually time-out and revert to a slower polling cycle - but even that can miss events...

Cheers!

Yeah, just sounds like we have different goals. I don't care to catch each and every pour, I just want a ballpark of how low the keg is. Even missing 4 pints is only half a gallon (10% of the keg), and I'm fine with that. A sudden dip in my graph showing it went from 3 to 2.5 gallons since the last data point is still WAY more info than I have today.

The biggest thing I want to know is when I'm down to the last half gallon or so and should be expecting it to kick any second.

Plus, if you look at the graph in the OP, over about 19 hours the level didn't change but there was definitely some variance in the measurements.
 
fwiw, I would totally expect some jitter in this type of sensing, it's the nature of the beast. A flow meter only has to respond when fluid is moving, but a level sensor is constantly pinging.

Anyway, I can accept a paradigm that isn't strictly pour-related (at least wrt recording). While it's not my thing, if all one seeks is knowing where a keg is at a random point in time, this solution could be as apt as any I'm aware of...

Cheers!
 
Wow thanks for the interest and feedback guys! Sorry to hear if there are any issues with the topic responses. Any feedback (short, long, positive, negative) is welcome in my book. Comes with the territory of building something unique IMO.

Depends on how sexy the wiring job is... He did say there was a temp and pressure sensor in there as well, so I was mostly curious how it was all working in that box on only 4 pins. Could be an ESP type board in the box, but with I2C I guess they could all be on the same 4 with logic in the external display box.

Although now that's got me thinking. Depending on the ToF power draw, you could hook this up with a D1 mini and a couple AA batteries and perhaps skip drilling the lid.

@rsquared the sensor is an I2C device, but the WiFi controller is in the external display. This was done to be able to view the display when walking by the kegerator (and not having to open the door), I could plug a USB cable into the external display without drilling or running another cable into the kegerator, and making sure the antenna didn't have any issues connecting to my home WiFi. I had thought that a rechargeable battery powered solution would be cool, but to get the frequency of updates I wanted, this wouldn't really be acceptable. I feel that I'd be charging this all the time, and it would turn into a hassle. This is really nice to be able to just walk by and take a peek at the values.

I'm sincerely interested in seeing how this works longer-term & under pressure. I really wish load cells would work long term as they seem like they would be awesome, but yeah - with the drift it just isn't fit for purpose. Flow sensors are great for measuring pours, but the idea of being able to take a direct keg measurement just feels like the holy grail if it works.

This is an awesome project @UncleD . How long has this been in place? Have you noticed any leaks of CO2?

@Thorrak thanks for the feedback, it's definitely a fun project. I've been enjoying following your TiltBridge project as well! As far has how long it's been in place, about 2-3 months now. I've done 3 different batches, and I've been really happy with it. Turned out better than I ever thought it would be. No CO2 leaks, the epoxy creates an excellent seal. I actually added the PSI sensor because I accidentally overcarbonated a batch of beer after kegging. I adjusted my pressure regulator and went out of town and I accidentally adjusted it way too high (like 50 PSI), what a PITA to get back to normal after that. So yeah. the PSI sensor is definitely a parameter worth monitoring, especially if you aren't able to check on it at home easily.

I am testing out a mobile app I developed to provide push notifications if any of the values get above or below a user-defined threshold. Reminds me of another story where I was out of town and the person watching my house accidentally unplugged my kegerator to plug in something and didn't realize it. Would have been nice to get a notification that the temp was high, lol.

fwiw, I would totally expect some jitter in this type of sensing, it's the nature of the beast. A flow meter only has to respond when fluid is moving, but a level sensor is constantly pinging.

Anyway, I can accept a paradigm that isn't strictly pour-related (at least wrt recording). While it's not my thing, if all one seeks is knowing where a keg is at a random point in time, this solution could be as apt as any I'm aware of...

Cheers!

@day_trippr you are correct, this sensor will bounce up and down about 0.1 GAL, because it's regularly checking the distance to the top of the level of beer in the keg. It's certainly a different paradigm than the flow sensor. The flow sensor is assuming a beginning volume and removing from that volume based on the flow out of the keg. This is continually monitoring the level, temperature, and pressure. I have the display updating every 10 seconds, and I have it set to log readings to by cloud DB every 1 hour. These can be modified, but I have found that's often enough for me. Interesting idea by @Dexlor to modify the cloud update frequency based on ROC (rate of change). My thought process was that if I was having a party, I'm already standing in front of the display. The cloud update is more to allow me to see where levels are at when I'm not home, and more importantly, notify me if something happens.

It's great to see other brewers interested in this. I'm going to keep testing sensor stability, durability, and cloud/mobile integration. If I put together a "beta testing group buy", would there be any takers?
 
Although this thread is where the moderation actions are taking place, I would definitely agree that it’s the wrong place to discuss them, given @UncleD isnt the one driving/requesting them. I’ve posted my thoughts on them over here: https://www.homebrewtalk.com/threads/diy-forum-moderation.683572/

As I responded in that thread, the best way to address moderation issues is directly with the moderators, by reporting a post or via DM/Conversation.

I'll start a conversation with the other moderators and administrators about moderating posts like those deleted in this thread. Thanks for raising it.
 
I'd be down to beta test. Also, I would be willing to contribute time in coding if you need any help and my skills are actually useful.
 

Latest posts

Back
Top