Brewculator Final Report Terry Knowlton CSci 4237/6907: Fall 2012
Summary: People have been brewing beer for thousands of years. For most of that time, the process was performed on a much smaller scale and without a lot of the production line type of efficiencies that are done by macro and micro breweries today. The homebrewing hobby is still enjoyed by many modern day beer lovers. There are many steps in the process, all of which need to be followed with a fair amount of precision to avoid ruining a batch. Some of the precision may be measurements, conversion of ingredients, or providing proper ratios of additives to ensure thorough fermentation and sufficient carbonation levels. Also many aspects of the beer must be calculated based on other factors of either the pre or post fermented product or both. These conversions can be found and performed in various locations online or from formulas out of a reference book. Brewing locations are often not a convenient place for a computer with internet access or to drag large books around to. Brewculator will help the homebrewer in aggregating and performing many conversions for them. Also Brewculator will be able to assist brewers with recipe planning. A batch of homebrew needs to be planned out before even starting. The properties of grain and hops can provide a good approximation of potential fermentability and bitterness from hop additions. Technical Overview: Brewculator has been developed for the Android operating system. I had originally thought to create an application with broad usability between version. However after researching further into certain features and layout paradigms, I decided I wanted to use features that were not available on the earlier versions of the SDK. After looking at the updated android version table provided by google, I decided to work with android version 4.0+. Android 4.0 and up is steadily gaining in penetration to the market and now represents over 25% of the android devices. Ingredient data was preloaded into the application too allow full functionality even without convenient internet access. As the availability and variety of ingredients do not really change, static data is not a concern as it should not have to often be updated. I had intended to work with an SQLite database originally, but the time for setup and the overhead that the implementation posed did not seem to be necessary for the generally small amount of data management required. I opted instead to populate and format a JSON object to store the static ingredient data in a flat text file. The only overhead with this is parsing the json data on loading of the relevant screens, but the json parser is quick and there is no noticeable latency associated with this.
App Layout: Splash and main screens: Initial application load takes you through the splash screen and to the main activity layout. This initial layout provides you with links to the main features of the application. The menu bar across the top of the main activity and other layouts of the application is something exclusive to newer versions of android and makes the navigation between pages more robust and helps to keep similar looking layouts. The settings menu at the top is on all screens and provides the ability to switch between English and Metric units.
Recipe Planner: The recipe planner allows you to select a variety of ingredient items and list them together to help plan out a future recipe or keep track of a current recipe you may be working on. Once an ingredient is selected, some additional information is shown in the listing depending on the type of ingredient. Fermentable ingredients show their color rating in degrees Lovibond. Hops show their average alpha acid percentage. Yeasts show their approximate attenuation rate (% of sugars that are converted to alcohol by the yeast). Delete buttons on the side allow you to remove items that have already been added to the recipe. Adding new ingredients is as simple as selecting an ingredient type from the top left most box, which will then populate the drop down list of items in the top right of the screen. Numbers of ingredients are included in the below result window. Future enhancement considerations might include some on the fly calculations of IBU for hops bitterness or SRM for the expected color of the batch to be brewed. Given amounts ingredients and planned batch size some other items such as expected gravity level could also be computed.
Calculators and Conversions: A prime motivation for this application was the need to constantly look up conversions and calculations of certain ingredients or factors of a batch. The 4 conversions added into this section should be helpful to any brewer regardless of their experience or brewing style. ABV Calculator: The ABV calculator calculates alcohol by volume. The alcohol content of a batch of beer can be measured by comparing the gravity reading (amount of sugars in suspension) of the batch of beer before and after fermentation. The formula to calculate ABV of beer is: ABV% = (Original Gravity - Final Gravity) * 131 Gravity is calculated with a device called a hydrometer that can value how much sugar is in suspension based on the amount of buoyancy of the instrument in the liquid. As the yeast ferments the sugars, the amount of sugar converted to alcohol can be converted. Priming Sugar Calculator: For the homebrewer who does not keg their beers, but instead chooses to individually bottle the final product, the bottle priming calculator provides a great tool during the bottling phase. Bottle priming entails that additional sugars are added to the fermented beer before bottling to provide a very small secondary fermentation from yeast still in suspension within the beer. This later fermentation is performed in the sealed bottle and the resulting CO2 is trapped in the liquid and provides the carbonation in bottle. One must be careful
though, as too much sugar can cause an excess of pressure to build and cause bottle bombs where the CO2 level is too high and even the glass bottle can not contain the pressure produced. This is why an accurate calculation for adding the finished product is especially important. The formula for calculation is below. Desired carbonation of beer in Vols of CO2 = Carb-flat-beer + (1/1.96) * (Fermentability of primer) * (mass of priming sugars, in grams) / (volume of beer in liters) Fermentability of the priming substance is a known value for specific priming sugars, such as corn sugar or table sugar. Carb-flat-beer is the carbonation still in suspension of the beer post fermentation and it can be calculated with the below formula. Carb-flat-beer = (Phead+1.013)*(2.71828182845904^(-10.73797+(2617.25/(Tbeer+273.15))))*10 where Tbeer = final temp of fermented beer in Celsius Phead = head pressure on the liquid beyond atmospheric pressure. Common priming substances used, and displayed by the application, include corn sugar or dextrose, table sugar or sucrose, and light dried malt extract. Grain to Extract Conversions: One of the simpler conversions, yet still important to brewing is that of grain to extract conversions. Some brewers use all full grains and steep their grains in hot water for a period of time where other brewers just use pre soaked extracts to help streamline and simplify the process. Because all recipes are written by different people, you often need to convert grains and extracts one way or another. The conversion from grains to extracts is below. 1 part grain = 0.75 part Liquid Malt extract = 0.6 part Dry Malt extract IBU Calculator: IBU, or International Bittering Units, are the measure of bitterness in a beer. IBU calculation is based off of hops and their amounts used, and how long they were introduced into the boiling beer before it was cooled for fermentation. The calculations for IBU is below. IBUs = decimal alpha acid utilization * mg/l of added alpha acids The decimal alpha acid utilization is the amount of the hop bitterness that comes through
during the boil. A large portion of this is due to the length at which the hops are boiled. Many use static tables for doing on the fly calculations, but I chose to implement the calculations into the formula. The calculation for decimal alpha acid utilization are below. decimal alpha acid utilization = Bigness factor * Boil Time factor Bigness factor = 1.65 * 0.000125^(wort gravity - 1) Boil Time factor = 1 - e^(-0.04 * time in mins) / 4.15 And the calculation for mg/l of added alpha acids is below in both metric and english units. (metric) mg/l of added alpha acids = decimal AA rating * grams hops * 1000 / Vol in liters (english) mg/l of added alpha acids = decimal AA rating * grams hops * 7490 / Vol in gallons There are a variety of different formulas that give different IBU values. It should be noted that without being sent to a lab for analysis there is not a definitely accurate method for calculating IBU values as depending on a variety of factors some calculations will be more accurate for certain scenarios than others. I chose this formula to calculate IBUs as it was the most complete in trying to fit a best curve amongst a handful of different formulas. References and Online resources: Despite the use of local conversions and calculators, there are still times a homebrewer must seek information outside of the basic tools provided here. Whether it be additional advice or ingredients, some links to popular and useful online resources have been made available.
Web resources are a group of links to web forums and other good informational sites about the brewing process. Homebrew suppliers provides the user with some of the more popular online sellers of homebrewing products and also provides a quick link to search for a local homebrews store through google maps. Conclusion This project was one I felt motivated about because I enjoy homebrewing in my spare time. It was not without many unexpected complications however. For example, I had planned to use SQLite database for data storage, but the setup and management for some simple static data turned into far too much overhead for what I was intending to use it for. While I am sure it is a usable SQL implementation for the Android OS, it does not seem as user friendly as other database implementations as far as setup and data persistence. In the end a flat data file just made more sense for use with the application. Also the issue of formulas was something that took a great deal more research than I had expected. The ease with which some calculators are available online made me think that making something similar on an application would be no trouble. However I found that many of the formulas being offered up from a variety of web resources were often not accurate to anything more than a generalization of the specific formulas. Often times they would make assumptions on what information you should have available ahead of time. As this application should be able to function without a large set of reference tables, I wanted to program all formulas to work on the fly with a limited initial set of data. This caused me to dig deeper into formulas within other formulas and some more obscure calculations that were used to populate the reference tables that are used by a lot of other online calculators. Additionally, consistent ingredient information proved difficult to obtain in any sort of parseable and easily useable fashion. Given the variety of ingredients that are available to homebrewers, there is a lot of data points that can be used to predict and calculate certain aspects of a batch of beer. As homebrewing is something that is not generally technical in nature and has been around far longer than modern computers, a lot of this data is stored in older mediums or written on paper in an assortment of books making it more difficult to assimilate with current technologies. All in all this was an enjoyable project and I hope to use this app further in my future homebrewing endeavors.