Adding Additional Temperature Sensors to an Arduino

One of my goals for the fermentation temperature logging project was to be able to accommodate multiple temperature sensors running from the same Arduino, as well as handle data from multiple sensor units in different locations.  I was scheduled to brew a 5 gallon batch of beer this past Saturday, and it just so happened that I received my shipment of DS18B20 sensors that same morning.

My brewing buddy had acquired the ingredients for an Imperial Stout for our brew session. Due to the high gravity of the beer, the fermentation requires a stable temperature at a higher range of the yeast’s tolerance (~68F).  Additionally, due to the high levels of sugar in the beer, the initial stages of fermentation can be quite vigorous, which can result in higher temperatures than desired and has the potential to induce the dreaded foam explosion[1].  Considering the particulars of the fermentation for this style of beer, I felt it would be great to get a few of my the sensors hooked up to it.

While we were brewing, I started assembling the sensor unit.  I didn’t have everything I needed on hand, as I have been stashing my electronic projects at my girlfriends place.  So I borrowed an Arduino and breadboard from my roommate, and got everything setup.  The only issue I can potentially see, is that I am using a 10K pull up resistor instead of a 4.7K.  Not sure if this has any impact on the calibration at all.  Something worth looking into later.  After a long brew day however, I was in no shape to work on the code base, so I called it a day and went to sleep.

Getting the code working with a second sensor wasn’t too complicated.  The DS18B20 allows for multiple temperature sensors to be run off of the same Arduino pin.  Because they are digital sensors, they each have a unique address.  So I modified the Arduino code to return the unique sensor address in addition to the temperature.  On the server side, I simply stored the data into separate files based on the sensor address, and then added a separate view that sent along both of the data sets to be plotted together.

TempSensorsx2

Two temperature sensors after a few days of data collection.

While the modifications were fairly straight forward, I did stumble upon some issues that will probably have to be dealt with.  By updating the Arduino sketch, I also had to update the sensor server to handle the new data.  This broke the functionality of the original sensor unit.  And because this unit was at my girlfriends place, I had no way of updating the code on the Arduino[2].

The other issue has to do with the temperature sensor addresses.  While it is convenient that you can run multiple sensors off of the same pin, it is pretty difficult to figure out which address corresponds to which sensor.  In my case I was using one sensor to monitor ambient temperature, and another to monitor the fermentation temperature.  I made a lucky guess, and got the assignment right on the first try.  But I could see this being an issue with more sensors.  Making matters worse is that the address for each sensor is a 16-bit hexadecimal serial number, which is difficult to memorize or write down and enter into a terminal or web form.  Considering the type of application we are using this for, I think it might make more sense to run the sensors off of different pins, and then use the pin numbers as a way to identify which sensor is which.  I doubt the extra pin space will be missed, and this would make it much easier for the user to identify the sensors.

SensorOutput

Example Output from the sensor unit. Which sensor is which? Hard to tell from the unique HEX addresses.

Outside of these minor issues, the sensors have already proven there worth.  The brew session was without issue and we ended up with a very active fermentation.  I was around for most of the day when this occurred, so I was able to monitor the situation and make adjustments accordingly (pulled out the blow off tube off, and left the bucket lid partially ajar to prevent any explosions).  But if you look at the graph above, it shows how the fermentation temperature rose from 65-66F to 70-71F[3].  Had I been out of the house, checking the temperature would have alerted me to these potential issues.  And now that the fermentation has been settling down, the main concern is keeping it warm enough.  With temps dropping to ~65F, I will soon need to start adding some heat to the process to keep the fermentation from stalling out.

  • A hectic day filled with brewing, drinking, and tinkering. Here is a shot of the 'work(brew)bench'. Paper towels used to good effect to prevent any spills or splashes from causing too much damage.

The project is still very much in ‘beer code’ phase (quite literally), there is no database on the backend, I am just copying and pasting html templates to create the different pages for the different profiles, and the sensor-to-server system is hacked together and very fragile.  But all-in-all, I think it is a good proof of concept, and a good starting point for making a more robust application.  Time permitting, i will try and solidify the code a bit more, and I have a few more features that I want to add, so hopefully I will have some more updates on the project soon.  Cheers!

[1] Iv’e mentioned this phenomenon in a previous post.  It occurs when foam (a.k.a krausen) from the fermentation clogs the airlock or blow off tube which prevents CO2 from escaping the fermentation bucket.  As pressure builds up, the lid to the bucket will eventually blow off resulting in a big mess.

[2] I am still looking into the options, but it looks like I might be able to use a CLI tool to update Arduino code remotely.  I will report back if and when I find a solution.

[3] I am fairly confident that the sensors are off (on the low side) by at least 1, maybe two degrees.  Not sure if this is due to the 10K resistor or what.  Mainly this is just a hunch, but partially confirmed by some very inaccurate analog thermometers.  As such, the graph doesn’t show the true magnitude of the ‘active’ period.  It was probably peeking around 72F, which is way too high for an ale.