In this post I would like to tell you about our homebrew experiences and give a picture about what we did and why. This article introduces you to the world of brewing, then continues with the deeper technical details.

Please note, that this project is not developed and maintained directly by RisingStack, RisingStack only took part in engineering. Brewfactory is a project by Péter Márton (yep, that's me!) and Balázs Kovács (Brewer, MD.).

Beer brewing

Home brewing has become a fruitful hobby for beer enthusiasts in the last decades. Since the legal boundaries in Hungary have vanished in 2012 it also became possible for us to brew our own batches.

Beer brewing might look complicated from an outsider's perspective (especially if you think about large scale commercial brewing with never-ending lines of shiny tanks and pipelines) but the basic principles behind it remained the same from thousand-year-old recipes to modern commercial brewing.

As we all know beer is basically made from water, malt and hops with the help of some heat and lots of yeast.

hops

Yeast produces alcohol from so called fermentable sugars which is only available in low quantities in malted barley. To produce more fermentables from starch (that is the main energy storage of all cereals - and is a sugar polimere) we need to potentiate the enzimes that are readily available in malted barley, especially alpha and beta amylases that are responsible for breaking down starch into smaller (two component sugar molecules).

Each of these enzimes have an optimal pH level, substrate level and especially optimal temperature level, where they work with the highest efficiency. Additionally alpha and beta amylases have a different potential of producing unfermentable byproducts (these are sugars too), that are responsible for mouth feel, sweetness and body. So here with the temperature is where you want to be punctual.

If you want to brew the same brew again, that you and your buddies were so fond of last year, you have to use the same ingredients (Weyermann and their competition got this one covered for you) and go through the same temperature phases in the brewing process as you did last time.
(Same amount of the same yeast and similar fermenting temperatures are also necessary.)

To keep these exact temperatures, all commercial breweries turn to automation. In larger systems, but even at the size of 20-30kg batches keeping the temperature as close as 0,5 degree of Celsius with a bimetal thermostat is not easily achievable. This is why you need a system that counts with overheating and shuts down the heating unit way before the desired temperature, and let heat conduction and residual heat to push the temperature probe up on those last degrees.

There are many brewing setups that can help you make great beer (check out the HERMS systems designed by a NASA rocket scientist). You can easily brew beer in an old cauldron, but for reproducibility you need at least a partially automated system.

Brutus 10
Brutus 10, source: alenuts.com

After a brief experimentation with traditional gas stove and pot, we have chosen an electric brew in a bag setup for ease of use, small size, low price and easy automation.

As we have mentioned before we operate an e-BIAB system, a spin-off of the Braumeister concept. For easier maintenance and handling, we decided in the beginning, that instead of constant stirring of grains with water, hot wort should be sprinkled on the top of the grains. As it flows down the grain "sandwich", it washes out our precious soluble sugars. The wort that is separated from the grains with steel mesh basket is constantly heated by the precisely controlled heating elements. The circulation is maintained by a high temperature pump.

Our brewer

Brewfactory

After our first experiences, Balázs and I founded Brewfactory. Our goal is simple: sharing our knowledge and open source what we did, to make the experience of beer brewing reachable. Because drinking your own beer is super cool ;)

About the team in nutshell:

An IT engineer and a med student walks in to a bar. They get disappointed by the corn infested MegaBrews, so comes the motivation to put up a fight.

Brewfactory logo

Looking for a device

After we have decided that we automate our brewing process we started to look for options. We wanted to focus on the brewing part and make it easy and fun. Instead of buying an existing solution, we wanted to know our system from the inside out and keep it affordable.
We wanted to build our own brewing machine as soon as possible with the possibility to improve and extend it later.

We were looking for a hardware which is capable of:

  • controlling the relays that switch heating elements
  • reading the temperature
  • connecting to the internet via Wi-Fi

So we wanted to have an Internet of Things (IoT) device.

IoT, what we did

#1 BrewBerry

Our first choice was the RaspberryPi which is a linux-based mini computer. The reason was simple: we were familiar with unix-based systems and had some rPI experience.

RaspberryPi

It is easy to setup the prepared linux image file to the SD card and install some debian packages. We have chosen Node.js to control the brewing - the hardwares communicates via unix pipes with the Node.js application. It fires up a server with some AngularJS UI and is reachable in the browser from the same network.

We named the project Brewberry, the codebase is available in the Brewfactory GitHub organization. You can find the detailed instructions how to setup the project from a clean Raspberry Pi: Zero to IPA

#2 BrewCore

We had a big problem with our Raspberry Pi-based Brewberry solution: when a power outage happened, it made the SD card corrupted and we could not continue the brewing. When it happened the second time we decided to drop the Raspberry, and started looking for Arduino-based solutions. Finally we have chosen SparkCore because of their super easy cloud integration.

SparkCore

Because SparkCore is fully compatible with the Arduino world we could easily connect some open source C++ libraries together to control the relays with PID and read the temperature. We moved the Node.js server application (the brewing logic) to the cloud (currently Heroku), that communicates with the Spark cloud via a REST API and Server-Sent Events.

We call the project BrewCore, you can find the code in the Brewfactory GitHub repository. We shared the code of the Spark side too: spark-core-pid-temperature

Brew you beer with our DEMO ;)

Yes, you can sous-vide, brew jam or a giant tea with this stack too...

The Stack

BrewCore project have three main components:

1. Hardware
(SparkCore, cloud, Solid-state relays (SSR), DS18B20, heating-wire),
2. BrewCore (Node.js, WebSockets, MongoDB)
3. User interface (Twitter Bootstrap, AngularJS)

1. Hardware

We have two pieces of 2-KW heating elements which are connected to two solid-state relays (we use SSR because the PWM requires it). The relays are connected to the SparkCore with the DS18B20 temperature measuring device. We store only the target temperature on the device. The system tries to reach and keep this temperature.

The hardware part of the brewing system does only four simple things:

  • measures the actual temperature of the liquid
  • calculates the actual output with a PID controller*
  • controls the relays with the built-in PWM
  • sends data to our BrewCloud

*(PID controller: how much power do we need to reach or hold the point temprature)

brew tank

2. BrewCore

This is a Koa based Node.js application which communicates with SparkCore cloud and controls the brewing phases. It also collects logs to the MongoDB database.
BrewCore uses WebSockets to communicate with the interface and the BrewMobile iOS client.

You can install and run BrewCore locally with the built in hardware emulator. It uses the liquid-pid NPM module to simulate a real environment.

architecture

3. User interface

The interface is currently part of the BrewCore project. It uses AngularJS and Twitter Bootstrap. It is responsive and capable to visualize the previous brews. It operates as your dashboard where you can set the brew phases and control the brewing.

BrewCore logs

BrewMobile

It was important from the beginning to have an interface where we can easily monitor and control the brewing process, from anywhere, without a computer. We followed the mobile-first approach and created a responsive web interface for our application.
Later when Ágnes Vásárhelyi joined our team she developed an iOS application for the Brewfactory, we call it BrewMobile. It is written using Swift and uses WebSockets to communicate. You can get the code here.

BrewMobile

Future

We have a vision about the future of the Brewfactory project. We would like to create a well modularized (separated open source modules) brewing platform where people can easily connect their IoT devices to a BrewCloud and brew their own beers.
It would be also great to extend this cloud with recipe and tips sharing, and turn it into a platform where homebrewers can share their experiences and knowledge.

Monetize?

Lots of people haves asked us why we did not productize our brewing system.
Honestly it would be really fun to build a brewing startup, but: building a hardware startup is especially hard, there are so many open questions about how we can do it, to keep it affordable for everyone.

Malting

Join us

Are you interested in @Brewfactory?
Join us as contributor on the Brewfactory GitHub.

If you want to try BrewCore out, you can play with the BrewCore DEMO.

I would like to thank Balázs Kovács for helping me to write this article.