Arduino Sous Vide, Version 2.0

I previously built a sous vide machine based off Seattle Food Geek’s plans but with an arduino + relay in place of the PID. It ran off a shoddy script I wrote in Python to be used with Pyfirmata. The recommended Norpro heating devices in the Seattle Food Geek blog failed within 10 uses and the Pyfirmata script required a computer to be plugged into the arduino. It worked but was hardly optimal. This new sketch is written in C and doesn’t require Pyfirmata or an additional computer to be plugged into the arduino.

Very simple, works great!

The Sketch

// A simple arduino sous vide machine sketch

void setup() {

Serial.begin(9600);
}
void loop() {

// set pins and mode
// set relay pin and relay status to off
const int relay_pin = 2; 
int relay_status = LOW;
pinMode(relay_pin, OUTPUT);

int analogValue = analogRead(A0); // read the raw value for thermistor via analog pin0

// assign variables
float temperature; // the current temperature
float upper;       // the upper limit at which the relay & heat source shut off
float setpoint;    // the desired setpoint cooking temperature
float lower;       // opposite of upper
float steinhartA;  // steinhart-hart equation coefficients
float steinhartB;
float steinhartC;
float rt;          // thermistor resistance

setpoint = 60.0;   // desired cooking temperature in degrees C 
lower = setpoint - 1.0; // can manually edit cutoff values to affect hysteresis curve
upper = setpoint + 1.0;
steinhartA = 1.137699953e-3; // replace with your thermistor's unique steinhart-hart coefficients
steinhartB = 2.325339915e-4;
steinhartC = 0.9547893220e-7;

rt = 9910*(1023/float(analogValue)-1.0);
temperature = steinhartA + steinhartB*log(rt) + steinhartC*(log(rt)*log(rt)*log(rt));
temperature = (1.0/temperature)-273.15; // convert from K

Serial.println(temperature); // debug, print temp to serial

if (temperature >= upper)
{
relay_status = LOW; 
digitalWrite(relay_pin, relay_status);
Serial.println("RELAY OFF"); // debug, print status to serial
}

else if (temperature <= lower)
{
relay_status = HIGH;
digitalWrite(relay_pin, relay_status);
Serial.println("RELAY ON");
}

delay(30000);        //  30s delay between temperature reads
}

How to use

Use it with a thermistor, relay, and a heating device of your choice. Edit the setpoint temperature to your desired temp and be sure to edit the Steinhart-Hart values to reflect those of your thermistor. If you wish to change the temperature, you will need to upload an updated sketch (for now….).

My current setup

A few things have changed since my previous posts. Since my immersion heaters have failed, I had to find a new heating source. A commenter recommended a turkey roaster which sounds like a fantastic idea (and they look very similar to lab water baths which is a plus). I was averse to spending any more money on this project though so I scavenged around the house and am currently using a hot plate with a large stockpot on top. The stockpot holds an excess of water which helps maintain a more constant temperature and the pot + large volume of water retains heat better than the thin sterilite container used previously. Its greater size allows me to fit larger cuts of meat in it also which is a big plus. Getting heat up to the setpoint temperature no longer takes a century with the hotplate which is also very nice.

I am using a 10k ohm thermistor that I had laying around as I misplaced the old 4.7k ohm thermistor. I only mention it in case someone looks at any old posts and is left scratching their head over the sudden change in equation values.

I am using the same relay setup as described previously.

Future

I am waiting on an Amazon shipment to come with an LCD screen. Once that arrives (hopefully within another 3 weeks… I live in a remote location!), I will feature creep this sketch to include a live temperature readout and the ability to configure setpoint temperature without needing to modify the sketch and reupload.

Further resources:

My other posts on arduino sous vide

How to use a relay with an arduino

Seattle Food Geek sous vide machine

Everything you would ever want to know about using a thermistor with an arduino

Thermistor calculator

 

One thought on “Arduino Sous Vide, Version 2.0”

Leave a Reply

Your email address will not be published. Required fields are marked *