Rotted Grain Automated Brewing System (RGABS)

The Early Years

This was Rotted Grain's first brewery.  It was raining that day, the umbrella isn't a permanent fixture.  Its hard to believe Eddie and I threw that thing together one evening after work.  Or, maybe not.

The original brewery was functional, but left a lot to be desired.  A lot of time was spent climbing a ladder to check the water level or temperature of the hot liquor tank.

The sun finally came out.  Boy, Adam looks hot.  Sucks that he has to spend so much time on the ladder, especially with his bad knee.  He should learn to relax, like me, over here enjoying a nice cold home brew in the shade of a cherry tree.


The idea of building an automated brewery had been rolling around the back of my head for some time.  When I first started prototyping, USB wasn't an option. I worked on creating a parallel port interface using shift registers and a digital voltmeter IC, but was never able to produce anything reliable enough to build on.

The Arduino changed everything.  In case you are not familiar, the Arduino project is like "Microcontrollers for Dummys".  Any schmuck who can whip out some C code can program a microcontroller.  Instead of using a PC to control the brewery, it would be built around a microcontroller and have an Android app interface.


 Early Communications Design

Wireless communication between the WRT54LN wireless router and the Arduino microcontroller board was established using a TP-LINK TL-WR702N wireless router.  The TP-LINK was flashed using open source firmware transforming it into a wireless USB NIC.  A serial library loaded on boot allows the TP-LINK to communicate over USB to the Arduino.  A TCP/IP connection is established with the WRT54LN and an address is obtained from DHCP. 

With the above in place it was possible to establish a serial communication link from my linux PC to the Arduino using Socat, an open source utility which allows various communication protocols to be tunneled over a TCP/IP network. Communicating from a Linux shell to the Arduino was straightforward enough but a Socat module for the Android OS was nowhere to be found.  Could it be possible to cross compile Socat using the Android APIs?  It would seem so, after a bit of hacking of course.  The Socat module was uploaded to a rooted Toshiba Thrive tablet.  Loading the module in a terminal emulator app with just the right command line parameters established a TCP/IP connection with the TP-LINK and a serial connection with the Android.  A simple serial responder sketch uploaded to the Arduino was used to verify two-way communication.

Remote Control Panel Early Mockup

OK, it ain't pretty, but it works.  At the center of the control panel is the Arduino microntroller board.  A 7 segment LED display is attached at the top. To the right of the display is a GFI outlet.  Below the outlet are three 12 V input / 110 V output relays.  The relays are controlled using the adjoining driver board.  The driver board uses transistors to amplify a 5 volt TTL signal from the microntroller to a 12 volt signal able to actuate the relays.  Below the microntroller is a set of four momentary contact switches.  The switches will allow navigation through the brewing menu.  The lower left corner contains a power supply with a 5 volt output for the Arduino and a 12 volt output for the relays.  In the upper left hand corner sits a defunct wireless router.  The RJ 45 jacks would be removed and used to connect sensors to the microcontroller.


The Voluminator

Grain contains a number of enzymes capable of converting starch into sugar. Each enzyme is active over a certain temperature range and produces a different type of sugar.  By changing the mash temperature, we are able to change the balance of fermentable and non-fermentable sugars.  This in turn affects the alcohol level, sweetness and mouth-feel of the finished product. In order to acheive the desired mash temperature, we need to add the correct amount of mash water at the correct temperature to our grain in the mash tun.

Using a microcontroller to read sensors and control relays is pretty basic. Temperature sensors can be purchased for a few dollars and are easily connected to a microcontroller. Measuring volume is more difficult.  The obvious answer is a flow meter.  Flow meters are available at reasonable prices but you get what you pay for.  One unit I looked cost around $20 but had an accuracy rating of +/- 10%.  That wasn't going to work.  More accurate flow meters are available but units with good accuracy are costly.  A friend who works in the pharmaceutical industry suggested weighing the tank.  This seemed like a good solution at first.  Strain gaugues are cheap and have excellent accuracy.  The problem was in the sensor's placement.  It wouldn't be that hard to create a platform for the hot liquor tank with a built-in scale.  Unfortunately, doing so would put the strain gauge in close proximity to the propane burner. The other option was to put the sensor above the tank. The later idea would involve hanging the tank from a scale.  I didn't find the idea of having 10 gallons of 180 degree F. water suspended over head particularly comforting.  Back to the drawing board.

One design I looked at used a resonant circuit consisting of a piece of PVC pipe wound with magnet wire and a capacitor. It would be suspended in the water tank. The rising water would change the capacitance of the, ahem, tank circuit affecting its resonant frequency. A microcontroller was programmed with a sketch to read the resonant frequency. That didn't work. Water resistance? Nope.

Finally, after much experimentation, the Voluminator was born.  The prototype is shown below plugged in to the remote control panel. The grey box is a water-proof outlet box containing a circuit board with a pressure sensor. A copper pipe fitted into one of the openings is lowered into the container of water.  Increasing the water depth increases the pressure in the pipe. The microcontroller querries the pressure sensor and uses the parameters of the tank to convert the pressure readings into water volume.

Voluminator Testing

The Voluminator is shown here being put through a thorough set of tests in my research lab.  The pot was filled with 1 gallon of water using a graduated cylinder (AKA measuring cup).  The dimensions of the pot were entered into the C code for the microcontroller which was then compiled and uploaded.  In the top left corner of the photo a 7 segment display shows the calculated volume as 1.00. 

Now I had everything I needed to read what needed to be read and control what needed to be controlled.  All that remained was to actually build the thing.

The Bones

The original brewery was dragged into the garage.  Cutting, measuring, welding, cutting, grinding, sanding and painting commenced.  (That's why I like metal work.  You can measure once and cut twice!)

Most of the structure consists of 1 inch tube steel.  A conduit constructed of 1/2 inch angle runs the length of the back and is used to protect the Gas valve, electrical runs and provide cooling.  Panels were cut from a sheet of galvanized steel and fastened using rivets and computer rack screws.

110 V. ASCO Solenoid Valve for HLT Gas

The ASCO Solenoid valve was originally purchased for use in fertilizing the plants in my aquarium.  It is mounted in the sealed conduit beneath the HLT drip tray.

Cooling System Fans

A set of four cooling fans were pulled from a broken Cisco router and mounted below the drip tray.  Although they require a 12 volt supply with Pulse Width Modulation for speed control, they work just fine using 5 volts for low speed and 12 volts for full throttle. The fans will be controlled from the main control panel and used to provide cooling for the solenoid valve as well as blow air across the boil tank to prevent boilovers during hop additions.

HLT Propane Burner and Silicon Nitride Igniter

The propane burner for the hot liquor tank is mounted using a piece of angle iron from an old bed frame.  A silicon nitride ignighter is mounted above and to the left.  Both are wired to IEC 320 outlets in the main control panel.


HLT Burner - First Light

The HLT solenoid valve and igniter will be controlled by relays on the remote control panel.  Plugging them straight into a 110 volt power source activates manual override mode, as so...

The Crushinator

The Crushinator started life as a Barley Crusher grain mill.  The hopper and tray were removed leaving only the roller assembly.  A 743 RPM, 44 in-lb Bodine gear motor is mounted using more angle iron.

The roller assembly is attached to a bracket fabricated from 1 inch tube which is in turn attached to the motor mount with grade 8 bolts.

A tray attached to the underside of the bracket directs the crushed barley into the mash tun.  The hopper was fabricated from galvanized steel sheet using rack screws as fasteners.  The upper shelf is hinged and allows access to the hopper.  The 743 RPM motor shaft drives the roller shaft using set of speed reducing pulleys.

Induction motors like the one used here act as generators when they are running.  While the motor consumes 110 volts, it produces over 400 volts of back EMF. Multiple safety measures were used to prevent a short between the motor electrical and the brewery frame.  Electricity flows from the main control panel to the motor through a 1 inch grey PVC pipe.  At the top of the above photo, the conduit enters the cooling duct.  Below the lower shelf, a water-tight electrical box protects the electrical connections from water.

The photo below shows the motor electrical feed from the back.  The orange cable was cut from a (Brand New!) extension cord rated for outdoor use.  The electrical cord is run through sealed PVC pipe which is in turn housed in a sealed metal chamber.  The 110 volt supply for the brewery is obtained from a GFI outlet on the remote control panel.

The main control panel was created from a Harbor Freight box that I used to keep electronics in.  All of the electrical runs terminate in the remote control panel.

The start and run capacitors for the motor are mounted in the top of the box. Power to the motor is supplied by one of three IEC 320 sockets that I pulled out of miscellaneous boards donated by Eddie.

The Bodine gear motor is a capacitor start capacitor run induction motor.  That means that two capacitors are needed to start it.  The start capacitor is removed once the motor is up to speed.  Initial testing, using a standard motor relay connected as shown in the suppliers wiring diagram, failed miserably.  That's because they aren't compatible with this motor.  I spent some time designing a circuit that would automatically remove the start capacitor after a set time delay but decided to go with a much simpler design.  A DPDT toggle switch is mounted to the panel faceplate.  Pressing the switch down activates the motor with both capacitors.  Moving the switch to the top removes the starting capacitor.

The Crushinator in action...

The Chillinator Gets a New Home

The Chillinator was a welcome upgrade to the original brewery.  The in-tank heat exchanger we had been using required constant agitation to chill the wort at an appreciable rate.  Even with constant stirring, bringing the wort down to a safe pitching temperature required as much as an hour.  

The Chillinator is a counter-flow heat exchanger.  The copper pipe at the back tees off to a faucet.  The faucet feeds the cold water inlet on the bottom coil of rubber hose.  The outlet of the boiler will connect to the inlet on the top right side of the heat exchanger.  The hot wort will flow through a 1/4 inch copper pipe inside of the hose.  Cold water will flow the opposite direction outside of the copper pipe.  By using a counter-flow arrangement, the temperature difference between the hot and cold liquids is maximized, in turn providing optimal heat transfer.  

What used to take an hour is now instantaneous.  Instead of waiting for the wort to cool before beginning to run it into the carboys, simply hook the boiler to the heat exchanger, turn the cooling water on and start filling.  The only prep time required is to boil water to run through the inner coil for sanitization. Inevitably, I would forget to put the water on to boil ahead of time. A couple of Brain Slagles tends to do that. No problem.  RGABS will be programmed to remember for me.  :-)

HLT Inlet 

Above the faucet you will see a white box.  This is an Orbit lawn watering valve. The valve connects the water feed to the HLT inlet.  Copper pipe running up the back terminates at a male threaded connector attached to the highest center brace.  A PVC pipe will run to the top of the HLT and outlet into the tank.

The microcontroller will request brewing parameters including grain weight and the rest temperature of the mash.  From these values and the mash tun thermal mass, obtained through a previously performed calibration routine, the amount and temperature of mash water will be calculated.  Water flow will be controlled by the Orbit water valve and measured by the Voluminator. Temperature will be controlled by the electronic start burner and read with a digital temperature transducer mounted inside of a stainless steel probe.

Initial Tests

The photo below shows everything hooked up for initial testing. The blue cooler serves as the mash tun. A temperature probe threaded into the top of the mash tun monitors the internal temperature.  The hot liquor tank sits above the mash tun and is outfitted with a temperature probe and the Voluminator.

The relays and driver board were relocated to the remote control panel.  1/4" phono plugs on the main and remote control panels are using to provide a TTL signal from the microcontroller to the relay drivers.

The PC is being used to tweak code and navigate the microcontroller menu.

The TTL control values and sensor readings are displayed using a back-lit LCD panel that replaced the LED display.

The image below shows the Calibration routine being run.  The microcontroller has added a known quantity of heated water to the mash tun. The temperature inside the mash tun is monitored until a steady-state is reached. 

The thermal mass of the mash tun is then calculated using the following formula.

The mash tun's thermal mass was determined to be 1.84 BTU/deg.F.  In other words, raising the internal temperature of the mash tun by one degree farenheight will require 1.84 BTU of energy.  This value will be used in the Brew routine to calculate the volume and temperature of mash water necessary to reach the desired strike temperature.

There were a few bugs but overall testing went well. After draining the hot liquor tank, the water volume is showing a negative value.  This means that the Voluminator is reading a vacuum inside of the copper pipe. I must have a slow air leak.  As the column of water rises, pressure inside of the copper pipe rises.  Any loss of air at this point will be reflected as vacuum as the water is drained.

Additional code was needed for the Brew routine but that would be easy.

Brew Day #1

Results were less than spectacular.  Things just didn't want to work the way they had in testing. The override switches were a life-saver. We ended up using the remote control panel to monitor the sensors and the main control panel to turn the water and heat on and off.  It was still a big time saver but there was more work to do.


All code was checked and rechecked but everything came up clean. Reprogramming the microcontroller with a simple sketch to check the sensors showed that the wiring was not at fault. The additional brewery code must be consuming too much microcontroller memory. The decision was made to remove the brewing logic from the microcontroller.

The microcontroller was reprogrammed with a stripped down version of the original code.  The new sketch contained a loop that would read the sensor values into a buffer and send the values over a serial connection when querried.  The TP-LINK was removed and the Arduino board was plugged into the USB port of a laptop running a Ruby on Rails webserver.  The webserver runs a loop that querries the microcontroller for sensor readings and displays the temperatures and volume on a web page.

Initial work was done to program Rails with the brewing logic that was removed from the microcontroller but a fault in the main control panel relay board prevented its completion.  The wire-wrap prototype board served its purpose but needed to be replaced with a more robust "production" version.  Work was started on a CNC router to be used for circuit board fabrication but that project has not progressed as quickly as I had hoped.

Brew Day #2 

The brewery was relocated to Adam's garage.  After everything is plugged in, the laptop is attached to Adam's wifi router and the webserver is started. A tablet is used to display brewing parameters from the webserver while the override switches on the main control panel are used to control water and heat.

In the following photo, Adam relaxes while the Crushinator fills the mash tun with crushed grain. 


Brew day was a day of rushing around getting everything ready, calling Adam so he could pick up whatever we forgot, having one person hold a drill attached to the Barley Crusher while the other poured the grain, undershooting our mash temperature and having to boil water, or worse, overshooting and having to add cold water to bring it back down.   That's a seriously long sentence.

RGABS can be programmed to remember all the things we forget and simplify the process.  Fill the grain hopper, put the mash tun (cooler) underneath and turn on the motor.  Enter grain weight and mash  temperature into the control panel and stand back.  The HLT will be filled with the proper amount of water and heated to the proper temperature.  When the grain is crushed move the mash tun to the shelf beneath the HLT.  When the mash water is ready, open the HLT valve and allow it to run into the cooler.  Dough in (stir the grain and water) and the temperature of the mixture will settle to the required temperature. After an hour rest, the enzymes in the grain have converted the starches to sugar.  The wort is drained into the boil tank and the hour boil begins. 

What's Next?

Bluetooth of course.  Currently, the sensors connect to the microcontroller in the remote control panel using RJ45 cables and the TTL control signals travel over stereo cables back to the main control panel. These physical connections will be replaced with bluetooth links.

Slave bluetooth modules are available to allow a phone or tablet to be paired with a microcontroller. Alternately, master and slave bluetooth modules will allow two microntrollers to be paired.  As example, a battery powered microntroller inside the Voluminator housing would query the pressure sensor and send this value to the remote control panel using bluetooth. The problem is that a pair of bluetooth modules is necessary for each link.  In other words, the remote control panel would require a master bluetooth module dedicated to each sensor's slave module and another for the main control panel, four in total. While this would work, I prefer to wait until a simpler solution can be found.


  1. Make me a beer bitch!!!!! IT's been months

    Good work buddy

  2. Your a rock star!! From your sister :)