Arduino + Raspberry Pi to measure fermentation temperature

This is the original Version #1 // it will get you going – please see Version #2 for the dynamic sensor processing and more on plotting the data using an API and code.


temperature logging sensor jig above in fermentor…


Above on the left (Raspberry Pi), middle (breadboard), right (Arduino UNO) – this web site runs on the Pi and you are reading this article right now from it :- )

Home Brewing is more than just the act of beer brewing at home to many people // it is a hobby filled with lots of creativity, ideas and passion.  One of our goals was to capture accurate temperature measurements of the fermentation – once you capture the data you can do things with it.

We decided to use a digital 3 wire temperature sensor also referred to as a 1-wire system, because the data is sent over 1 wire, the other two are the volt and ground cable.

We used a DS18S20 Dallas 1-Wire digital thermometer, this sensor is digital and fairly accurate and the program can delivery the data in C or F or whatever you can program for, and it can send the signal over longer distances than an analog thermister.  Also you can have multiple digital readers on the same wire, since each one is identified with a digital ID and you can separate the sensors within the programming code.


Setup the Arduino + Raspberry driver software // Google this and do it on your own…

So in our setup we used an Arduino UNO connected via the USB cable to a Raspberry Pi B, and the Pi also powers the Arduino, get a better 2.0+ Amp power supply for the Pi, ours is 2.5 Amp. You also have to install drivers that allow the two to communicate over the USB cable (serial) connection of the cable.

STEP #1.1

You need to connect the sensor correctly to a 4.7K ohm pull-up resistor, we used a breadboard to help us with the connections, but you can prototype it better.  The breadboard will connect to the Arduino, below a simple way to show the connections of the cables.  The C code is setup to receive the input on pin 2.




Get a program working in C (language) on the Arduino loaded correctly through the IDE, to read the temperature from the sensor – you will have to learn how to do this part and be overall familiar with the basics of how to use the Arduino.    If you never done this before, (go learn that and then come back to do this step), we are sharing the code that we use below, it compiles fine, you might have to install some dependencies, like the OneWire and Time libraries (learn that too).




Use a Python script on the Rasberrpy Pi to read the signal data being sent by the Arduino, see examples of what we actually use right now below.  This script not only reads the data from the Arduino over the (serial USB) cable but also logs the data to a (tab delimited) text file while appending date/time stamp for each point reading, it does this every 5 seconds.  5 seconds could be an overkill for your project, maybe you want it every 30 seconds, it all depends what you are after and the resolution of the data capture that you need.

Version #2 of this code is available – // it ignores a temp sample if it incoming the same as the one just recorded, saving space if you are recording remotely over long time.


Do a test and record some data for a few days or a few weeks in the background using (nohup), you will have to learn Linux as well.  Run the script basically for a few days or weeks and then learn how to graph the data captured in whatever you see fit best way.  Once you have the data in a flat-file, you can transfer it over network and open the data with many different programs to create a temperature/date-time graph.  You can also use Python to create the graphs as well, etc…

We used a free program (Plot2) on a Mac to open the flat text file to read the data and it would actually automatically plot a graph.  Keep in mind that if you record a test sample of say 2 weeks (of stable temperature that don’t vary much), you will see mostly a flat line, but during fermentation you will see a spike of a few days and then a slow decline as the fermentation finishes off – but as tests go for (code and the sensor) – this is a good start.

So think about it, here you learn about the Arduino, and the Raspberry Pi and Linux, and text files to capture the data and C/Python programming languages, and how to graph the data, this is just scratching the surface.   You can take this much further, from displaying the temperature live on an LCD screen, to graphing it live on a LCD screen, to writing more program code and maybe even regulate a heater band over the fermentor to control the fermentation temperate after the yeast finishes its job, to deal with off-flavors for example and many other things, not just temperature.

You also see the min() and max() ranges the yeast temperature was reached during the reaction time of the fermentation to see if you hit the manufacturers recommended temp ranges, just yet another example of the data’s value.

Bottom line is that you not only learn new things, but capture useful data that you can analyze on and take action with – to in the end improve and make great beer.

Updates will come later with additional data, all our future beers will come with a fermentation charts of the overall process of the yeast used.

Also check out the –  Waldy the Wiz, also makes a great project and he shares all of his hard work – his is a little bit more advanced than our example.

Screen Shot 2015-10-19 at 7.40.50 PM

Cold-Dropping Beer

Many various techniques exists, some people drop after fermentation is over and before bottling, and yet some simply cold-drop the kegs already filled with the beer for about a week, before serving, I will explain both.

Most home-brewed beer is left in a lot of its natural state, most people don’t use filters for example, there are debates over its pros and cons.  If you don’t filter your beer, there is always going to be a small amount of yeast and other floaters that will make it out of the fermentor and into kegs or bottles (if you bottle).

Even when you can’t see it, yeast is suspended in the beer and it does affect its look, color, taste and overall body of the beer.  So what a lot of people do, is take the keg and cold-drop it, or simply put, put it into a fridge (whatever setup) as cold as possible, but still above freezing and leave the keg there for about a week.

All the yeast and other floaters that are suspended in the beer will fall to the bottom of the keg, a thin layer will form at the bottom (not in any way bad), so then all the beer that comes out will be nice and clean, crisp, nice color, taste, and everything will improve SUBSTANTIALLY.

If you were to split a batch of beer into two kegs, and cold-drop one and not the other, you would see and experience the differences, if you want to do a comparison.

If you don’t employ a cold-drop and simply put the keg into the keggenator fridge, it too will help, the cold temperature will basically do the same thing, but will take a little longer, so don’t worry if you can’t get it to almost freezing.

Some people apply this technique to the fermentor after the fermentation is done and over with, for about a week, so then when the beer is transferred to the kegs or however bottled, there too you will gain a lot of benefit.



2nd fermentation stage BEER brewing

It’s time that I write another short blob/blog/whatever 🙂 about making your home brewing experience better with minimal extra steps and effort.

This the 2nd fermentation stage.  So after a week or so, maybe even sooner, ( as most fermentation activity will stop in 3-4 days ), you will gently transfer the beer from the Primary container to the Secondary container (the container can be a glass carboy/plastic [food grade] fermentation bucket, or whatever you have to work with.  The 2nd fermentation tank will also have a co2 cap, so that nothing bad can get into the container…

I would use some kind of a tube to transfer the beer, and not disturb the primary fermentation tank, this will leave all that nasty brewers yeast at the bottom, where you want it.  While there are some benefits of consuming the brewers yeast (vitamins), most people don’t like to see that in their beer and you will almost never see that in the store.

Commercial brewers use in addition filters too and additives as well!

Most of the fermentation takes place in the Primary container, so this is a bit miss-leading, about further fermentation, but there will be a bit of that going on, mostly you won’t notice it.

Most beers can be done with a single-fermentation stage, but once you do the 2nd stage and see all the benefits from that, you will never go back to the single-stage again, trust me!

Here are some of the benefits as I observed it:

  • most of the brewers yeast is left over in the primary vessel (left behind)
  • whatever does make it into the 2nd stage, will settle at the bottom over time and cake into a harder layer
  • the beer will be much clearer, cleaner and crisper!
  • you can leave the beer in the 2nd stage for months, if you are not ready for whatever reason to bottle/keg just yet
  • fermentation becomes more complete
  • much fewer off-flavors
  • dry hopping –
  • including additional ingredients to enhance flavors, aroma, smell, etc….

there are other benefits, if you brew lager beer, the word lager literally means” to lay down”, and other stronger beers also need the extra time to age and become more mellow for the flavoring.

When you transfer the beer into the 2nd fermentation stage, it is best not to leave any head-room, (empty-space in the vessel), because air is there and oxygen degrades beer.  If you do end up with a little bit off extra space, put a table-spoon of priming sugar into the container, that will react with the yeast and produce a little-bit more alcohol and co2, and the co2 will force out any stale air out of the container, while preventing anything from the outside getting into the vessel.

You can also force in some co2 gas if you keg to force out the oxygen out and cap it.

I also recommend that you do a search on youtube and spend a little-bit more time watching over some videos that other people have made, I would watch a few to get the better idea of what you have to do, sometimes it is better to view a video (when you are just starting out)…

Keep on brewing! :- )