Arduino Controlled Fermentation Fridge

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

JimmyN

Member
Joined
Jul 16, 2012
Messages
21
Reaction score
12
Location
Bethlehem
Its finally done! After our mid-summer heat wave and temperatures in my basement (where I normally ferment) reached 85+, I decided it was time to make a fermentation chamber. I really wanted to make my own temperature controller rather than just buy one.

I started with a magic chef mini/dorm fridge that I used in college solely for natural light- I think this is a better use. Removing the door shelving was a pain, and made a lot of foam dust. I hollowed out a small well in the remaining foam for the display, arduino, and breadboard. Yes, I used a solder-less breadboard, and know this is a dumb idea. I will eventually solder everything together. The inside of the fridge door is lined with corrugated plastic- the stuff election signs are made from. I painted the outside of the door with chalkboard paint- I love this stuff and hopefully it will encourage me to be better about recording brew date, fermentation temps, and OG's.

The relay that turns the fridge on and off is located in the back by the compressor, as well as the power brick for arduino power. Rather than tapping into the internals of the fridge, I just cranked down the factory temperature knob to max, which allows the fridge to reach ~30 degrees. I could then tap into the fridge's power cord and splice in the relay to turn it on and off. I programmed in a minimum cycle-on time of 2 minutes, which hopefully will be enough to avoid short cycling.

Overall, it keeps a temperature very well, and looks pretty awesome. I have the ability to adjust the temperature in 0.5 degree increments. It can fit two 3 gallon better bottles, or a single 6.5 gallon pail or carboy.

Components:

Arduino
Arduino LCD- ebay
Sainsmart Arduino 4 channel Relays- amazon (I didn't realize they made less than 4 channel modules)
Random Resistors
Temperature Probe- DS18B20- ebay
Momentary Pushbuttons- radioshack
12v 1amp power brick- amazon
2x 80mm pc fans

2013-08-11 15.08.29.jpg


2013-08-11 15.07.22.jpg


2013-08-11 15.07.39.jpg


2013-08-11 15.07.51.jpg


2013-08-11 15.08.46.jpg
 
Very nice. Care to share your code? I am capable of using the LCD display, but incorporating the push-button coding and menus, and adding the PID temp libraries is a little above my realm of understanding.
 
I'm not sure what the best way to attach code would be, so I'm just copying and pasting. The pushbuttons don't control menus or anything, they simply increment or decrement the set temperature and then re-load the display. This is accomplished with interrupts. I was also too lazy to implement the arduino PID, so for now I just turn the compressor on when the temp gets too high, and turn it off when it gets too low.

#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>

volatile long lastDebounceTimeU = 0;
volatile long lastDebounceTimeD = 0;
#define ONE_WIRE_BUS 4
#define debounceDelay 300

byte buttonInterruptUp = 0;
byte buttonInterruptDown = 1;


LiquidCrystal lcd(12, 11, 10, 9, 8, 6);
double currentTemp = 99.0;
double setTemp = 70.00;


OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);


const int COOLING = 1;
const int RESTING = 0;
const double precision = 0.3; //.5 degrees precision

int minOn = 120; //2 mins
int maxOn = 3600; //1h
int minOff = 600; //10m

int rest_count;
int cool_count;
int fridge_status;
int startup_time = 10000;


const int fridge_relay = 5;

boolean tooWarm(){
return (currentTemp >= (setTemp+precision));
}

boolean restLongEnough(){
return (rest_count >= minOff);
}

boolean tooCold(){
return (currentTemp <= setTemp); //temp keeps dropping after temp is reached
}

boolean onLongEnough(){
return(cool_count >= minOn);
}

boolean onTooLong(){
return (cool_count >= maxOn);
}

void setup() {
digitalWrite(fridge_relay, HIGH); //start with fridge off, relay is active low

lcd.begin(16, 2);
//Serial.begin(9600);
lcd.print("starting up");

attachInterrupt(buttonInterruptUp, tempUp, RISING);
attachInterrupt(buttonInterruptDown, tempDown, RISING);
sensors.begin();
pinMode(fridge_relay, OUTPUT);
fridge_status = RESTING;
rest_count = minOff;
cool_count = 0;
}

void loop() {
delay(startup_time); //allow lcd to be initialized first
startup_time = 0;

getTemp();
lcdPrint();

if(fridge_status == RESTING){
if(tooWarm() && restLongEnough()){
//turn fridge on after temp has risen and waiting for compressor to cool down
digitalWrite(fridge_relay, LOW);
delay(2000);
cool_count = 0;
fridge_status = COOLING;
}
rest_count++;
}else{//fridge status is COOLING

if(onTooLong() || (onLongEnough() && tooCold()))
{
//turn the fridge off if its cool enough or compressor on too long
digitalWrite(fridge_relay, HIGH);
delay(2000);
rest_count = 0;
fridge_status = RESTING;
}
cool_count++;
}
delay(1000);
}


void tempUp(){//dont feel like adding a debouncing circuit.. this is good enough
if((millis()-lastDebounceTimeU) > debounceDelay){
lastDebounceTimeU = millis();
if(setTemp < 100.00){
setTemp += 0.5;
lcdPrint();
}
}
}

void tempDown(){
if((millis()-lastDebounceTimeD) > debounceDelay){
lastDebounceTimeD = millis();
if(setTemp > 30.00){
setTemp -= 0.5;
lcdPrint();
}
}
}


void getTemp(){
sensors.requestTemperatures();
double t = sensors.getTempFByIndex(0);
if(t > 0 && t < 120){ //faulty wiring causes weird temperatures..
currentTemp = t;
}
}


void lcdPrint(){
lcd.begin(16,2); //sometimes lcd goes blank, i guess this fixes it....
char tbuff[6];
tbuff[0] = '0'+((int)currentTemp/10%10);
tbuff[1] = '0'+((int)currentTemp%10);
tbuff[2] = '.';
tbuff[3] = '0'+((int)(currentTemp*10)%10);
tbuff[4] = '0'+((int)(currentTemp*100)%10);
tbuff[5] = '\0';

char sbuff[6];
sbuff[0] = '0'+((int)setTemp/10%10);
sbuff[1] = '0'+((int)setTemp%10);
sbuff[2] = '.';
sbuff[3] = '0'+((int)(setTemp*10)%10);
sbuff[4] = '\0';
lcd.clear();
lcd.setCursor(0,0);
lcd.print("TEMP:");
lcd.setCursor(8,0);
lcd.print(tbuff);

lcd.setCursor(1,1);
lcd.print("SET:");
lcd.setCursor(8,1);
lcd.print(sbuff);
lcd.print(" ");

//print a "*" on the display if the fridge is on
lcd.setCursor(15,1);
if(fridge_status == COOLING){
lcd.print("*");
}else lcd.print(" ");
lcd.display();

}




/**************************************************************
LCD WIRING
http://arduino.cc/en/uploads/Tutorial/LCD_schem.png

Interrupt Debouncing
http://meandmyarduino.blogspot.com/2011/12/interrupts.html
better:
http://dduino.blogspot.com/2012/10/arduino-isr-interrupt-code-tutorial.html

*/
 
Great work. Can you give us an update on how its working out for you? I've been working on this same type of project for a while, but in a simpler fashion. I'm thinking to just buy the same parts you have used and give it a go.

Thanks for posting your project!
 
Bought my parts this morning so I can do this. Let us know how it's working.

Did you wire it directly into the fridge or is it wired into a seperate plug that the andruino contorls and the fridge plugs into that power source?
 
I did something very similar to my chest freezer, except I used a food-safe, submersible temp probe from Atlas Scientific so I made sure to be measuring the temperature of the beer.

I love to control and ability to customize that Arduino offers!

How consistent have your temps been? When I was designing my code during for my first brew I kept my computer attached to the arduino for primary so that I could log my temps over time and adjust parameters as needed. Took a little work, but I got it dialed down to +/- 1 degree Fahrenheit without implementing PID.
 
Great setup. I built a similar setup but used a rotary encoder for input. Are there any improvements you would like to incorporate or things you want to fix? My next improvement will be to set up a temperature ramp. First at a preprogrammed time then maybe set it up to detect the fermentation activity then ramp accordingly. You could probably determine the fermentation activity by determining the cooling demand. I'm also thinking about setting up a data logger onto an SD card then setting up wifi to monitor fermentation online. What do you think?

Sent from my Nexus 7 using Home Brew mobile app
 
Great setup. I built a similar setup but used a rotary encoder for input. Are there any improvements you would like to incorporate or things you want to fix? My next improvement will be to set up a temperature ramp. First at a preprogrammed time then maybe set it up to detect the fermentation activity then ramp accordingly. You could probably determine the fermentation activity by determining the cooling demand. I'm also thinking about setting up a data logger onto an SD card then setting up wifi to monitor fermentation online. What do you think?

Sent from my Nexus 7 using Home Brew mobile app


Check out Brewpi.com. That's the direction I'm going.
 
That's awesome! I hadn't seen the Brewpi project before. I'm totally inspired to work on my controller again. Thanks and best of luck with your project.
 
Overall, the fermentation chamber has been working out very well. I've used it for both ales and lagers, and it holds temp very well. My one issue so far is that occasionally when the compressor kicks on, the set temperature increases. I'm guessing this is because the relay power and pushbuttons are both drawing power from the 5v out of the arduino- so either the arduino's voltage regulator or my power supply cant handle the initial current spike when it clicks on. Its not a big deal, just an annoyance, and I've been too lazy to fix it. Also, I was able to get it down to +/- 1 degree F without a PID, which is good enough for me.
 
Overall, the fermentation chamber has been working out very well. I've used it for both ales and lagers, and it holds temp very well. My one issue so far is that occasionally when the compressor kicks on, the set temperature increases. I'm guessing this is because the relay power and pushbuttons are both drawing power from the 5v out of the arduino- so either the arduino's voltage regulator or my power supply cant handle the initial current spike when it clicks on. Its not a big deal, just an annoyance, and I've been too lazy to fix it. Also, I was able to get it down to +/- 1 degree F without a PID, which is good enough for me.

Thanks for the follow up. Sparkfun just shipped my parts so I should be in business soon. I also picked up a RaspberryPi this weekend and got Brewpi set up. I'm going to try your method first to see which works best for me. I'll post some pics once I get it all hooked up. Thanks for sharing your code and design.
 
Did anyone else ever try to construct this project? I have It it prototyped and mostly working except for I cannot seem to get the 2nd button that sets the temp to work.

I don't really want to rewrite it without the interrupts but I guess I will if no one else was able to get it to work.



Edit:

I believe I am going to go ahead and rewrite the code to remove the interrupts. I could like to add 3 buttons to display what is on each corresponding tap when pressed.

Still if anyone else or the original author could give me some insight... that would be great.
 
Bought my parts this morning so I can do this. Let us know how it's working.

Did you wire it directly into the fridge or is it wired into a seperate plug that the andruino contorls and the fridge plugs into that power source?

I toyed with hard-wiring my Arduino into the fridge but decided to go with a separate plug. By unplugging the juice to the Arduino, my fridge goes back to being a regular fridge.

http://www.eagle-rising-brewery.com/brewery/fermentation-system/the-control-unit/
 
Does anyone have a connection diagram for this code? Or maybe something similar? Im looking to build a arduino fermentation fridge controller, something similar to a STC-1000.
Thanks
 
Hi, is it possible to list which wires are connected to where on your uno such as the fans, the temp sensor and the buttons, this is a great code!
will be trying this myself soon!:mug::rockin::tank:
 
Jimmy,

You rock. I built this in 2 hours yesterday and registered on this site just to say thanks. I normally make IPA's but though I would try a lager so this quick easy to follow post had me up and running in no time.

Thanks a lot from Liverpool, UK

Andy
 
Well thanks GrogNerd you now have me addicted to watching my fridge temps even on my phone now I have BrewPi as well. :)

I will compare both systems to see what best for me.
 
Well thanks GrogNerd you now have me addicted to watching my fridge temps even on my phone now I have BrewPi as well. :)

I will compare both systems to see what best for me.

Is that a "thank you " or a "damn you!" ? ;)

I use it even when I'm not brewing: can tell if my back door is open by looking at the room temp on BrewPi
 

Latest posts

Back
Top