Android Programming for Kegerator

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.

Conan

Well-Known Member
Joined
Apr 4, 2008
Messages
744
Reaction score
42
Location
Cheektowaga, NY
SWMBO has an older Android phone (Eris, running Android 1.5 "Cupcake") she's about to be done with. There's nothing wrong with it, she just can't stand it anymore. Anyway....I have an idea about automatically keeping track of the beer left in a keg using phone. I have used MatLab and R for programming, but not extensively. I also have the Eclipse software and associated, required stuff to write apps for Android. The trouble is, I have no clue how to do it- even after reading up on the geek boards (isn't this a geek board, too??).

My thought is this. I'd mount the phone to a tap handle and keep it plugged in. When the tap is used, the accelerometer/ orientation sensor moves. The program will always be running, and when the tap is pulled the sensor says "I moved". I'm thinking I'd have an If function, "If sensor x moves 15 degrees, start timing" or something similar. It'll time the pour, basically, by stopping a timer once the tap is closed (sensor moves back towards vertical). If I tell the phone what the rate of flow is when I install the keg, it should be able to determine how much is poured off, right? Example: I setup the system with a new keg, telling it the tap is flowing 1oz/ second. Open the tap, orientation sensor passes through 10 degrees, beer is pouring, timer starts. Close tap after 16 seconds: sensor passes back through 10 degrees towards vertical, beer stops pouring, timer stops. Program operates: "I was open for 16 seconds, that's 16 ounces. Subtract 16 ounces from 5 gallons (640 ounces). Divide result (624) by 16oz in a beer." Program output: You have 39 beers remaining in this keg.

Wow, I hope that made sense. Is it possible to do this, especially with a low amount of programming knowledge? The layout in my mind is pretty easy- it's the actual lines of code that'll get me.
Thanks, Kyle
 
neat concept, though depending on the battery life it may die quite quickly unless you always have it plugged into a power source.. last thing you want to have to do is wait for a phone to boot up while you are thirsty for a homebrew
 
I'll begin by saying I don't know anything about programming and most of what you said didn't really make sense. :)
What about one of those pads that you put under the keg to measure the weight. I know those can report wirelessly to a computer?

Tony
 
I'm planning to keep it plugged in always, with probably a small rubber band holding the wire secure.

I thought about one of the scale pads, but I'm trying to do this for free- mostly because my current system (chalk on blackboard paint) is free. And, I would like to learn to program something. But I, too, know nothing about it. We'll see, and thanks for the ideas! Kyle
 
Well, Android apps run on a special flavor of the JVM - which means that you are restricted to using Java or some other programming language that happens to compile to the JVM that Android happens to use. Java is a language that is often used to teach new programmers how to write programs, so it is not a terrible place to start. The android platform seems to have a good number of people working with it, and a number of those people seem to be happily blogging away about how to do this, that, and the other thing in an Android app. Furthermore, the Android development platform is really nice, there are GUI tools for setting up your GUI's, many pre-written libraries for your convenience, and everything but your creativity should already be there for you.

That being said, I think you may be frustrated with your choice of project. I anticipate a lot of difficulty accurately estimating of beer flow using only a phone's accelerometer to measure tap handle angle. The angles that you are trying to sense are not huge, the timing must be precise, and there are many factors that can affect beer flow rate (keg pressure, temperature, amount tap is opened, etc).

I wish you the best of luck, let us know how it turns out!
 
Joyous,
I've at this point (very busy) dropped the project. Mostly because I was having trouble, in my limited searching, finding info on the tilty function. I'm hoping to look into it more in the coming weeks.

You're right- accurately estimating the true flow will be difficult, but I'm making a few assumptions. Firstly is that the tap is in one of two positions: open, or closed. This isn't terrible inaccurate because with standard taps when I open them partway I get foam. Therefore, it's all or nuthin'. As far as keg-based flow rates, I'm again assuming (backed up by qualitative observations) that the flow rate is ~ constant. Enough for my uses anyway. I generally figure about 54 beers/ keg after yeast sediment and line volume, so when I get this written I'll probably use that number. Thanks for the advice! Kyle
 
If you are still interested in the app, try searching for Android accelerometer tutorial. There are a couple out there that should show you how to access that part of the android device, and once you know the x,y,z accelerations due to gravity it should be pretty easy to calculate the phone's angle (using basic trigonometry).
 
I think this will help you. It's information on the "tilty-function". You'll probably be most interested in the last section, "Using the Rotation Vector". If you decide to pursue the project again, good luck.
 

Latest posts

Back
Top