 |
|
09-15-2009, 07:27 PM
|
#1
|
|
Feedback Score: 0 reviews
Join Date: Aug 2009
Location: poconos
Posts: 24
|
My Ugly *but kinda sexy* temp controller
|
|
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:
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
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.
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!!!!!!
Last edited by thegreathoe; 09-17-2009 at 11:25 PM.
|
|
|
09-15-2009, 07:29 PM
|
#2
|
|
Feedback Score: 0 reviews
Join Date: Aug 2009
Location: poconos
Posts: 24
|
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!
|
|
|
09-15-2009, 07:34 PM
|
#3
|
|
Biscuit Enthusiast
Feedback Score: 0 reviews
Join Date: Jan 2009
Location: NW Portland, OR
Posts: 1,094
Liked 2 Times on 2 Posts Likes Given: 1
|
This is sweet! Looks fun to build. I have been wanting to play with arduino.
Do you think you could post some instructions for this type of build?
Last edited by Picobrew; 09-15-2009 at 07:36 PM.
|
|
|
09-15-2009, 07:43 PM
|
#4
|
|
Feedback Score: 0 reviews
Join Date: Aug 2009
Location: poconos
Posts: 24
|
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.
|
|
|
09-15-2009, 09:04 PM
|
#5
|
|
Biscuit Enthusiast
Feedback Score: 0 reviews
Join Date: Jan 2009
Location: NW Portland, OR
Posts: 1,094
Liked 2 Times on 2 Posts Likes Given: 1
|
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.
|
|
|
09-15-2009, 09:41 PM
|
#6
|
|
Feedback Score: 0 reviews
Join Date: Aug 2009
Location: poconos
Posts: 24
|
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
|
|
|
09-15-2009, 09:47 PM
|
#7
|
|
Feedback Score: 0 reviews
Join Date: Feb 2008
Location: Chico, CA
Posts: 3,930
Liked 19 Times on 19 Posts Likes Given: 2
|
Wow, very cool. Is this a single or dual stage temp controller?
|
|
|
09-16-2009, 01:21 AM
|
#8
|
|
Feedback Score: 0 reviews
Join Date: Jan 2009
Location: Ames, Iowa
Posts: 3,108
Liked 30 Times on 24 Posts Likes Given: 2
|
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)?
|
|
|
09-16-2009, 01:51 AM
|
#9
|
|
Feedback Score: 0 reviews
Join Date: Jan 2009
Location: Madison
Posts: 42
|
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
|
|
|
09-16-2009, 02:11 AM
|
#10
|
|
Feedback Score: 0 reviews
Join Date: Feb 2008
Location: Montreal, Canada
Posts: 102
Liked 2 Times on 2 Posts
|
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!
(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.)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
|
|
|