Introduction: Arduino Homebrew

About: I work with computer networks services and security. My main hobbies: homebrewing, woodworking, electronics.

When Since I was a teenager electronics is my passion. It was some time ago and I can tell you that things are quite better now to the ones that want spend some time playing with components and a solder (or no solder at all, if you use a protoboard).

My second passion was programming computers. At that time we had C, Pascal, Cobol. There were no graphic screens and a mouse was something quite useless.

Ok, I grew up, found my beloved wife (my greatest passion), I got married, I had kids.

I came to know Arduino a few years ago, maybe three or five years ago. A friend called me to attend a one day hands on course. I remembered my teenager days arranging resistors, transistors and capacitors trying to make some leds blink in a sequence. So I made some similar thing with Arduino, but in only a few minutes... and I was able to easily change the sequence, the frequency. Arduino is easy, C like programmable, it's versatile and it's cheap! The course was great, but Arduino didn't came to be a passion - I didn't hava any practical use for it at that time.

About two years ago I found another passion: making craft beer at home. In this time I brewed a couple dozen beers by my own, some were great, some were barely drinkable.

To make a good beer a lot of things need to be ok, from the ingredients to the process that must be followed. When you make a good beer, you'd want to repeat it, but it only will be possible if you have the same quality of ingredients and follow the same process.

Getting exactly the same ingredients each time may be difficult for a homebrewer. But controlling the process, on the other hand, it's a challenge to be achieved.

Thinking about this "control", I decided to join passions: electronics, programming, Arduino and homebrew.

I know there're other Arduino Homebrew projects, for example Open ArdBir, but the same way there are several ways to make beer and I have mine that is different from the others, I decided to build my project.

At this first version, my Arduino Homebrew has limited funcions:

- choose basic templates for mashing and boiling, with hop add times.

- show temperature and alert if it's too hot or too cold.

- sign that a step is over and tell what do next.

- show times of each step of brewing.

It's not automation. It's helping a man making beer. Maybe it can help you too!

Step 1: How I Do My Homebrew

I've always made all grain beers. Probably because here in Curitiba it's easier and cheaper to use grains than extract.

I brew using stockpots, high-pressure cookers, buckets and so on, in a completely craft way.

These are the basic steps:

  1. Choose, make or adapt a recipe
  2. Buy the ingredients
  3. Prepare equipament
  4. Add water to a stockpot and warm it up to a certain temperature
  5. Add grains
  6. Let the mash rest for some time, increase temperature.
  7. If the recipe profile requires, repeat step 6.
  8. Increase temperature to 76ºC and rest for some time.
  9. Recirculate (this process is known by its German name vorlauf)
  10. Lauter (or lautering)
  11. Boil the wort for a certain time, adding hops as recipe requires and Irish moss.
  12. Reduce the temperature (chilling).
  13. Do a “whirlpool”
  14. Rest for a little while
  15. Transfer wort to fermenter and add pour (pitch) the yeast.
  16. Let yeast work for some days in a controlled temperature place
  17. Purge the yeast sediment
  18. Add Primming
  19. Put it in bottles
  20. Wait some days for primming to work
  21. Cool and drink

My Arduino Homebrew helps me from step 4 to 13.

I need to say: this is the way I make beer, probably different than your’s way. Feel free to adjust the Arduino code for your needs.

Step 2: The Project – Hardware

Parts needed (AliExpress approximated prices)

  • Arduino UNO (UNO R3 MEGA328P - US $4.30)
  • 20x4 LCD text module (US $5.40)
  • Serial/parallel I2C interface (1602 2004 LCD Adapter Plate IIC - US $2.00)
  • (You can find LCD modules with the serial interface alerady soldered.)
  • DS18b20 temperature sensor (Stainless steel package Waterproof - US $3,40)
  • KY-040 rotary encoder module with push button (US $1.50)
  • Common Anode RGB LED (US $0.10)
  • Buzzer (US $1.00)
  • 4x 1K Ω resistors (US $0.20)
  • 2x 2.7KΩ resistors (US $0.05)
  • A protoboard (US $2.50)
  • Male to male and male to female jump wires (US $2.00)
  • 5V power supply (AC 110-220V to DC 5V 1A Power Supply - US $4.00)

The code may be set to work with a 5K Ohms and a push button instead of the KY-040 and with a thermistor instead of the DS18, but since this configuration does not give the best results, I recommend you to use the parts listed above.

If you decide to build this project for real, you’ll probably also need:

  • A (plastic) box
  • PCB universal board (US $3.00)
  • Wires
  • Knobs

The hardware part of this project is not complicated. We have really few components. Maybe the protoboard drawing above is enough to depict the whole wiring, but maybe not.



  • Wire Arduino 5V to your protoboard + lines.
  • Wire Arduino GND to your protoboard – lines.

The arduino is the "brains" of the project.

20x4 LCD text module and Serial/parallel I2C interface

  • If you bought them separated, solder the I2C direct to the LCD using the pin header connector that comes (should come) with the I2C.
  • I2C pins are GND, VCC, SDA and SCL.
  • Connect GND and VCC to your protoboard – and + lines
  • Connect SDA and SCL to arduino SDA (A4) and SCL (A5) pins.

Shows the current stage of mashing, times elapsed in the total process and in each step, current and target temperatures and messages telling you what to do next.

DS18b20 temperature sensor

  • Connect the power wire (red) to + line.
  • Connect the ground wire (black) to – line.
  • Connect the data wire to Arduino digital port 8.
  • Put a 2.7KΩ resistor between the power and the data wires.

This is a very precise digital sensor. Should be kept inside the liquid you're working with. To avoid plastic parts to have contact with the wort I put it inside a aluminium tube, but keeping the sensor (metalic part) free.

KY-040 rotary encoder module with push button

  • Connect GND and VCC to your protoboard – and + lines
  • Connect CLK to Arduino digital port 0
  • Connect DT to Arduino digital port 1 (important because this pin may handle hardware interrupts)
  • Connect SW to digital port 3.
  • Put a 2.7KΩ resistor between the power and the SW wires.

The rotary encoder is used to choose menu options and the push button (SW) as the "OK" button.

Common Anode RGB LED

  • Connect LED pin 1 (RED) to a 1KΩ resistor and this resistor to digital port 11.
  • Connect LED pin 2 (anode) to the + line.
  • Connect LED pin 3 (GREEN) to a 1KΩ resistor and this resistor to digital port 12.
  • Connect LED pin 4 (BLUE) to a 1KΩ resistor and this resistor to digital port 13.

The LED changes color to show alerts and status:
Red - something is wrong. Probably the liquid is too hot.
Blue - the liquid is too cold.
Bluish white - the program is waiting for an OK to continue.
Green - everything is fine

Passive Buzzer

  • Connect negative pin of the buzzer to – line.
  • Connect positive pin to a 1KΩ resistor and this resistor to digital port 9.

Buzzer will beep after a message is shown.

Some thoughts:

- Most displays use I2C Adress 0x27 but a FEW use 0x3F.

- It’s possible to use more than a I2C devide on the same wire, but it’s matter for another instructable. BTW, only one LCD display was fine for this project.

- the same way, it’s possible to use more than one temperature sensor, which could help making better measurements.

- all of the parts are available at eBay, DX and AliExpress. (I got them all from Ali!)

- you may use a parallel LCD display, without the I2C module, but you’ll have no digital port left. There’s some minimal differences between starting the LCD serial and parallel. In the program code you’ll find the parallel definitions and codes commented. If you want to change from serial, review the code and the ports assignments.

Step 3: The Project – Software

Well, the best explanation of a code is the code itself, so I could just say “read it”. But that wouldn't be nice!. So, let me write a little about the software of My Arduino Homebrew.

At first, we must bear in mind that Arduino is not multitask. By rule there's a setup procedure, where we put the code we want to run once, when the system is turned on, and there’s the ‘loop’ procedure, where we put the code we want to run repeatedly as long as Arduino is on.

Code should always be divided in functions and procedures (structured programming), to make it easy to write, read and maintain. But remember: Arduino is not multitask - if the program stays too long inside a function, other routines like reading a sensor or outputting a value will stop for a while. How to handle with this? Doing like this: enter the funcion, do what needs to be done, and exit. How to control where exactly in the job the program is? With status variables.

Take a look at the loop portion of my program and see how it's simple and clean:

void loop(){         

   if (WaitForOkButton){
       Aux = digitalRead(OkButton);
       if (Aux == LOW) {  // when pushbutton in the rotary enconder is pressed it goes LOW
          OkButtonWasPressed = true;
   switch (ActualStage) {
      case Choose    : { ProcessChoose   ();   break; }
      case Prepare   : { ProcessPrepare  ();   break; }
      case Mash      : { ProcessMash     ();   break; }
      case Lauther   : { ProcessLauther  ();   break; }
      case Boil      : { ProcessBoil     ();   break; }
      case Cool      : { ProcessCool     ();   break; }
      case Whirlpool : { ProcessWhirlpool();   break; }
      default        : { ProcessEnd      ();   break; }
   ShowAlert (); 
   if ((ActualStage <= Whirlpool) && (PreviousStage != Choose)) {

In each of the functions global variables are used to control what needs be done. Except for ProccessChoose an ProccessEnd, all of the functions enter, process and exit. If they don’t do so, DisplayTimes and DisplayTemperature, wich reads a sensor, would not work fine. Later on I’ll tell a few words about each of the program stages.

I had some problems due to the 2Mb memory limit of Arduino UNO. Because of this, and I know it’s not very elegant, I decided to use mostly global variables. Also because of this and by the fact that I use a lot of strings to show text on LCD, I needed to use the Arduino function "F" to store static strings in program memory space (flash) rather than RAM.

In the program, initial defines are used to tell arduino IDE what to compile:

  • If TEST is defined, some times are set to only a few minutes and the temperature code is replaced by a 5K potentiometer, to make debug easier.
  • If ENGLISH is defined, messages will be displayed in English, otherwise it will be in Portuguese. Tip: if you want to translate to your native language, search the code for the string ENGLISH.
  • If you use a common cathode RGB led, pleasse comment the “#define COMMON_ANODE” line.
  • Uncomment “//#define POTENTIOMETER” if you’re using the rotary encoder (recommended).

About the main program functions:


Lets you to choose Mash and boil profiles.

In the Mash menu you’ll choose the time of the mash, number of steps and temperature of each step, based on the most common profiles I used up to now.

I the boil profiles you’ll choose the time of the boil, the number of hops you’ll add and the time of each hops adding. It is customary among homebrewers to count hops times in n minutes to boil end, so if a hop is added at 60 minutes, it’s 60 minutes before the boil end. In other words: if your boil is 60 minutes and you choose a 60 minutes hop, you shoud pour it at the start of boil.

Customizing mash and boil/hops profiles will be available in the next software version.


Waits for you to pour the water and heat it until a temperature defined in the mash profile.

You need to keep the temperature sensor inside the water.


Displays temperature and time of each mash step, based on the mash profile choosen. If the mash is too hot, led will turn red, if it’s too warm, it will turn blue, if it’s all right the color is green and if the program is waiting for an OK key press to continue to the next step, the color will be “water” (bluish white).


This step will tell you to recirculate the wort for a time defined by the constant ClarificationTime (default = 10 minutes). After that you should sparge (“wash” the grains with 78ºC water). When you end sparging press OK.


The way you process the wort from mashing and sparging to boil will depend on the equipment you use.

When your wort is already boiling in the boil pan, press OK to start counting boil time.

Program will tell you to add the hops accordling to the profile choosen. It also will tell you to add whirflock 15 minutes before boil end.


When the boil is over, you’ll be told do use your chiller to cold the liquid. When it it gets down to the temperature defined by the constant CoolToTemperature (default 25ºC), you’ll be told to remove the chiller.


You’ll be told to do whirlpool for the time defined in the constant WhirlpoolTime (default = 10 minutes).

Some homebrewers do the whirlpool during the cooling process. If you’re one of them, please change the code.


When the whirlpool is over, you still have work, for example move the wort to the fermentation pot and pour the yeast, but my Arduino Homebrew will tell you that the brewing process is over and the total time elapsed from the choose profiles step.

The source code:

Step 4: Moving the Prototype to a Box

I started to prototype this project some months ago. Because the it envolves two big components, the arduino and the LCD display, I fixed everything in a plywood board. I also use a cardboad box to store the prototype when I'm not working on it.

I do not need to say that protoboards are great for prototyping. And I need not say that it is very important to make a "real" implementation of a project when it is completed. Soldering prevents bad contacts and loose wire problems ;-)

I use to buy twice the quantities I need for a project, so I didn't have to destroy my prototype to move the project to a box. This is great because I have a working copy of My Arduino Homebrew first version and still have the prototype to develop.

I bought a medium plastic box and a three pin connector for the temperature sensor, the other items I already had in stock.

One of the box's front or back parts was substituted by a piece of acrilic. It spared me the hard work of making a perfect square hole for the LCD display.

In the front of box we have the display, the rotary encoder with the push button, the RGB LED and a addicional button that's not used by now but will be used in a future software version as the ESC button.

When possible, wire connections were made directly to arduino, using male header connectors, wires solderes to the pins.

Connections to 5V and ground were concentrated in a small PCB Universal Board, connected to the Arduino whith the male conectors.

Resistors for push button and temperature sensor were placed on the PCB board, but buzzer and LED ones were placed near the components.

To power the unit I used a 9V stabilized transformer power supply that I reused from an old project. I could have used a switched power supply, but I wanted something heavy inside the box, to keep it in place during the use.

Step 5: ​What Else?

I have many ideas to improve my brewing method. They involve changing equipment and methods, methods that need to be tested and equipments that need to be bought. It takes time.

Regardling Arduino homebrew project, there's lots of things that can be done: - Connect with an Android device. This could be used to choose profiles, upload beer recipes that include profile, hops names and etc, monitor the process from the device. - Control heating process. - Automaticaly pour the water. - Control pumps to move wort from one place to another. - Automaticaly add hops. - Control fermentation temperatures. - Save log of the proccess. - ...

If you use, if you use and improve this project, please let us know!

Hurray for Instructables!

Step 6: 2017 August Update

Every single piece of software may always be improved.

I haven't had enough time to work on my Arduino Homebrew system, but since I posted the instructable, I've made some code corrections and improvements. Code still have bugs, but maybe you want to give it a chance.

Major changes are:

- Minnor bug corrections

- Corrected time display when time is greater than 59 minutes

- An intermitent active buzzer was included to sound an alert when temperature is over desired

- An ESC button was implemented, with functions: mute alarm (intermitent buzzer), change current step.

- Use Arduino interrupt for Ok button

- Boil time calcs improved: extend boil time when user takes too long to add a hop, change total boil time displayed.

- process whirflock as a hop

not implemented:

- customize mash and boil profiles // won't be done in this version because of UNO memory limitations

- ESC button function change substep, if applicable

- measure water temperature before warming up to calculate how may degrees it may be at startup


- functions behavor after ESC button function go to step

- add whirflock alert is not working sometimes

- last "add hopp" alert during boil

new connections:
Connect a 5V active buzzer to pins ground and digital pin 10.

Arduino Contest 2016

Runner Up in the
Arduino Contest 2016