Introduction: Arduino Homebrew

Picture of Arduino Homebrew

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

Picture of 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

Picture of 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.

So…

Arduino

  • 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

Picture of 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)) {
      DisplayTimes();
      DisplayTemperature();
   }
}

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:

ProcessChoose

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.

ProcessPrepare

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.

ProcessMash

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).

ProcessLauther

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.

ProcessBoil

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.

ProcessCool

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.

ProcessWhirlpool

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.

ProcessEnd

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

Picture of 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

buggy:

- 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.

Comments

PascalG24 (author)2017-03-07

This is really cool. Thanks for the effort. Decided this to be my first Arduino project. Parts are slowly getting in. Going to think if I can find a way to add profiles a bit easier. While I'll be fine, my beer brewing buddies wouldn't...

Next to this ill design a custom printable enclosure and ofc share it on Thingiverse.

IoquirS (author)PascalG242017-03-07

Pascal,
Great to hear you're going to brew using arduinto too!

About adding profiles easier, my dream is to use BeerSmith recipe information to feed arduino. It can be done, I'm sure, matter of time and effort.

I'm planning to use arduino to control temperature and record logs during fermentation stage. How about sending recipe information to it too?

Let us know when you have the enclosure printable plans!

Thanks!

thalaser (author)IoquirS2017-10-03

Hi, great job ! On arduino, on homebrew, on DIY and sharing. I am also new to Arduino and thinking same way with BeerSmith. Have you thoought to include the bluetooth interface as to control read/monitor ? I believe (if feasible) it could solve the first stage at the controller, second stage will be translation between Beersmith and Arduino variables. Please let me know if you already got on this or just is a dump question from my side.

Rgds and good brew!

IoquirS (author)thalaser2017-10-04

Hi Thalaser.
yes, jump recipes from Beersmith to Arduino is something I'd like to do.
As long as I know, BeerSmith does export BEERxml format data for recipes. (http://www.beerxml.com/ )

But instead of using bluetooth, I consider using a wi-fi ready Arduino compatilble board, like WeMos D1 R2. With wi-fi I could, in theory, make remote beer. :-) To say the truth, I started working on a fermentation temperature and logger that I plan to control via web.

Arduino programming is tricky, specially when the algoritm logic is complex. How about making all the logics on an Android app and use the Arduino only to read sensors and send control signals to devices?

PascalG24 (author)IoquirS2017-03-21

Made it! Works brilliant. First soldering and Arduino project! Cool.

Had a error while compiling on the "init" for the lcd. After some google i found out i needed to change that into "begin". Works now!

But no LCD backlight. Could it be a faulty lcd? wiring and soldering checked!

IoquirS made it! (author)PascalG242017-03-21

Strange the "init" issue. The code I uploaded is the one I have running on my prototype. But if it's working now, it's all right!

If you're using a LCD with the serial interface attatched, you need to close a jumper that there's in the interface. You'll also need to set contrast. (See picture).

If you're using a paralel LCD, probably there's a missing wire.
If you did this and still no backlight, It may be a faulty LCD.

PascalG24 (author)IoquirS2017-03-21

i salute you with a beer! thanks for the reply. Will check tonight.

PascalG24 (author)IoquirS2017-03-07

Ow i will! I'm a 3d animator by trade. Ill probably do a remix of a design case on thingiverse.. Afraid to say i cant help out with coding. But for now. if i understand it right, i can just adjust the profiles to make it work.

PyrusBoy (author)2017-07-09

I have now had a chance to play with the shield from HobbyTronics which plugs directly into the uno. This board replaces the IC with ATmega1284 to give much bigger usable memory and outputs. At £9.98 each these save the problems on conversion of uno to mega programming.

PyrusBoy (author)2017-07-05

Hi,

I have just upgraded the uno to give:

Flash memory 128K

RAM 16K

EEPROM 4K

Serial UART 2

Total IO pins 32

PWM pins 8

So am working on fully automated sketch. More later

PyrusBoy (author)2017-06-24

Hi,

Very good sketch, I have it running on UNO, but due to the number of outputs required for full automation I would like to run Mega. The sketch compiles but stalls on loading very close to the end. Any ideas how I can complete the upload??

IoquirS (author)PyrusBoy2017-06-26

Hi.

I had basically three problems with the Arduino programming interface:

- not able to connect (I don't remember exactly the message) - got this the first time using non original arduinos (chinese), solved downloading the correct USB controller driver for the board. I used the cellphone magnifier to read the controller chip code.
- "COM3 is bussy" - seems to be a bug, usually I need to disconnect and reconect the USB cable to computer.
- timeout while loading - I was loading to a Mega board, but UNO was selected in the Arduino interface, for example.

About using or not a Mega board: I experienced problems, program working not the way I programmed it to, when more than 80% of memory was used.
Now I'm working on version 1.1, wich will have some new functions and bugs corrections, but I know there's no way getting futrther with UNO. Making a joke, we can say my Arduino Homebrew V1 is basically a kitchen timer with a thermometer, isn't it?
>LOL<

I want to use a bigger screen, graphic screen, add at least some automation like turning on an off pumpers and head (using buttane gas), record logs. In these cases, a Mega board is required.

pemazzei (author)2017-05-28

Grande projeto! Também muito saboros!!

DIY Hacks and How Tos (author)2017-01-22

Arduinos are great for things like this because you can automatically monitor, and control the system and send alerts is anything need attention. It give you a lot more control than monitoring everything manually.

And you can change the way it works easily! Compare to a traditional electronic circuit...

Thanks, DIY Hacks!

omphacite (author)2017-01-25

I love it!

IoquirS (author)omphacite2017-02-08

Thanks, Omphacite!
:-)

martinusen (author)2017-01-28

Thanks a lot for sharing :)
I also do a little homebrew (7 all-grain brews so far). I have been thinking about automating my mash process and actually ordered an Arduino board and some sensors a month ago. Your project is just great and is really a big help to get me started with Arduino.
Thanks again.
Best Regards

IoquirS (author)martinusen2017-02-08

Martinusen, It's great to read this!
I hope my project is useful to you. Feel free to ask me anything you need about it.

About This Instructable

7,403views

125favorites

License:

Bio: I work with computer networks services and security. My main hobbies: homebrewing, woodworking, electronics.
Add instructable to: