Talks
How Ruby makes Better Beer
Summarized using AI

How Ruby makes Better Beer

by Andrew Nordman

In the presentation titled "How Ruby Makes Better Beer," Andrew Nordman explores the intersection of brewing craft beer and Ruby programming. He introduces the brewing process and discusses how automation, temperature control, and recipe analysis can enhance beer production. The session emphasizes the blend of art and science in craft brewing, highlighting Nordman's experiences as a home brewer and the founder of a nano-scale brewery, Cadman Brewing Company. He shares personal anecdotes about his brewing journey, illustrating the learning curve of transforming initial failures into crafted beers. Key points include:

  • Introduction to Home Brewing: Nordman began brewing in 2010, motivated by the blend of programming and creativity involved in the process.
  • Automation and Consistency: He emphasizes the need for consistency in brewing and how automation can help manage human errors that affect recipe outcomes.
  • Raspberry Pi Utilization: Nordman discusses creating a brewing control system using Raspberry Pi for its cost-effectiveness and compatibility with Ruby.
  • Recipe Development: The process of creating beer recipes involves selecting grains, hops, water profiles, and yeast, followed by meticulous monitoring of temperatures during brewing and fermentation.
  • Software Contribution: He presents Brew Lab, an application that tracks recipe data and brewing conditions, and integrates with brewing equipment for improved efficiency and consistency.
  • Advanced Brewing Techniques: Nordman describes a Heat Exchange Recirculated Mash System (HERMS) and the automation benefits it offers, including temperature management through a PID-based system.
  • Future Innovations: He outlines plans for expanding Brew Lab's capabilities and incorporating additional automation through solenoid valves and more complex systems.

In conclusion, Nordman illustrates that combining Ruby with brewing can lead to innovative approaches that enhance the brewing process and product quality, highlighting the potential for broader community engagement through accessible software. He encourages discussions about brewing paired with a casual pint, showcasing a passion for both software and craft beer.

00:00:20.480 First up, I'm glad that I'm speaking right before lunch because it gives enough time for people who have had enough alcohol that any mistakes I make in this talk will be mitigated. How many people here are fans of beer? If you don't raise your hand and you're at this conference, I'm a little confused. Okay, now how many people are into making their own beer and home brewing? Not a huge amount, but that's okay; I'm prepared to give you a four-hour lecture on how home brewing works and why it's fantastic. Unfortunately, they've only given me 30 minutes, so let's begin.
00:00:56.879 As mentioned, I am Andrew Nordman, and I like two main things: Ruby and beer. Ruby is great, and beer is great. So what happens when you combine Ruby and beer? There's only one possible picture that can describe how I feel about my two passions. That is it. What I want to talk about today, and part of the reason why I started all of this, is that I began home brewing in 2010. A friend of mine said, 'Hey, you need to start making beer.' I said, 'Hey, I don't like beer.' He said, 'Okay, here start making beer.' I was very confused as to why someone who knows that I don't like beer wanted me to make it. After making my first batch, which was terrible, and my second batch, which was also terrible, I finally realized that there's more to this than just throwing a few things together and hoping for the best. I really started getting into the process of home brewing and found it to be a beautiful combination of programming and creativity.
00:02:08.000 As of last year, I started my own brewing company, Cadman Brewing Company. We are a nano-scale brewery, which means we make less than seven barrels per batch, approximately 217 gallons at a time. Much larger micro-scale operations typically produce at least that or considerably more. We are currently in the process of getting licensed to sell, so for now, all I can do is sit around making beer and working on recipes—it's a terrible, terrible job, but I’m up for the challenge.
00:02:43.840 Craft brewing is the blending of art and science. You have the art and creativity of creating these recipes and taking a single concept or a few key characteristics of a particular recipe or idea, and then you blend that with the science of extracting sugars to achieve a final result that can be reproduced consistently. What I ended up doing was implementing all of this automation into the home brewing process. One of the main problems that arise when dealing with recipe design is the need to consistently monitor what you're doing when making a batch. If I put in the same ingredients in two different batches and want the same recipe, I need to control all of the human errors that tend to crop up.
00:03:12.879 To overcome the problem of reproducibility, I automated the process. One of the things that I did was take a Raspberry Pi, which I had sitting around because I thought it was cool. I initially picked one up and said, 'Great, now what do I do with such a small computer that doesn't do anything?' So, I started writing some software to help brew and when I began discussing this with others, I was asked, 'Why a Raspberry Pi over something like an Arduino?' People suggested focusing on lower-level mechanics. The main reason is that Arduino boards are expensive, whereas Raspberry Pis are cheap, and I like using Ruby which can't be directly implemented on an Arduino.
00:03:53.640 Let's get back to how to go from coming up with a beer idea to finishing the beer and being able to drink it. The first step is creating a recipe. Recipes begin by defining the style and characteristics I want to achieve, whether it’s a ridiculous IPA or a very bitter dark beer that evokes flavors of s'mores. You then start selecting your grains, hops, water profile, and yeasts – ingredients that blend together to create a final product. After planning how it's going to ferment, you take temperatures into account so the yeast can operate at maximum efficiency, followed by carbonating it because flat beer is unenjoyable.
00:04:50.560 Software has already started to help improve recipe creation with software like Beersmith, which calculates how much sugar you can expect from a specific batch based on your equipment and brewing methods. Some people think Beersmith is somewhat outdated, but there's simply too much mathematical analysis that has gone into software helping design recipes for me to reinvent the wheel. As you can imagine, there’s plenty of other technology I've had to create myself; reinventing Beersmith wasn’t on my agenda.
00:05:45.360 When creating recipes, it's essential to take detailed notes. Each time you brew a batch, track the flavors and any temperature variations. Consistency in both temperature and duration is crucial during brewing and fermentation. Recording observations like temperature drops or overly aggressive fermentation helps shape future recipes. Think of your recipes like applications; you need to actively monitor and engage with your brewing equipment to ensure everything operates effectively. Seriously, I cannot stress enough the importance of logging everything, especially considering how much better it will aid you in crafting recipes in the future.
00:06:34.400 I ended up creating an application called Brew Lab which picks up where Beersmith left off. Beersmith creates your recipes and gives you the overarching concepts, but does not delve into how individual batches work or the adjustments made during brewing. You might find that after batch number seven, the enhancements you've made led to a product you dislike, while batch number four was your favorite. Brew Lab imports Beersmith recipes and maintains the association of batches with recipes, storing all your times, temperatures, and observations to provide an easy way to check your references.
00:07:14.560 Brew Lab also comes with an API allowing it to integrate with brewing equipment. If you have a system capable of integration, you can set things up to automatically send information back to your lab. To start with this process of integration, I created Brewscribe, which is currently open source. Brewscribe takes exported files from Beersmith and imports them into Ruby, converting them into ready-to-use Ruby objects. This allows Brew Lab to access and manipulate your recipe data easily.
00:08:00.479 Now, regarding the brewing process itself: One of the most advanced systems is called a Heat Exchange Recirculated Mash System (HERMS), which consists of three vessels. You fill the first tank with water, which is heated with an element. The second vessel, called a mash tun, holds the grain where the heated water is pumped and recirculated through it. This setup ensures that the temperature is consistent during the mashing period, which lasts for 60 to 90 minutes, allowing sugars to be extracted from the grains and converted into a sweet liquid.
00:09:21.600 Once the mashing is done, the liquid is transferred to the boil kettle for boiling. This stage is crucial, where you begin to introduce hops for flavor and bitterness. Automation during this phase is also paramount, as it helps remove unwanted off-flavors. If you've ever tasted beer that has a sweet corn smell, that's a sign that the boiling process wasn't executed properly, hence the importance of consistency.
00:09:38.760 Here, Ruby comes into play. Ruby runs on MRI 1.9, and I am currently in the process of porting it over to MRuby while incorporating new features to enhance the system. It handles various brewing styles including HERMS and another version called RIMS, with adjustments being made directly by integrating with the Raspberry Pi. Each system utilizes temperature sensors to relay the data, which aids in managing the brewing process effectively.
00:10:44.800 The automation allows me to manage the temperature control through a PID-based temperature management system called Tempur. It utilizes readings from temperature sensors, taking input from previous readings to regulate power output for heating or cooling. This ensures that the water temperatures necessary for various processes are maintained accurately. The beauty of this method is that it can be used for both heating and cooling during fermentation processes.
00:11:54.679 The PID algorithm calculates the appropriate rates and outputs needed for consistent results. For instance, if the output is 700, that means the heater will only be on for 700 milliseconds every second, ensuring continuous and stable temperatures. However, when it comes to boiling, manual intervention is still essential to maintain consistent boiling rates. By using pulse width modulation, you can adjust how quickly the heating element operates, creating efficient and effective boiling management.
00:12:55.680 Another advantage of this entire system is the integration with Brew Lab. Recipes are pulled from Brew Lab, allowing automated adjustments based on the brewing recipe during the entire process. The system will inform you when it's time to add hops or other flavorings, effectively streamlining the brewing process. This integration allows for constant data collection, enabling better future iterations of recipes based on previously brewed batches.
00:13:40.240 The operation is quite manual at the outset. Simply filling the hot liquor tank and heating it up to the desired temperature initiates the first steps of brewing. You keep an eye on temperature alarms, add your grains at the appropriate moment, and engage in a bit of waiting while the mash process takes its course. Once the mashing is done, you will transfer the liquid into the boil kettle, wait through the boil process, and finally transfer it to a fermenter, setting the stage for fermentation.
00:14:15.280 Fermentation is largely about maintaining specific temperatures over an extended period. Depending on the yeast strain used, various strains need specific temperatures. Typically, ale strains perform best between 60 and 72 degrees Fahrenheit, while lager strains may prefer cooler environments ranging from 32 to 55 degrees Fahrenheit. Automation systems here help facilitate managing these temperatures effectively, ensuring high-quality fermentation.
00:15:14.320 The use of Raspberry Pi also allows for enhanced control throughout the fermentation process, given its ability to handle various sensors, though it does have limitations compared to other systems. As you begin scaling up, you may decide to utilize Arduino for more complex automation tasks that require low-level hardware interfacing, such as with temperature sensors. Both systems can complement each other, enabling effective brewing processes while maintaining the quality of beer.
00:16:09.440 In the long term, I'm planning to expand the system to include solenoid valves for even quicker automation and ease of use. On top of that, transitioning Ruby over to an I2C system could present more opportunities for complex functionality. The future includes plans to build a much more extensive brewing control panel capable of handling much larger scales, accommodating the vast array of ideas I have for brewing.
00:16:58.720 While I am working on those systems, I am also opening Brew Lab to the public. I want the software to be accessible and free, with hopes that I can make it public by April 1st. This will enable an array of users to connect to and utilize the software through the Brew Lab API, allowing even more automation and easy access to data collection and monitoring for brewing processes across the spectrum.
00:17:53.440 That's a lot of information to digest all at once, and I appreciate your attention thus far. The synergy between Ruby and brewing can inspire fantastic results if applied effectively. If anyone wants to discuss brewing or Ruby further, let’s connect over a pint first and then have a productive conversation!
Explore all talks recorded at Ruby on Ales 2013
+12