Monitoring the mash temperature

We all know that mashing temperature as a huge influence on the final product, but how well do we record it during the process? I, for one, do a terrible job and writing down that information and without good brew day notes and data, it's nearly impossible to analyze why the beer finished at a different gravity than expected or why there's an unexpected flavour present. Sure, I have the strike and target temperatures in Brewtarget, but that's not always what happens on my brew day. What if I make a mistake in my decoction volume or strike temp calculation? If I don't note it down properly, I might remember that something went wrong, but chances are it'll be foggy...

Temperature Monitor

Enter my mash temperature monitor. As a software developer, I figured I should leverage that to keep track of the readings, especially since my hand-writing is hard to decipher. So I set out to build my own glorified thermometer. Originally, I was using an Arduino Uno, but it felt a little bulky and not network capabilities built in, I went with a Photon by Particle. It's relatively cheap, has built-in Wi-Fi and it takes very little space compared to the Arduino Uno. It works both via USB or has a web service. I bought a bunch of DS18B20 sensors which I got from RobotShop a few years ago. Those sensors have an operating range of -55℃ to +125℃ but I read that they lose precision past +85℃, so I have never tried using them in the boil. I have spares, so I might play around with that one day.

In order to reach the Photon over the network, I had to use the Particle Cloud and store the local IP address there and later fetch that IP address. It's not ideal because if for whatever reason Particle closes their service or start charging for hobby-level projects, it'll stop working. I read somewhere that it's possible to have the Photon mess with mDNS but I haven't taken the time to look into it.




As you can see, I used some headers on the board so I don't have to commit my Photon to this project alone. It's probably overkill, since the price tag of the Photon is so small (for what it does).  I don't have a box for the device yet, and I'm thinking about hooking it up to a battery so I don't always need to have a USB wire connected to it. There's enough way to hurt yourself on a brew day, tripping on a wire shouldn't be one.

Data Visualization

I wanted a nice visual interface to view the temperature data and I thought using a browser based interface would be better than building my own desktop app or even command line interface. I decided to go with Elm, a neat programming language a coworker showed me and I thought it'd be fun to learn. I'll spare you the techno babble of functional languages and pure functions and all that, but if you're interested, check out http://elm-lang.org/ for more information. Be cautious though as Elm is relatively young and evolves really fast - the code I have is deprecated and I just haven't had the time to upgrade everything (last I check, almost every line of code needs to change... and the charting library isn't supported anymore)

The gist of the interface is just a line chart to trace the temperature progression and a few buttons to pause the temperature reading, load the data of a previous mash or save the current mash data.

The screenshot above is using dummy data, which explains the crazy differences in temperature.

As you can see, it's not the prettiest thing and there are definitely some usability issues, but it'll do for now. I don't see myself adding features anytime soon, but I'll likely work on the design in the near future.

Missing Link

Behind the web interface lives a small Sinatra app that essentially either reads from the serial port or from a web address. Reading the data over USB speaks for it self: opens the port, reads the temperature and returns it to the caller. The networked approach works in a similar fashion. It reads the IP address from the Particle Cloud and makes a request to it, formats the JSON formats the data and sends it to the caller. I could get a circuit breaker setup in case any of the network call fail but this isn't vital, money making software.

The Sinatra app also handles saving the mash data. It'll save the temperature data that can later be reload by the Elm application so the data can be visualized at a later time, such as when writing a blog post about a brew day. I might rewrite that app in Elixir, but that's the subject for a conversation over a beer.

The Code

If you want to run your own and/or improve the software you can find the code for the 3 parts of this project here:


The links I provided are snapshots of the code at the time of writing this. If you want to see the latest version, make sure you check the master branch!

Comments

Popular Posts