My Ugly *but kinda sexy* temp controller

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.

thegreathoe

Active Member
Joined
Aug 18, 2009
Messages
26
Reaction score
0
Location
poconos
well it's only ugly until i get it all hidden away in some kind of box. so here it is currently scattered on my lil beer fridge:

P9150007.jpg


it consists of:
1 x arduino *blueish thing in the center*
1 x serial lcd *green thing on bottom*
1 x sparkfun relay kit *red item towards the top*
2 x 1-wire thermometers
tons of misc. cabeling and a few resistors and such

P9150005.jpg


this pic shows the nice basic readout i currently have set on the display... it tells me temp inside the fridge and if the fridge is switched on of off on the top line, and on the bottom line is shows the room temp. to the left of the wire monster, you see a cat6 jack that i have conveniently plugged into an old patch cable that i decided to splice my internal therm to. i have it currently set to turn on when > 44deg and off when <= 41deg.

P9150008.jpg


the final pic shows the nice ghetto shrink tube job i did on the therm inside the fridge.. its just temp of course. well that's basically it for now... until i get it all cleaned up and in a box. the nice thing about this is if i want to add another fridge or like 10 more, its only gonna cost me about $7 in parts and a tiny bit more code to set up each.

total price into the project sofar:
arduino = 30ish i think... idk i had it laying around
terms = 3ish each
relay setup *= at max 10 for everyhting there
serial lcd = bout 25... you can go cheap here i jsut like teh ease of only needing 1 wire instead of a bunch.
other stuff = idk.. most was laring around

code to come in a sec:

EDIT!!! schematics are on page 3!!!!!!
 
here's teh code... basically i just snipped up some sections of code from the examples:

Code:
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.

// This is an example of how to use the DallasTemperature with two temperature
// sensors. For more information see the README.

#include <DallasTemperature.h>
#define RELAY_PIN 3


// Data wire is plugged into port 2 on the Arduino
static const int ONE_WIRE_PIN = 2;
NewOneWire oneWire(ONE_WIRE_PIN);
DallasTemperature tempSensor0(oneWire, 0);
DallasTemperature tempSensor1(oneWire, 1);

void setup(void) {
    // initialize inputs/outputs
    pinMode(RELAY_PIN, OUTPUT);
    // start serial port
    delay(2000);
    Serial.begin(9600);
    clearLCD();
    delay(500);
    Serial.print("Joe's Kegerator");
    selectLineTwo();
    Serial.print("Yup It's Kewl!");
    delay(5000);
    clearLCD();
    tempSensor0.begin();
    tempSensor1.begin();
    
    
    
}

void printId(DallasTemperature &sensor) {
    for (uint8_t i = 0; i < 8; i++) {
        Serial.print(sensor.getSlaveAddr()[i], HEX);
    }
}

void display(DallasTemperature &sensor) {
    // Ask the library whether the device is valid
    
    switch(sensor.isValid())
    {
        case 1:
            Serial.println("Invalid CRC");
            sensor.reset(); // Attempts to redetect IC
            return;
        case 2:
            Serial.println("Not a valid device");
            sensor.reset(); // Attempts to redetect IC
            return;
    }
    
 
    // getTemperature returns a float. 
    float temperature = sensor.getTemperature();     
    Serial.print(DallasTemperature::toFahrenheit(temperature)); // Use the inbuild Celcius to Fahrenheit conversion. Returns a float
    Serial.print("F ");

}

void displaywithrelay(DallasTemperature &sensor) {
    // Ask the library whether the device is valid
    
    switch(sensor.isValid())
    {
        case 1:
            Serial.println("Invalid CRC");
            sensor.reset(); // Attempts to redetect IC
            return;
        case 2:
            Serial.println("Not a valid device");
            sensor.reset(); // Attempts to redetect IC
            return;
    }
    
 
    // getTemperature returns a float. 
    float temperature = sensor.getTemperature();     
    Serial.print(DallasTemperature::toFahrenheit(temperature)); // Use the inbuild Celcius to Fahrenheit conversion. Returns a float
    Serial.print("F ");
    if (DallasTemperature::toFahrenheit(temperature) > 44 ){
      RelayHigh();
      Serial.print("On ");
    }
    if (DallasTemperature::toFahrenheit(temperature) <= 41){
      RelayLow();
      Serial.print("Off");
    }

}

void loop(void) {
    selectLineOne();
    Serial.print("In:  ");
    displaywithrelay(tempSensor0);
    selectLineTwo();
    Serial.print("Out: ");
    display(tempSensor1);
    
}


void RelayHigh(){
 digitalWrite(RELAY_PIN, HIGH);
}

void RelayLow(){
digitalWrite(RELAY_PIN, LOW);
}

void selectLineOne(){  //puts the cursor at line 0 char 0.
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(128, BYTE);    //position
}
void selectLineTwo(){  //puts the cursor at line 1 char 0.
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(192, BYTE);    //position
}
void goTo(int position) { //position = line 1: 0-15, line 2: 16-31, 31+ defaults back to 0
if (position<16){ Serial.print(0xFE, BYTE);   //command flag
              Serial.print((position+128), BYTE);    //position
}else if (position<32){Serial.print(0xFE, BYTE);   //command flag
              Serial.print((position+48+128), BYTE);    //position 
} else { goTo(0); }
}

void clearLCD(){
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(0x01, BYTE);   //clear command.
}
void backlightOn(){  //turns on the backlight
    Serial.print(0x7C, BYTE);   //command flag for backlight stuff
    Serial.print(157, BYTE);    //light level.
}
void backlightOff(){  //turns off the backlight
    Serial.print(0x7C, BYTE);   //command flag for backlight stuff
    Serial.print(128, BYTE);     //light level for off.
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  Serial.print(0xFE, BYTE);
}

enjoy!
 
um.. i can try... i'm not really the best instructor... and i basically learned while jsut doing a bunch of reading and trying some code out... i havnt really programmed for a good 7 years, minus some php. i just got the stuff to play around with on some free time.... i could disassemble most of it and show ya step by step if you wanted.... kinda have to do that anyways since i didnt take the time to solder everything down yet. but if you do decided to try this, i def recommend the 1-wire devices... thermistors were a pain in the ass to get all set up, and these are all precalibrated.
 
I am a programmer so that part doesn't worry me, it's all this hardware stuff! Don't worry yet, as I'm not close to building this yet. I'll do some investigation on my own and come back with questions. thanks.
 
well cost is very minimal to get started in playing with the arduino... i think i got a package from adafruit that basically had a bunch of lil tiny starter projects in it... after i outgrew those i just started to tinker some... i say pull the trigger and go for it... you can find all sorts of nifty projects out there to do with the little board
 
thanks for posting this. the arduino boards look like a lot of fun to play with (great, i smell another hobby in the making!)... if you're so inclined, i would be interested to see pictures of the wire assembly and whatnot, but i imagine it would be kinda time consuming... looks really cool though, nice work. just an idea for you, I ended up pulling apart an old meat thermometer we had so i could cover my thermistor with a stainless steel probe, just kinda electrical taped the top to the wire coming out of it... makes it look tough.

one question, is that a power strip you're using for switched outlet(s)?
 
Nice setup!

I've done something similar, although I just have my arduino connected to an old laptop and it's just sitting there logging the temperature of my fermentation chamber.
For the other folks that are curious about the arduino there is an awesome webpage at:
Arduino - HomePage

To wire up my thermistor I used a circuit pretty much identical to this:
Arduino playground - Thermistor
 
This is cool! Will you build a pcb and everything?

I'm actually building something similar using a PIC 16F877A. My LCD and my peltier unit are on its way from ebay. Meanwhile, I simulate my hardware using Isis 7; it's a ucontroller simulation software. Here's a screenshot of my project!

simulation_pic.jpg


(I use 2x LM35 temperature sensor, 3x push-button (up,down,ok button), 1x 4-bit lcd, 1x pwm controlled peltier unit and a few LED for system information.)
 
i'll throw take and throw on some pics tomorrow after work... had a long nite of drinkin at my dart league and really dont feel like doing a damn thing now...


This is cool! Will you build a pcb and everything?
um i was jsut going to take a simple radioshack printed circuit board and solder everything on there... but i can give some detailed schimatics of everything i put into it with the pics.,...


idea for you, I ended up pulling apart an old meat thermometer we had so i could cover my thermistor with a stainless steel probe, just kinda electrical taped the top to the wire coming out of it... makes it look tough.

one question, is that a power strip you're using for switched outlet(s)?

the 1-wire device i used is a lil big for a lil stainless sheild probe... somewhere on here i saw the details to use an old ss tube out of a corney to house somehting like this... can prolly search for it...
and yes i am using the surge protector... basically i stripped away the insulation that contained the 3 wires, and took the hot wire going into the surge protector and hooked that into the relay... when the relay breaks the circuit its the same as hitting a light switch to it.

TwoHeadsBrewing Wow, very cool. Is this a single or dual stage temp controller?
um i dunno exactly what you mean by this... currently i have one of the temp sensor outside the fridge just getting the rooms temp, and the other one is in it... i could easily put a second device in the fridge and take the average of the 2 temps for the fridge if thats what you mean...
 
i think he meant can it control both the fridge and a heating element separately... thanks for the surge explanation.
 
Well, you obviously have a different definition of sexy than I do, but I will give you big props for posting the code and the pictures. :mug:
Very cool, please post instructions, I'm sure with a lot of questions and answers it could become the greatest thing since the son of sam fermenter.
My hope for humanity has just been boosted.
 
oh... yeah it can easily also be setup to power a heater along with the fridge... thats as simple as adding maybe another 5 lines of code and one more relay using only 1 pin on the arduino
 
That looks like a cool build, but I don't think I could justify it to save money, seeing how I can get a temp controller for 80-90 bucks and you are into this about 80 bucks?

Granted the lcd is a cool (pun intended) feature. So on the coolness factor I could justify it.
 
i really dont plan on using it as a saving money build ... i had the arduino laying around... and basically, minus the lcd, the rest of the build only cost me $20
 
I have been working on a similar project with a PIC18F... right now kind of hung up on the thermistors and lack of time... Too much time spent enjoying the new kegs I bought. :)
 
I have been working on a similar project with a PIC18F... right now kind of hung up on the thermistors and lack of time... Too much time spent enjoying the new kegs I bought. :)

that's exactly why i switched from thermistors to the 1wire devices... i was sick of the god damn algebra i had to do to figure out the slope of the line to calibrate that *****... god damn graphing, y = mx + b, and having to calculate resistance at precise temps... i love just being able to type in a simple request and it tells me the temp in C or F:drunk:

sorry i didnt get the pics and detailed schimatics uploaded this evening... was too buisy preparing the leagues darts website for the statistician to enter stuff this weekend... adding another division required a lil more php than i was hoping for.. * Pocono Dart League * :off:
but i can all but promise i will find time tomorrow during work to play with that stuff for you all.

anyways, back to some homebrew, and a some rest!:rockin:
 
Wow! pretty slick!

I might build one for my kegerator.
Just to make sure, can it work in both degrees C & degrees F?

yup... it sure can! maybe ill comment the code a lil better so you can see how it works a lil better
 
I recently picked up an arduino myself, for jobs like this.
Unfortunately it has just sat around. But since I saw this thread today, I think I'll get off my arse and finally do something with it. (when I get around to it) :cross:
 
This is cool! Will you build a pcb and everything?

I'm actually building something similar using a PIC 16F877A. My LCD and my peltier unit are on its way from ebay. Meanwhile, I simulate my hardware using Isis 7; it's a ucontroller simulation software. Here's a screenshot of my project!

simulation_pic.jpg


(I use 2x LM35 temperature sensor, 3x push-button (up,down,ok button), 1x 4-bit lcd, 1x pwm controlled peltier unit and a few LED for system information.)

Can you point me in the direction of that Isis 7 software, please?
 
If you are offering, I'd love a zip of your source so I can adapt it to my project... It'd save me a ton of time.
 
If you are offering, I'd love a zip of your source so I can adapt it to my project... It'd save me a ton of time.

If you are referring to the original poster, just copy/paste it from his 2nd post. That's all you need!
 
ok so here's the crappy schematics i was able to draw up in paint... lol... i tried to make it so anyone can read it with out any electrical knowledge...

http://www.guestlinx.com/joe/thermcontrol.jpg

i think that should help out pretty well.... so if you take those components, and just throw my exact code from my second post and put it all together, it will by default keep your fridge or freezer at ~42deg....

another nice thing about the 1 wire therms.... you can dasey chain as many of them as you want without using any more pins on the arduino...
 
Great hoe,

Thanks for the feedback.

That might sound like a dumb question since I have 0 electrical knowledge,
but what relay did you precisedly use?
(a link to the product would be cool).

Also, how did you connect the thing to the existing fridge temp control?
 
Great hoe,

Thanks for the feedback.

That might sound like a dumb question since I have 0 electrical knowledge,
but what relay did you precisedly use?
(a link to the product would be cool).

Also, how did you connect the thing to the existing fridge temp control?

http://www.sparkfun.com/commerce/product_info.php?products_id=9096

this is the pcb for the relay control.... basically get all the required parts it lists on this page and then solder them in *really really easy*... as for how it works with the existing temp control... well it doesnt.... what you do it turn your temp control to the coldest setting in your fridge and hook this into the power supply.... this then controls the power to your fridge, much like unplugging it then it get cold enough and then plugging the fridge back in when it gets too warm....

lemme know if you need anything else :) always glad to help cause ive learned so damn much in the 5 weeks ive spent snoopin round the forum
 
This is a great little intro project for the Arduino. The overall concept is great, but it looks like you may be asking a bit too much of the digital pin used for relay control. The Arduino is designed to provide up to 40 mA of current on each digital I/O pin, but your relay coil is pulling 185-200 mA (per the datasheet). There's a chance that your design will work forever without issue, but there's a bigger chance that it will fail prematurely. Consider using a transistor as an intermediate switching device between the Arduino and the relay. Here's a good link to point you in the right direction:

http://www.kpsec.freeuk.com/trancirc.htm
 
This is a great little intro project for the Arduino. The overall concept is great, but it looks like you may be asking a bit too much of the digital pin used for relay control. The Arduino is designed to provide up to 40 mA of current on each digital I/O pin, but your relay coil is pulling 185-200 mA (per the datasheet). There's a chance that your design will work forever without issue, but there's a bigger chance that it will fail prematurely. Consider using a transistor as an intermediate switching device between the Arduino and the relay. Here's a good link to point you in the right direction:

http://www.kpsec.freeuk.com/trancirc.htm

there is a transistor there yuri, if you look http://www.sparkfun.com/commerce/product_info.php?products_id=9096 there, you will see it does use a Transistor (COM-00521) :)
 
ok so last week i kinda killed my lcd that i had displaying all the data temporarily *dont ask* so until i can get a replacement for that i needed a way to display my data easily... well here is the solution i came up with... data show an example from last nite into today...

graph.png


basically what i did was take a spare laptop that i had sitting around that had ubuntu on it, and set it up to run a python script that would take the data from the arduino and throw it together on a graph and then display it on a simple web page... the result? now i can check my kegerator temps from anywhere that i have vpn access... :rockin:
 
lol you think thats epic, wait till i add a few more temp sensors since i ferment in that same room, and a photoresistor to measure the light in the room.... finally i could throw a weight sensor on the floor of the fridge to see how much beer i have left in the keg :)... can throw all that data on the same graph too
 
lol you think thats epic, wait till i add a few more temp sensors since i ferment in that same room, and a photoresistor to measure the light in the room.... finally i could throw a weight sensor on the floor of the fridge to see how much beer i have left in the keg :)... can throw all that data on the same graph too

Now you're speaking my language! Make it happen so I can droll at your pictures some more! :D
 
idk if this could be used as well for monitoring the fermentation...... http://www.sparkfun.com/commerce/product_info.php?products_id=8880 it says it is an alcohol gas sensor, like the ones used in breathalyzers.... at the price, i dont know if it would hurt to try.... and if it didnt work for that, it could be a fun addon to but by the kegerator for those nites when the friends wanna drive home ;-)

another option for monitoring the fermentation could be this bubble logger... https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=131
it monitors how many bubbles go through the airlock per hour
 
Back
Top