SALES INQUIRIES: 1 (888) 767-9864

Homebrewing with Arduino :: Student Project

Ever done any homebrewing?  If you have, it’s hard not to have Arduino pass through your mind as a tool to help in the process.

The following Arduino homebrew project is the result of a ton of hard work and dedication from one of our customers, Klas Bergman.

Klas has used an Arduino Mega, temperature sensors, SD card reader, LEDs, an ethernet connection, (and more) to make one heck of a fermentation control and monitoring system – and did I mention he sends the data to ThingSpeak?

(Below is Klas’ description of the project verbatim,  I did add some headers to break it up.) 

An Obsession with Fermentation…

Ever since I started brewing beer at home I’ve been obsessing over the fermentation stage of the process, since it is crucial to the taste and quality of the finished product.

I used to stand by the airlock with a stopwatch counting bubbles and taking notes. And I found it very frustrating to be in the dark about the temperature of the fermenting beer as it is so important to flavor control.

Warmer temperatures favor ester production for example. And if I succeed in brewing an awesome batch, I want to be able to brew it again and again.

Electronic workbench with soldering iron poised for work

That proves to be pretty difficult if you’re not in command of such an important parameter as temperature is. A couple of years ago I bought an old fridge and a thermostat just for gaining more control so that was a big step in the right direction.

But still, I found it frustrating to not know the exact temperature at all times. I know, it’s pretty wierd. 🙂

Arduino to Control, Log, and Monitor a Homebrew….

When I got into Arduino I started looking for a way to gain that control and to log the values automatically and preferably save it on my computer or at least to an SD card.

To write temperature to an SD card and even publish the data on the internet proved to be pretty easily accomplished using an ethernet shield.

And I was not the first (as is most often the case) to be interested in a bubble counting device.  A couple of other people had been successful in building just that. Here and here are two examples.

They use a photo gate to detect bubbles passing the airlock. I could not think of a better way myself so I got one too. The interrupt in my code, regarding the bubble counting part, is taken from here so the credit goes to them.

glass tubbing and a temp sensor being help against it with modeling clay

I found a good box to enclose my airlock and all of the electronic components and used some of my daughters modelling clay to mount the airlock to the frame of the box in just the right place.

More Cowbell LEDs

I made a hole for the LCD and dove right into the (for me) challenging soldering job, connecting all pins on the LCD and all the LEDs to the arduino.

Yeah, right, I didn’t mention those. I included a bunch of LEDs. More than I needed.

For sure, I could communicate all relevant messages through the screen, so why include LEDs at all?

Well, just because I’m having some fun with this so why not include a bunch of LEDs? I also added a button to be able to change what is displayed on the LCD.

Arduino Home brewing enclosure with LCD and 7 LEDs

Right now, when pressed, it toggles between displaying the current temperatures and displaying how many bubbles that has passed the airlock so far and the present bubble count / minute. Oh, and I also added a piezo buzzer to audibly warn me if the temperature runs too high.

Arduino Mega to Handle all the Brew

I use an Arduino Mega in this project because I have no less than seven libraries in the code. When I tried using an UNO I ran out of memory.

I use two DS18B20 with the onewire library and I’ve calibrated them to a third, expensive and very accurate thermometer.

Actually, one of the DS18B20 was spot on but the other one was off by half a degree so I account for that in the code. One of the sensors measures the temperature of the air inside the fridge and one measures the temperature inside the tank.

I am very meticulous about keeping other organisms out, other than my yeast strain, which is an occupational hazard from working as a microbiologist for many years I guess, so I won’t let anything touch my beer at any time before the beer is to be had.

This means that I can’t have the DS18B20 hanging down into the wort. So I drilled a hole in the side of the tank and installed a well where the sensor fits.

LEDs to Indicate the Yeast Temperature Preference

There is one multi colored, one red, one blue LED and then there are four green ones. The multi colored one changes color based on the yeast strains preferred temperature range. So that is something I have to change in the code in between brews.

I’m thinking about rewriting it so that I can choose the temperature range with the button. Perhaps I’ll have a database that holds a lot of strains that I can choose from.

So when the temperature inside the tank is on the cold side of the strains preferred temperature range, the light is bluish and when it is on the hot side, it is reddish. In between it is of course green.

The red LED is lit only as long as the yeast is in it’s lag face. That is in the beginning of the fermentation cycle when no carbon dioxide is being produced. When the first bubble passes the airlock the red light is turned off.

The green LEDs does not have any function right now. I believe that there is a possibility that I can predict where I am in the fermentation process based on the bubble count. If that is the case, then the green lights could be lit one by one as the fermentation progresses until completion when all green lights could be lit.

The blue LED is turned on when the temperature in the tank falls below 2 degrees Celsius. When does that happen?

Well, when the fermentation is completed I turn on the fridge full time to lower the temperature as much as possible. It is for clarification purposes and it is called “cold crashing” the beer. So when the blue light is turned on I’ll know that it is time to transfer the finished beer to a keg.

Brew IoT with the ThingsSpeak app

I was very happy to find It is super easy to upload sensor output to a channel. They let you update as frequently as every 15 seconds and they do all the graphing for you. At any time I can whip out my phone and see what’s happening right now in the thingspeak app. I love that kind of thing!

numbered graph showing a noisy curve

For the Future

I’m pleased with this fermentation monitoring device but I do want to give it control over the temperature in the fridge.

So that is what lies ahead for this project. If I do that I could for example have it induce a cold crash on it’s own when the bubble count is low enough.

Since I don’t want to meddle with high voltages I’ve bought a remote controlled outlet from Nexa and I mean to hack it and give the Arduino control over it.

I’ve included some photos of my efforts 🙂 and my code. It is far from perfect. And I even have some hard-coded values in there I’m ashamed to admit. I did listen in class, I promise!

I’ll clean up the code when I’m done with it – I mean when it controls the fridge and I have a one button menu in place.

A link to my thingspeak channel:

You can also check out a video of the setup here.

Arduino Code:



  1. Avatar JohnnyFRX on October 30, 2017 at 10:14 am

    That’s about the coolest thing EVER man! Nice work. I’ve messed with beermaking via MRBEER on occasion and that was fun as it was. You’re on a WHOLE ‘nuther level of awesome goodness here. I use the DS18B20’s to track/regulate the temp’s in our Reptiles vivariums with relays and heating devices. Nice sensors to work with, especially with the adjustments available for resolution.

    • Avatar Klas B on November 1, 2017 at 7:26 am

      Thanks! It was a lot of fun putting it together. After this, I’m constantly thinking about and trying to work out if I could automate some of the other stages of the brewing process. There are so many fun sensors to play around with. Solenoid valves, water flow sensors etc. I just wish extra spare time was as available for purchasing 🙂

  2. Avatar MICHAEL JAMES on October 30, 2017 at 11:14 am

    Beer is pretty close to my heart, so this project hits home for me. I didn’t realize that ThingSpeak had an App too – I have always just used the website. I look forward to checking that out. Nice work Klas!

  3. […] where one of our students uses the millis function in their own project? Check out the “Homebrewing with Arduino” post which is […]

Leave a Comment