Monday, March 10, 2014

Root Beer Temperature Controller

As I was continuing to clean my nerd desk this weekend and get the basement cleaned up after months of neglect, I ended up sinking a few hours into a side project. It was all started by the downsizing of my root beer bottle collection.  I have two or three times as many bottles as I typically used and I was in the process of throwing them out to make shelf space for some of my wife's stuff. Seeing all the dust on the bottles made me realize it had been a while since I had made root beer which further reminded me that my root-beer process was highly variable and what those in the business call "out of control".

The big uncontrollable factor is the temperature at which the bottles sit while the yeast eats up the sugar to provide the carbonation.  After making root beer for several years I have some idea how long this process should take but the margin of error is still very wide.  I usually end up opening test bottles to see the carbonation is progressing and it often takes two or three before I consider the bottles ready for refrigeration.

I remember my mother saying when they made root beer they used an electric heating pad to provide a more consistent temperature and as I was cleaning out these bottles, that sounded like a great idea to me.  In fact, I could go one step further and use one of my Arduino Unos and build a thermostat to control the temperature in the "fermentation chamber" (probably just a plastic cooler).  I already had all the hardware I would need to make this work and most of the code already written as well.

The idea is simple.  Put a temperature sensor in the fermentation chamber where the heating pad and root beer bottles are.  When the temperature drops below a certain temperature, switch on the heating pad and when it gets too hot, switch it off; basic thermostat.  I already had a few extra temperature sensors from my home temperature measurement project and the code to take a bunch of measurements with the on-board ADC, average them, and convert them to a Fahrenheit value.  Stripping down that code to work with one sensor instead of six was not difficult.

The hardest part was figuring out how to switch the heating pad.  These pads plug into the wall outlets which run at a much higher voltage.  I wouldn't be able to directly switch that voltage on Uno but I could probably control a relay that was capable of providing that switching.  I scrounged through my relays and found one (and only one) that was designed with a 5VDC coil (the voltage the Uno uses) and could switch the 120VAC that comes out of the wall.  The the Uno doesn't provide enough current to switch coil at 5V, by putting in a series resistance I was able to get the current under control and the relay still switching properly.

Rummaging through the garage I found an old outlet and outlet box I could use to mount the hardware.  Though the circuit is simple, making sure that everything is done correctly and safely took a little work. I didn't have the heating pad yet so I used an incandescent light bulb (there still good for something) as my heat source when I tested the system.

After only a few hours, I got it working!  The light bulb heats up the sensor to 82 'F and then the Uno shuts off the light via the relay.  When the sensor cools back down to 80 'F it turns the light back on.  I made a little movie showing an animated graph of the measured temperature with an inset clip of the lamp being turned on and off as dictated by the controller.  The synchronization between the animation and live-action recording is not perfect but you'll get the idea.



There is always room for improvement.  My bare-bones control algorithm does not guarantee that the temperature will stay between 80 'F and 82 'F as the temperature in the chamber may continue to rise even after the heating pad is turned off as it is cooling down. It would be nice to log the temperature so I could see how it actually ends up behaving.  I could try using some radios I purchased for the home power measurement system that is under development and tying it into the temperature measurement system; I doubt that will happen any time soon.  I also have some external flash memory I could write to and then read back after the batch was processed.  One of those data-logging shields would be nice right about now.

None of these limitations is going to keep me from using this immediately. Once the heating pad arrives from Amazon, I'll be ready to brew up a batch and see how well this works. I'll keep you posted on how it turns out.

No comments:

Post a Comment