Arduino Controlled Fermentation Fridge | HomeBrewTalk.com - Beer, Wine, Mead, & Cider Brewing Discussion Community.

Homebrew Talk

Help Support Homebrew Talk by donating:

  1. Dismiss Notice
  2. We have a new forum and it needs your help! Homebrewing Deals is a forum to post whatever deals and specials you find that other homebrewers might value! Includes coupon layering, Craigslist finds, eBay finds, Amazon specials, etc.
    Dismiss Notice

Arduino Controlled Fermentation Fridge

Discussion in 'Fermenters' started by JimmyN, Aug 11, 2013.

 

  1. #1
    JimmyN

    Member

    Posted Aug 11, 2013
    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
     
    CameronReaper likes this.
  2. #2
    RockfordWhite

    Well-Known Member

    Posted Aug 11, 2013
    A fermenting bucket fits in there fine?
     
  3. #3
    JimmyN

    Member

    Posted Aug 11, 2013
    It fits fine. Without the door shelves, there is enough clearance for the door to shut- which is the main reason i cut them out.

    2013-08-11 16.46.15.jpg
     
    bgeek and CameronReaper like this.
  4. #4
    Abhitchc

    Active Member

    Posted Aug 12, 2013
    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.
     
  5. #5
    JimmyN

    Member

    Posted Aug 13, 2013
    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

    */
     
    JohanMk1, bgeek, Rockn_M and 2 others like this.
  6. #6
    JimmyN

    Member

    Posted Aug 13, 2013
    Also, here's a pic of it's maiden voyage: fermenting a 2.5gal blonde ale featuring citra and mosaic at 68F.

    2013-08-13 10.39.40.jpg
     
  7. #7
    Abhitchc

    Active Member

    Posted Aug 14, 2013
    Awesome. Awesome, man!
     
  8. #8
    itsbobbyagain

    Member

    Posted Jan 9, 2014
    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!
     
  9. #9
    VonRunkel

    Well-Known Member

    Posted Jan 9, 2014
    This is more or less what I want to do.. . Well done man.
     
  10. #10
    Rockn_M

    Supporting Member  

    Posted Jan 9, 2014
    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?
     
  11. #11
    BrewCityBaller

    Well-Known Member

    Posted Jan 9, 2014
    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.
     
  12. #12
    cjang

    Active Member

    Posted Jan 9, 2014
    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
     
  13. #13
    Rockn_M

    Supporting Member  

    Posted Jan 9, 2014

    Check out Brewpi.com. That's the direction I'm going.
     
  14. #14
    cjang

    Active Member

    Posted Jan 11, 2014
    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.
     
  15. #15
    JimmyN

    Member

    Posted Jan 14, 2014
    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.
     
    itsbobbyagain likes this.
  16. #16
    itsbobbyagain

    Member

    Posted Jan 14, 2014
    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.
     
  17. #17
    britebeer

    Member

    Posted Apr 24, 2014
    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.
     
  18. #18
    eaglerisingbrew

    Well-Known Member

    Posted May 15, 2014
    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/
     
  19. #19
    Bosvark

    Member

    Posted Apr 20, 2016
    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
     
  20. #20
    thekraken

    Well-Known Member

    Posted Apr 20, 2016
    You might be intersted in this thread: http://www.homebrewtalk.com/showthread.php?t=466106
     
  21. #21
    CameronReaper

    New Member

    Posted Sep 2, 2016
    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:
     
  22. #22
    hulmeag

    New Member

    Posted May 21, 2017
    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
     
  23. #23
    GrogNerd

    mean old man

    Posted May 21, 2017
    I cannot recommend this thread and the BrewPi enough. it really has taken my brewing to another level

    imagine being able to control your fermentation temperature to within ±¼º of set temp

    my entire setup, including donated fridge, was <$65
     
  24. #24
    hulmeag

    New Member

    Posted May 23, 2017
  25. #25
    hulmeag

    New Member

    Posted May 23, 2017
    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.
     
  26. #26
    GrogNerd

    mean old man

    Posted May 23, 2017
    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
     
  27. #27
    hulmeag

    New Member

    Posted May 24, 2017
    Its a thank you :) Can't wait to get a Brew on and test it.
     
Draft saved Draft deleted

Share This Page

Group Builder