Sunday, December 16, 2018

Kegerator v1.0

A local brewery, Four Generals, makes a fantastic milk stout called Buddahed that took gold in this year's Washington Beer Awards. Last year, as their supply was waning and I had the dry summer months looming, I mused that perhaps I should have gotten a keg to tide me over. Andrea, being awesome, told me to buy a kegerator and a keg to go with it this winter. As luck would have it, a friend of mine owns a good deal of homebrew equipment that he couldn't take abroad with him on a few year assignment. So I am now the steward for the next few years of two corney kegs and a CO2 tank. With that, I decided to try my hand at making a kegerator and setting it up.

The first was to refill the CO2 tank. A 5lb tank should last two kegs, according to the salesman, though no indication as to whether that's two full kegs, two half kegs, two sixth kegs, etc., but we'll find out. It cost $17 for a trade-in tank.

The missing piece -- the kegerator -- turns out to be a few hundred dollars and makes the financial aspect of a residential tap less palatable. But I found a wine fridge (which is bigger than a typical apartment- or dorm-style fridge/freezer combo) on craigslist for free that really just needed some TLC and some work on the thermostat.

I picked it up for the cost of gas to Redmond, brought it home, and started playing with it. The thermostat, even on full cold, didn't get the fridge less than like 55°.



I disconnected the wires from the thermostat (above, with the quick disconnect ends) and connected them, and within an hour, the fridge was well below freezing, so I knew it worked okay. According to some research I did, beer is "ideally" kept at 38° (though a discussion I had this morning with one of the guys at Brewhouse Provisions in Redmond said that stout is typically upper 40s or lower 50s). The problem, then, is how to replace the thermostat. I didn't really want to just get another plain old thermostat (even though that would have probably been the prudent thing to do) -- this is an opportunity to do something interesting.

Instead, I bought three Arduino Nanos for about $12, a pack of six relays for about $11, three thermistors for $9, a pack of LEDs and resistors, some protoboards and breadboards, and probably a few other things. Having never done much soldering or EE work to speak of, designing the extremely simple electronics was quite a bit of work for me. Both the kitchen table and my hands had some burns from the soldering iron:


In the end, I was able to wire up a thermostat that functions.


The software was a lot easier. (Code available here.) The basic idea is:
  1. Using a thermistor, read the temperature inside the fridge.
  2. Give a visual indication of the inside temperature: red for temperatures above the desirable range, blue for temperatures below, and green for the Goldilocks zone.
  3. When the temperature is in the red, kick on the relay for the fridge, starting the cooling process.
  4. When the temperature goes into the blue, turn the relay off.
  5. When the temperature is in the green, do nothing.
I got it all rigged up and tested in (and out of) a glass of ice water:


The visual output indicating the temperature is too warm (left), too cold (middle), and just right (center)
With a functioning thermostat, I started installing it in the fridge. As of now, I'm not drilling any holes in the walls, so I taped the thermistor to the inside wall:


Side note: My soldering and wiring was so terrible that every component except the blue LED failed at some point, and I had to re-solder everything. I consider this a lot like writing code: when you're a new programmer, you write terrible code. But the next project is marginally less terrible. Eventually, your code only kind of sucks, and you get to consider yourself a professional.

After the installation was more or less stable, I hooked up the laptop and started getting temperature readings. My software polls every five seconds (because more frequently isn't needed, and why not every five?). I opened the serial monitor and started collecting temperature measurements.


After about an hour -- when I was tired enough that I was ready to go to bed -- I copied the serial logs and plotted the temperature. At the time, my code was set to have a desirable range of 36-41°F. At the beginning of the readings, the temperature was roughly 60°. I grabbed the sensor to warm it up slightly, but it pretty quickly cooled down. After hitting the low end of the temperature range, the relay kicked off and the fridge slowly warmed up over the next half hour:


So the thermostat was successful, and next was a trip to Brewhouse Provisions to buy a D-type Sankey keg connector because, as I discovered, the Corney kegs I have are a different connection type. Then off to Four Generals with Reed to buy my keg. (This should have had a picture, but I neglected to do so.) About $92 for a 1/6 barrel (plus deposit, but that's refundable, so I won't count it). And finally, back home to put it all together.

Hooking up all the hoses and fittings was super easy and nothing particularly interesting to document.


My overall list of items and costs are as follows:

ItemCost
Half CO2 tank(?)$8
Arduino Nano$4
Relay$2
Temperature sensor$3
Miscellaneous electronics$1
D-type Sankey keg connector, hose, fittings$67.30
1/6 keg$92
Total$177

With a little luck, all of the equipment will survive, leaving me with an average cost per pint of about $2.40. A bigger (1/2 barrel) keg will bring this cost down to roughly $1.50/pint.