DIY Temp Controller (Super Nerdy)

A long time ago I designed a temperature controller around the Raspberry Pi computer board. For my first design I put too many components in too small of an enclosure (8"x6"x2") and the thing basically fried itself before the first batch of beer. (Turns out Rasperry Pi’s don’t like getting touched by 120V AC lines…) My second design was basically the same but I used a larger enclosure that let me better separate the 120v relays from the digital parts. That’s been my workhorse for a few years now, but it has one fatal flaw. The Raspberry Pi relies on an SD card, which can’t take as many write cycles as a linux distro dishes out. So, unless I remembered to replace the SD card before it wore-out, the controller would just crash without warning every 4-6 months. Usually the night after I brewed a beer. :rage:

For my THIRD controller, (boringly named “Mark 3,”) I decided to start over completely. The brain of the controller is an Arduino Nano. NOT another Pi.

I also decided to use relays that were basically designed for “makers” called PowerSwitch Tail’s. They’re basically just plugged inline and can be controlled directly by a 3.3v “GPIO” line from the Arduino.


I should be able to use the same relays regardless of how many times I decide to rebuild the electronics. :smiling_imp:

For the arduino, it has just enough horsepower to scan about 5 temperature probes once a second. I plan on three, one to measure ambient room temp, one to measure air temp in the freezer, and one physically attached to the beer.

I wrote a couple programs that run on a PC connected by USB that can read and log the temperatures, as well as control the settings. Once set though, the Arduino can run without the computer. So if the computer crashes or gets turned off, the beer is safe.

There are so many cool parts designed to work with Arduino’s, that I went full-nerd. I added a 128x32 pixel OLED display to show the current temperatures, a battery-backed clock chip, that also has nonvolatile RAM which I use for storing settings, and even a bank of NeoPixel lights, just to take the nerd-factor to 11. (Red when heating, Blue when cooling, Green when Idle.)

Remember, I said my original controller design was a failure, because I packed components too tightly? Well, all the circuitry I assembled was designed to fit in an Altoids Tin. Yup ALTOIDS! All the tin needed was a little Dremel work to cut holes for the USB connector, and the connectors for the power adapter, the temp probes, and the relays. I also lined the inside of the Metal case with insulating tape. Printing and gluing a label hid the tool marks and provided the finishing touches.

Sorry for the J. J. Abrams lens flair; phone cameras…

2 Likes

I especially like the KITT lighting effect…

1 Like

Way above my skill level. Great design work.

The light effect is called a “Larson Scanner” named after Glen A. Larson, the mind behind Battlestar Galactica’s Cylons, and Knight Rider’s KITT, both of whom used the effect.

He may have had nearly as much influence on my childhood as my parents… :astonished:

1 Like

Wtf are you talking about… I’m here to brew beer.

1 Like

Oh, man… I’ll have to find some Fall Guy on Netflix. That, Hardcastle and McCormack, and Hart to Hart were my 2-channel childhood.

In other news, I can’t quite make it out…

For every (something), (something)
For every sorrow, Cheer
For every storm, a Cellar
For every thirst, a Beer

Geek level… Super Awesome!! Nicely done!

1 Like

For every wound, a balm.
For every sorrow, cheer.
For every storm, a calm.
For every thirst, a beer.

2 Likes

Oh I’ve reading about Audrino’s too. I would like to understand more. I enjoy info, and in the winter up here, its dark and cold! No better time to enjoy a finely crafted brew, and look at things that are of interest. I’ll be just about to wire my gizmo’s up… Talk later? Sneezles61

Very nice. Can you track / record the temps ? See Temperature: Wort vs Room.

I think the ultimate temp controller would keep the wort temp within a close range and also limit the ambient temp so it’s not dramatically different than the desired wort temp. For example, in cooling mode, when the [ale] wort temp rises from say 66 to 67 and the freezer kicks in, there’s no need to run the chest freezer down to 30, which would eventually overcool the wort even after the controller turns the freezer off. Your smarter controller could limit the freezer to say 60 when the wort is calling for cooling. Similar for heating. Without the intelligence your system has, it takes two controllers in series to do this.

To take it to the next level, you could adjust the ambient temp setpoint based on how far the wort is from its setpoint. e.g. if the desired wort temp is 66 and it is at 68, bring the reifrig or freezer down the 63. If the wort is at 80, bring the refrig down to 50.

Nice!

I am curious as I have a raspberry PI as well that I was just goofing around with Java and flashing I/o on the gpio board, what was causing all the writes to your sd card?

The thing about it is, the freezer compressor and the heating pad are both either on or off. Also the challenge changes over time. During active fermentation the beer itself acts as a heater, while during conditioning the beer is just a passive thermal mass.

What I do is have a set point, say 60F. Then I set a threshold where the cooling turns on, and a cutoff where it turns off. So maybe 1.5 and 0.5 respectively. This means the freezer turns on when the beer rises to 61.5, and shuts down once the temp comes back down to 60.5. Once the compressor shuts down, the temp continues to drop for a few minutes, maybe to 59.5. The goal is to keep the temperature within a range of the set point, but not necessarily to hold the set point precisely. The old controller kept the temps within +/-1.5F sampling temps once per minute. The new controller samples almost 2x/second. My expectation is that the increased sample rate will allow even tighter temp control. Either way, the specs are tighter than what is required in biopharmaceutical manufacturing; they keep the bioreactors (fermenters) to +/- 2 C or ~3.6F.

Another major design goal, and a trade-off for not wanting to hold temps too precisely, is to extend the life of the freezer’s compressor. One part of that is enforceing a minimum idle time, sometimes called Short Cycle Protection. But you also want to run the compressor for at least a few minutes before shutting it down, I don’t to that explicitly, but it’s the reason for setting the threshold so high. If I wanted to keep the beer temp within 0.2F I could do it, but it would require running the compressor for a few seconds every few minutes or so. It would word great, until the compressor died. I’d be buying a new freezer every year or so.

I was trying to hold back some of the nerdiness…

So…
The arduino itself cannot. I wanted a temp controller that wasn’t dependent on data logging, and would maintain itself without needing external input.

However…
I also wrote some code that runs on a Linux PC which is connected to the arduino via USB. The PC pulls samples from the Arduino every 5 seconds and saves them to a mongo database. This Node.js web app serves the logged temps and allows me to display/change settings on any browser on my network. (And my phone can be on my network via VPN from pretty much anywhere.)

Raspberry Pi is a great platform; I mean it no disrespect. I just felt a do-over with arduino would be more fun than tweaking raspbian for longevity. It just seems the need for patching, and hand configuration isn’t my cup o’ tea.

I used 8GB Class 10 SD and eventually switched to Micro SD cards, all Microcenter house brand. What was doing the disk I/O? Look to /var/log for system activity. My Pi-based controller would collect samples in RAM once per minute, and append them to a flat file on the SD card every 10 minutes. I also ran a Java web app in Tomcat to display data, and I’m sure it also did some logging. I’m also not sure if it’s was volume of writes causing wear, or just cheapskate store-brand SD cards. Basically I gave up on a card when fsck failed and the pi couldn’t boot, but I never determined the EXACT culprit beyond “wear”

There are things that could have been done to extend the Pi controller, like mounting the SD read-only and logging to a RAM disk. The sample files could have been written to a USB stick, and the writing could have been reconfigured to essentially eliminate rewrites. It probably could have lasted indefinitely.

Thanks, yes I guess doing file I/o on the sd card would do it.