DIY Sous Vide Cooker with Feedback Control


Uploaded by nerdkits on 14.05.2012

Transcript:
Hi. Many of the projects we undertake here at NerdKits we do because we want to teach
a specific topic, or just because we want to show off something cool.
Sometimes, though, we put together a project out of genuine desire to use the final product.
In this video tutorial we are building a temperature controlled immersion water bath for sous vide
cooking.
Sous vide cooking involves cooking food in sealed plastic bags inside a temperature controlled
water bath.
The idea here is that we can precisely control the final temperature at which the food gets
cooked by setting our water bath to that temperature and then leaving it in there for a very long
time.
In theory, this should allow you to have perfectly cooked food that is the correct doneness all
the way through.
It also allows you to experiment with cooking different foods at different temperatures
to achieve new consistencies that you might not be used to, and may or may not be very
good.
Professional kitchens have had these water baths for years, and there now exist versions
for home use, the most common ones retailing for over $400.
For our version, we took a crock pot we got from Walmart for $15, some parts we got from
Home Depot, and a NerdKit, and put together a pretty effective sous vide cooker.
There are some possible food safety concerns with low temperature cooking, so take a look
at the project page on our website for some resources that will help you sous vide safely.
The first step to the project was figuring out how to control the power being delivered
to the crock pot so we could control the temperature of the water.
The slow cooker does have a little dial that is supposed to set the temperature, but it
is no where near accurate enough for our needs.
Some sous vide projects out there modify the crock pot and replace this mechanism with
a more controllable version.
However, we wanted to do this project without opening up or modifying the crock pot at all,
or having any custom circuitry that touched the high voltage wall outlets directly.
What we ended up with was this setup here.
From Home Depot we got a dimmer switch, a wall plug receptacle, and a box to mount it
all in.
We connected one of the outlets of the receptacle through the dimmer switch, and ended up with
what is essentially a portable dimmer switch box.
By connecting our crock pot to this outlet, we can control the amount of power being delivered
to the crock pot's heating elements.
Here, we are making an assumption that the internal circuitry of the crock pot wasn't
doing anything fancy between the wall plug and the heating elements, but given that it
cost $15, it's a pretty good bet.
Step two is figuring out how to control the crock pot programmatically.
Again, we wanted to avoid having custom built circuitry that plugged directly into the wall
outlets, so we instead came up with a mechanical solution to actuate the dimmer switch.
We took a servo motor, and just glued it to the top of the dimmer switch.
Then, we built a little cardboard housing to hold it all in place.
Given this setup, we are able to programmatically control the position of the servo, which in
turn controls the power being delivered to the heating coils.
To measure the temperature of the water, we made waterproof temperature probes.
We basically took the LM34 temperature sensor that ships with our NerdKits and soldered
long wires to it, then applied heat shrink to the whole thing.
We used a special type of heat shrink that has glue on the inside to help with waterproofing,
but you can just use a little super glue over the edges if you don't have this type of heat
shrink.
Now that we have a temperature sensor and a way to control the crock pot from our code,
we can start trying to understand the system we are trying to control.
The first thing we did was try to control the system manually, basically using our brains
to close the feedback loop and try to keep the water at a certain temperature by actuating
the servo.
While this was a fun game to play, we learned that this system is really hard to control.
To get a better idea of why, let's try to get a thermal perspective of how the crock
pot works.
The heating coils are at the very bottom of the outside hull of the pot. This is the part
that gets hot.
Sitting on top of the metal is a heavy ceramic pot, which is where the water is held.
The metal hull and coils are both pretty good heat conductors, so they heat up fairly quickly.
However, both the ceramic pot and the water in the pot are really
big thermal masses, which require a whole lot of energy to heat up.
Controlling these big thermal masses with a comparatively small heat source like you
have in a crock pot is analogous to driving a big heavy boat that has a tiny engine in
the back.
You have to run the engine full blast to get it moving, but once you do get it moving,
it can be really hard to get it stopped.
We can also explore this system as a feedback system.
We have our input which is the amount of power we apply to the coils, and there is some transfer
function from that, to the actual temperature of the water.
With a human in the loop, you observe this output and you become the controller that
sets the input based on the current temperature.
In this system the "plant" has a very slow time constant, which is part of what makes
it so hard to control.
At this point we went back to the drawing board and rigged up a second temperature sensor.
We put this sensor in the wall between the ceramic pot and the outside wall of the crock
pot.
While at first this sensor might seem a little useless, it actually lets us do something
pretty neat.
Since the temperature sensor is measuring the air temperature surrounding the ceramic
pot, it tells us the temperature with which we are trying to heat up the water.
More importantly, the difference between this "hull" temperature and the water temperature
tells us something very direct about the rate of energy we are putting into the water.
By measuring the hull temperature we can build a feedback loop around just the temperature
of the hull.
This system is much faster (order of minutes), which allows to build a pretty tight feedback
loop around it.
Armed with this "inner" feedback loop, which allows to set the temperature of the outside
hull, we can design the feedback loop for the full system.
We use the difference between our target temperature and the current temperature of the water to
set a desired temperature difference between the two sensors.
When the actual water temperature is much lower than the desired water temperature,
the system will command a very large outside hull temperature.
This will cause the water temperature to rise and close the gap with our desired water temperature.
The closing gap will cause our feedback loop to lower the outer hull, and it will keep
doing this until an equilibrium is reached.
Hopefully, this is exactly at our setpoint for the water temperature.
We don't have time to go too in depth about this in the video, but the use of feedback
is really cool here.
There are three major issues that the proper application of feedback helps us address in
this project:
First, there's a nonlinearity.
In this case, that means that we can only vary the heater power between 0 and 100%.
We can't actively remove heat from the water bath, and the heater in this crock pot isn't
too powerful.
Second, there are significant delays.
We're talking about time constants of half an hour or more between the heater and the
water.
Third, there are disturbances and modeling uncertainties.
We get disturbances from adding refrigerated food to the sous vide cooker, or taking the
lid on and off, or even fluctuations in the ambient room temperature in the kitchen.
While some would assume that a single temperature sensor with a generic PID controller would
let us address all three of these, the fact is that by using a second temperature sensor
in the right spot, our inner control loop can better work around the nonlinearity and
delay imposed by the thermal system.
The inner control loop is able to have a much higher bandwidth because its sensor responds
much more quickly, and this means that the outer loop is much better insulated from the
effects of the nonlinearity.
Plus, we can do all this while keeping our code very simple and understandable.
That's something you wouldn't get no matter how long you tweaked your PID gains.
We might do even better if we made our inner and outer loops have some integral terms,
but we'll leave that as an exercise to the viewer.
In practice, our sous vide cooker is able to keep the temperature to within about 1
degree of the desired setpoint.
That's good enough for us to get some of the tenderest pork I have ever had in my life!
For more information about our kits, or more videos like this one, please visit us at http://www.nerdkits.com/