Metal Toad Kegerator with built in monitor

Here in Portland we have people who brew beer and many more who drink it! Between the brewing and consuming of it, there is the overlooked step of dispensing it. We at Metal Toad have long had a "Kegerator" in the office, a dedicated refrigerator that holds small kegs of beer with taps mounted on the front. The Kegerator has a handy web site associated with it that shows what beers are on tap and the levels of the beer. We all love the Kegerator, the convenience of knowing the beers are and how much is left, so that we don't unexpectedly run out of beer. Except for one thing, The levels were a lie!!! The kegerator had no way to know how much beer is left in a keg and as such, the levels were set manually whenever someone in the office remembered to update it. Updating it required pulling the code for the site from git, making a change to the hard coded values, and pushing it back up to the repo. the long term goal has been to add sensors to measure the amount of beer in the kegs and have the site self-update. We started a project to do just that and the results have been awesome, if not perfect (more on that at the end).

Measuring Beer

The first step was to find the right way to measure the level of beer. The original ideal was place a Wii Balance Board in the fridge and place one keg at each corner. Then we could read the weight at each corner and determining the "fullness" of a keg. In order to do this, we are going to make a few assumptions: First, the kegs we are using have the same weight when empty (they don't, but close enough). Second, the kegs when full are close enough to the same weight that we can get a good idea if the keg is near empty. While this conceptually could work, there was the challenge of the balance board fitting in the fridge! We partially disassembled the board as an exploratory step and from that discovered that there is one sensor in each corner. Finding that we could read each sensor individually, we could completely remove the sensors and create our own weighing platform for the kegs.

A complete, intact balance board.

Building the scales

While the board is easy to open, freeing the sensors requires a bit of de-soldering/re-soldering, but nothing too extreme. The key to it all was keeping track of what wires goes where. After everything was out, we built a simple mounting board for the sensors. Each of the sensors is mounted underneath a 1/4" piece of plywood that is hinged on one side. The free side will allow the keg to press down on the sensor and the sensor will get a reading depending on the weight of the keg. On thing to note, this isn't going to give you an accurate weight, but it will give you a consistent one and that's what we're going for.


The Software

There are many software options out there for connecting to the balance board. The balance board, like most Wii accessories, communicates over Bluetooth. The machine that displays the site on the Kegerator is an older MacBook, so I chose to go with an Objective-C solution for reading the scale. I found a project that had already implemented the Bluetooth portion and changed the code to read each scale individually. The coolest part of this project was implementing an HTTP server in the Objective-C code that would output the values of the scale, as well as do tare and max value functions, via an HTTP REST (-ish) api. All that was left now was to change the site to read values from the laptop instead of the static values. Lastly, I changed the PHP file to use curl to connect to the Kegerator computer and read the values. Wham! A reasonable view into the beer levels in the office.

Date posted: July 7, 2014

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Schedule a Free Consultation

Speak with our team to understand how Metal Toad can help you drive innovation, growth, and success.