Here's a graph of my temperature curve and stability at 130 degrees over about 4 hours. If you look closely you can see that upon reaching 130, it actually only needed to kick on the heat for 30 seconds about once an hour. The average temperature over the whole 4 hour run was 130.7 degrees. That's pretty damn cool, if you ask me. Click on it for a larger version.
Alright, without further ado, in the spirit of open source, here's my code. No PID control on this one, that's my Steve Jobs code, so I won't be sharing it. But as the graph above shows, this version works pretty well. Also, it includes a pretty handy serial out so you can data log the temperature as you go.
Control the temperature of a Sous-Vide Cooker. Set the temperature and minimum cook time in this program.
The circuit:
* Digital Pin 13 controls the relay for the heating element.
* Digial Pin 12 is the heating element status indicator LED.
* Digital Pin 11 controls the relay for the circulating fan.
* Digital Pin 10 is the circulating fan indicator LED.
* Analog Input Pin A0 is the first LM34 temperature sensor.
* Analog Input Pin A1 is the second LM34 temperature sensor.
* Note: This is an extremely simple temperature controller. For PID temperature control, look elsewhere. Perhaps v2.0.
Created 19 Sept 2010
By Alex Waller
http://abstractedengineer.blogspot.com/2010/09/arduino-projects-1-sous-vide-cooking.html
*/
const int HeatingRelay = 13; // 5V input to AC relay controlling heating element
const int HeatingLED = 12; // LED indicating AC relay is closed
const int CircFan = 11; // 5V input to AC relay controlling circulating fan
const int CircFanLED = 10; // LED indicating AC relay is closed
int sensor1Pin = 0; // Set pin for LM34 Sensor 1
int val1 = 0; // Value 1 from LM34 Sensor 1
int sensor2Pin = 1; // Set pin for LM34 Sensor 2
int val2 = 0; // Value 2 from LM34 Sensor 2
double val3 = 0; // This is the average value of val 1 and val 2
float Temp = 130; // THIS IS WHERE YOU PICK YOUR SET TEMPERATURE
int Time = 24; //THIS IS THE NUMBER OF HOURS YOU WANT TO RUN AT SET TEMP
float DigitalTemp = Temp; //This is the initial value that will be replaced by the calc later
int RunTime = 0;
int OnTime = Time * 60;
void setup() {
// initialize the digital pins as an output:
pinMode(HeatingRelay, OUTPUT);
pinMode(HeatingLED, OUTPUT);
pinMode(CircFan, OUTPUT);
pinMode(CircFanLED, OUTPUT);
Serial.begin(9600);
}
void loop()
{
while (RunTime < OnTime)
{
val1 = analogRead(sensor1Pin);
val2 = analogRead(sensor2Pin);
val3 = (val1 + val2) / 2 *.48828125;
if (val3 < DigitalTemp)
{
digitalWrite(HeatingRelay, HIGH);
digitalWrite(HeatingLED, HIGH);
digitalWrite(CircFan, HIGH);
digitalWrite(CircFanLED, HIGH);
Serial.print(DigitalTemp, DEC);
Serial.print("\t");
Serial.println(val3, DEC);
delay(60000);
}
else if ( val3 >= DigitalTemp)
{
digitalWrite(HeatingRelay, LOW);
digitalWrite(HeatingLED, LOW);
digitalWrite(CircFan, LOW);
digitalWrite(CircFanLED, LOW);
Serial.print(DigitalTemp, DEC);
Serial.print("\t");
Serial.println(val3, DEC);
delay(30000);
}
}
RunTime++;
}
Good luck to you!
Recipes and images of cooked food to come.
_
A Starry Night in the Valley of the Roses
43 minutes ago
5 comments:
I don't understand the Steve Jobs comment but for anyone reading - there's a PID library already available in the Arduino Playground here. http://www.arduino.cc/playground/Code/PIDLibrary
Thanks for your writeups, they're saving me a lot of fiddle time and experimentation in building my own sous vide cooker. The only thing I'm adding beyond your system is something to agitate the water. I'm not sure how necessary it really is but the more expensive sous vide machines do it so I'm presuming there's some value. It may only have payoff in the early cooking stages when the temperatures are more disparate.
On the contrary, the submersible fan I use does a fantastic job of "agitating" the water. You can see the swirling!
Or, if you do go with an agitator, you can skip the submersible fan. My gut instinct would be that the submersible fan would allow for quieter operation.
Thanks for the update on PID control via Arduino!
Yeah I forgot about the fan between your earlier post and reading this one. I think I convinced myself you didn't have one because you're not running it constantly, which I intend to do in mine. I don't know how necessary that is, as I said, but my assumption is that during the period of time when the object being cooked and the water are still reaching equilibrium that there's some value in maximizing water movement.
My justification for not running the fan constantly is that it's running on a AA battery and can't possibly last the 24 hours some food needs to cook! If your agitator can run off wall power, then I definitely think constant agitation wouldn't hurt you!
The solution I'm planning (I am totally full of big talk here, right?) is just to use a $3 expresso frother gadget from Ikea: http://www.ikea.com/us/en/catalog/products/10076320
My assumption is that it won't take much agitation to accomplish the minimal movement. I also wanted something that I could build so that it would clamp to the side or hang down into something otherwise unmodified.
I don't intend to run it on wall power but I have a multitude of power bricks floating around at this point and figure I'll just use one powerful enough to power both the arduino and this.
Post a Comment