I just finished up programming and implementing my temperature logger for fermentation and conditioning beer. In the past, at times I have struggled (especially during the hotter summer months!) with off flavors that I believe were largely due to fermentation temperatures. Aside from building a fermentation chamber (loosely based on son-of-fermentation), I also wanted to much more closely monitor the fermentation temps.
Having recently purchased an Arduino (Uno Rev 3) and learning some about the programming language, I quickly decided this could be a perfect solution.
- Most basically, log beer temperature for later review to a removable SD card.
- Monitor/display current temperature
- Monitor/display running minimum and maximum temperature.
For those out there intimidated by the arduino or programming, it does come with a small learning curve, but it is a totally doable project. The key to my success with it was trial and error. You’ll learn from your mistakes and improve on them. Plus, what better way to learn programming or electrical engineering than for beer! This is composed from a multitude of tutorials, so go pour a homebrew, and lets jump in. Cheers.
I began with interfacing my LCD screen. This was a necessary part of the system for monitoring the temperature. I personally ordered a simply serial 16×2 LCD from SparkFun here. I then followed Arduino’s online LiquidCrystal Tutorial for a wiring diagram. I most simply just followed the image to the right, but the link above will explain in greater detail. Note: You will need a 10k potentiometer for the contrast. Without it, no matter if you ground the contrast or wire it in to 5v or 3.3v, the contrast will not be sufficient to read. Your LCD will be displaying, but you will not know it. I used this guy from the local radioshack, You’ll have to turn it at least 4 or 5 times to get the contrast to a legible setting. Begin with wiring this guy up and pull up the LiquidCrystal examples and make sure you are comfortable with running HelloWorld. Review the code a touch so you’re familiar with lcd.print(), etc, and how the library works.
I moved D11 and D12 down to D6 and D7 just for organizational reasons, if you do this, be sure to go through the code and sub in 11 for 6 and 12 for 7. For the record, I just very un-professionally wired my lcd by bending 10 different copper wires through the LCD pinout. This is strongly discouraged. I will eventually solder it all. You can do it the way I did, just using 5 strands of speaker cable (two wires on each cable) but just know that wiggling and shorting can cause some frustration. You have to make sure none of the copper is dangling around and shorting.
I ordered two DS18b20′s from SparkFun. One for fun & testing purposes, and another for actual use submersed in the beer. I have considered many options for how to get the temperature of the beer, and feel that a submersed probe is the only way to get a true, accurate reading.
The temperature probe and wiring is pretty straight forward. Its a digital pin, with a 5v and a ground. You will need a 4.7k Ohm resistor for the DS18b20. Again, I picked up an 8pk of these for like $1 at the local RadioShack. The image at the right is directly from the manufacturer. If you’re using the probe only (no waterproof wiring), note the indent and make sure you know the difference between GND and Vdd (5v). I don’t believe it’ll hurt anything if you wire it wrong, it just won’t work. If you’re using the wired waterproof probe, then black is ground, red is Vdd, and white is data.
You will need to download the 1-wire library (from Paul Stoffregen) and add it to your arduino library. This is usually located in your Documents folder under arduino. Unzip and copy the folder right into the Libraries folder inside Arduino.
I added an ugly wiring schematic I drew real quick for clarification with the resistor. The resistor just goes right in on the data pins and the 5v, between the arduino and probe. The data pin can then go into any of the digital pins. So just choose one and make sure it set right in the code. If you use my code, i put it on digital pin 9. For easier prototyping, I just use a simple breadboard. Open the arduino examples and select the 1-wire’s ds18b20 example. Play around with it. Make sure you get it working and reporting to either the serial monitor, or better yet the LCD. You will have to play with LCD display anyway, might as well do it now. Get that temperature displaying on the LCD. At this point, you should have a good idea of what the house temperature is. If its 72 or warmer, go pour yourself a pale or ipa. If its cooler than 72, go pour yourself a nice stout. Then come back, we’re not done here.
SD card & logging
Okay. At this point, hopefully you have the temperature probe and lcd working. You should also be at least 2 beers in. I’ll take a moment to go refill….mmm, irish stout tribute. So I really wanted a way to be able to review the temperature data after a full fermentation. A quick easy way of doing this is just telling the Arduino to dump the temperature it is already reading at this point to the SD card every so often. I think a 5 minute resolution will be more than enough. I purchased this SD Shield , again from the local RadioShack. It was only $14, and the well worth the investment for wiring purposes. Throw that guy on the arduino and make sure you select the correct switch if you’re using the same model as radioshacks. There is tiny switch that selects between SD and microSD. The SD shield uses D10, D11, D12, D13, so you if you placed your temperature probe on one of these, just move it to another digital pin, and replace the code with right pin.
Now we need to add another library. For the purpose of the implementation we have, an append type application would be best. I don’t want to lose the logged information I already have, and I dont want a new file each time I log, so I actually added the SdFATlib libary to my arduino IDE. Inside that library, there is an append example, exactly what we need! There is already an SD library of sorts supplied with the Arduino, but I liked the append example and just never went back after that. For our append program to do what it needs, there needs to be a pre-existing file in the root of the card. So I put the SD card in my laptop, formatted it (for good measure), and added a file to the root title “beertemp.TXT”. Note that file names on a FAT32 disk need to be 8 characters or less, with the 3 digit extension. Choose wisely my friends.
Now that we have the file in the root directory, put the SD card in your arduino SD shield, and pull up the append example from the sdfatlib library. Upload it and then check the SD card. Play with it until you have the example appending happily. Now you’re good to go.
All together now
The program linked here is the one I’m currently using. It has a 2 sec monitor resolution, and a 5 minute data log resolution. Read through the code and familiarize yourself with it. I have commented it to the best of my ability. I will allow comments on this post so you are free to ask questions or pose improvement ideas.
My program, free to use, modify, share as needed.
I have combined all three of the above examples and necessary code bits into one streamlined program that I feel works well. This is in no way a perfected approach. I’m open to suggestions and pointers. I know much improvement can be made. Good luck!
Prosit! (especially to you guys over at /r/homebrewing!)