DIY PID Controlled Sous Vide Using a Crockpot

I recently picked up a copy of Jeff Potter’s excellent book, Cooking for Geeks: Real Science, Great Hacks and Good Food (Amazon Link). In the book, Potter discusses Sous vide cooking, French for “under vacuum”, this is a method of vacuum sealing food and cooking in a temperature controlled water bath for an extended period of time. The effect is that the temperature gradient across sous vide cooked food is small and has an even “doneness” the entire way through.  By carefully selecting the temperature of the water bath, the chemical reactions that take place during cooking can be selected.

Potter presents a DIY method of building your own sous vide cooker with a crock pot and temperature cutoff switch.  This is probably good enough for any use I’d have, but as somebody with a bit of controls background, I felt like I could do better: a PID controller to maintain the water bath temperature.  PID control allows for closed-loop feedback to regulate the temperature to respond to disturbances and minimize control deviations such as setpoint overshoot.

Consumer temperature controlled sous vide units exist, but typically sell for around $500.  I decided to build my own, as my controls engineer friend put it: “you have the rightful indignation of somebody who knows they’re getting ripped off.”

I decided to combine Potter’s approach with my controls knowledge to build the plug and play crock pot PID controller that can control the cooking temperature to within 1°F, which is probably far more precision than is necessary.


The controller is generic and works with any crock pot with an analog on/off switch.  The crock pot is set to the on position (‘high’) and a temperature probe is inserted into the pot.  The user sets the desired cooking temperature and the controller does the rest.

Why PID?

By itself, a crock pot does a poor job of maintaining an arbitrary constant tempature (not sure what the disturbances at the beginning are):

Using the temperature cutoff method suggested by Potter, the control is fairly good:

Notice how the temperature overshoots the target by 2 – 3°F and how the temperature spends time below the desired setpoint.  The overshoots are caused because heat is applied until the measured temperature exceeds the setpoint, there is a delay between when heat is applied at the bottom and the water around the temperature sensor in the middle of the pot heats up.  By that time, too much heat has been applied.  This is pretty good, but we can do better.


At the heart of the controller is an Arduino Pro Mini.  This receives temperature input from a Dallas 1-Wire DS1820 sensor inserted into a thermowell.  The Arduino manipulates an opto-isolator/triac combination to switch the power on/off to the crock pot, which is a standard 5 qt crock pot.  Status is displayed on a Sparkfun Serial LCD screen and settings are changed through a button pad.  A zero-cross detection IC (H11A1) detects the zero point on the AC line to allow for heat control.  Power to the crock pot is controlled by quickly turning the triac on and off, truncating the AC waveform, similar to an incandescent light dimming circuit.

A single 120V AC line powers both the microcontroller and the crock pot. A gutted 9V DC wall wart taps into incoming AC lines. A voltage regulator (not shown in the schematics) converts the power into 5V that the microcontroller can use.

A summary of the major components:

  • Arduino Pro Mini – Sparkfun DEV-09218
  • Sparkfun Serial Enabled 16×2 LCD – Sparkfun LCD-09395
  • 1-Wire Temperature Sensor – Maxim Dallas DS1820 (hint: request free sample)
  • Thermowell compatiable with 1-Wire sensor – Brewer’s Hardware
  • Wall Adapter Power Supply 9VDC – Sparkfun TOL-00298
  • Simple Crock Pot, any will work – Crock-Pot SCR500SS
  • Optoisolator MOC3020 – 3023 – Incorrectly shown as MOC3042M in the schematic
  • Zero-cross Detector H11AA1 – Incorrectly shown as H11AA1M in the schematic
  • Isolated Gate Triac Q6008L5- Incorrectly shown as BT136 in the schematic, any triac should work
  • AC Connector Male – Digikey CCM1400-ND
  • NEMA AC Receptacle – Digikey Q337-ND
  • Resistors values as shown – Note that some readers have found it necessary to decrease the value of R4 to ~240 ohm to get the optoisolator to fire


The Eagle schematics and layouts are provided in the downloads section.  Please see the parts list above for the correct part numbers.


To aid in the discussion, I use the following terminology:

  • PV – Present Value, the current value of the temperature sensor in the water bath, in °F.
  • SP – Set Point, the desired temperature of the water bath, also in °F.
  • OP – Output, the amount of heat that the crock pot is currently applying to the bath.  My controller allows for 255 levels of heat, 0 is none and 255 is full on.
  • Mode – Operating mode of the controller.  ‘Auto’ uses the PID algorithm.  ‘Cutoff’ applies full heat until the PV exceeds the SP, at which point the heat is turned off.  ‘Manual’ allows the user to set the OP directly with no control algorithm.
  • K – Proportional constant
  • τI – Integral constant (min)
  • τD – Differential constant (min)


I won’t go over the theory or background of PID controllers, there are already plenty of sources that cover that in detail, however, details regarding the tuning of this controller are covered in the aptly named Tuning section.

I opted for the discrete PID type B equation to calculate the required output:

  • k = control index, incremented each cycle
  • e = error = SP – PV
  • ƒ = control frequency (min)

The traditional equation (type A) uses error for the proportional, integeral and differential elements.  This can lead to large changes in the OP when the SP is changed.  In type B, the error is used on the proportional and integral terms and the PV is used on the differential.

The zero-cross chip is connected to one of the interrupt pins on the Arudino.  When the AC signal crosses the zero point, approximately every 8.3 ms, an interrupt routine calculates the next time the power to the crock pot should be turned on based on the OP and the microseconds since the program started (micros()).  For low and high OPs, the power is either completely on or off due to main program loop overhead and input checking.

At the start of each program loop, micros() is checked to see if its time to turn on the triac and power the crock pot.  If it is time, the power output pin is set high and the triac is set.  After a small delay to ensure the triac sets, the output pin is set low, the triac will remain on until the next AC zero-cross, at which time it will reset.

Next the program loop checks if a new temperature from the 1-Wire bus is available to read (every 10 seconds).  The temperature sensor is setup in a parasite power configuration, so it can take upwards of 750 ms for the read to be complete.  If the temperature is available, it is read off the bus and checked for validity.

If the control Mode is ‘Auto’, and it is time to take a control action (every 30 seconds).  The new OP, based on the current temperature, is calculated using the above PID equation.  It is ranged to be within [0…255].  Old values of the PV, OP and errors are stored to aid in the calculation of the PID equation (the k-1 and k-2 terms).

If the Mode is ‘Cutoff’, then the PV is checked against the SP.  If it is above the SP, then the OP is set to 0, otherwise the OP is set to 255.

The display is updated and the button inputs are checked.  Any changes to the SP or Mode are handled.  Then a temperature read is started on the 1-Wire bus if necessary.  The whole process starts again.  The timing in the main loop isn’t perfect (i.e. button presses will slighly throw off the heat rate), but the deviations are smoothed out over the long run.

There are additional features in the code (e.g. various safety checks and interlocks, PID initialization, LCD control) that have not been discussed.   The full code is available below in the downloads section.


The key to an effective PID control is the proper selection of the K, τI and τD tuning constants.  These constants depend on the system gain (change in PV for change in OP) and the system deadtime (delay between a change in OP and a response in the PV).  These are in turn factors of the size of the crock pot, the amperage delievered to the heating coils, the volume of water in the bath and so forth.

Note that cheaper crock pots may or may not have different peak temperatures depending on the setting.  I always kept my crock pot set to high to get a better range of controlability.

This system is simple and can be modeled as a first-order system with dead time (see uncontrolled response graph above).  The transfer function for this system:

Where G is the system value.  The parameters that define the system (and hence its tuning) are present.  K is the gain, td is the dead time and τ is the time constant.  s is in the frequency domain and can be converted to the time domain using a Lapase transform.  A rigorous application of first principles, transfer functions and Lapase transforms yields a model that would allow us to pick tuning constants and see the time dependent behavior.  Though useful, it is extremely academic and not often applied in the real world.

Instead, we’ll use an open-loop tuning method.  For this, we allow the system (the crock pot) to reach steady-state (a constant temperature) by applying a constant amount of power.  Once at steady-state, we make a step change to the power and again allow the system is come to steady set.  This allows us to determine the gain, time constant and dead time of the system.

Allowing the system to come to steady state, the open-loop step response curve was developed:

The time constant, τ, is defined as when the process reaches 1 – 1/e = 63.2% of its final value.  The dead time, td, is the delay between changing the OP and a response in the PV.  For my particular crock pot,

  • τ = 266 min
  • td = 17 min
  • K = 3.44 °F/#

There are a variety of open-loop tuning methods that determine the K, τI and τD tuning constants based on the previous constants: Ziegler-Nichols, Cohen-Coon and ITAE.  The formulas for these various methods yielded the following results:

Each of these methods are designed to tune in different ways and serve as a starting point for manually tuning the process.  Ziegler-Nichols tunes for an aggressive quarter-decay ratio and tends to overshoot the SP, but it does better at rejecting distribances.  Cohen-Coon is intended to be an improvement to Ziegler-Nichols.  Regardless, all these methods assume the classic PID type A equation.

I used the Cohen-Coon values as the starting point for my tuning.  Then I disturbed the system (added ice) and watched how the system responded.  I ended up with my final tuning values of:

  • K = 0.1
  • τI = 150
  • τD = 0.45

The small proportional constant limits large OP changes due to large deviations from the SP and maintains some stability.  The larger integral term limits the time spent away from the SP, at the risk of some overshoot for large changes.   The derivative term limits the overshoot, it is small to limit the introduction of noise into the system from noise in the temperature measurement.  Due to the jumpiness it can cause, often the derivative component is not used, creating a PI controller.

These constants work quite well.  Notice how the overshoot from the SP is limited to 3.5°F and once the control is working properly, the deviation is limited to ~1°F (the square pattern is the effect of the low resolution DS1820 temperature sensor, only accurate to 0.5°C).  Heat is applied over time to maintain temperature and the PV never drops below the SP over a course of  2 days!


For awhile, I’ve been wanting to try Ponoko.  You upload a design and they will fabricate it using a laser cutter or 3d printer.  I found a coupon code for 50% off materials and making (now expired) and decided that it was time to try the service.

Ponoko provides an extensive set of instructions and templates to help get you started.  I laid out the six sides of my enclosure with an interlocking joint pattern to hold the pieces together.  I then added cutouts for the LCD and button pad. Also etched on the front is a handy safe meat internal temeratures chart from the FDA.  I choose to have them laser cut and etch my design onto 1/8″ silver acrylic.  The manufacturing turn-around was 2 weeks.

The cuts were precise and everything fit together perfectly.  The enclosure is held together with epoxy and holes for screws were drilled by hand.

The EPS file sent to Ponoko for manufacturing is included in the downloads section.  I ended up using Adobe Illustrator to do the design instead of the free Inkscape software.  When verifying my design by printing it on paper, I found that the dimensions from Inkscape didn’t match reality.  With Illustrator my desired dimension and actual dimensions matched up correctly.


I estimate the cost of all the eletronics was ~$50.  The enclosure, including shipping, was $34.  Allowing for the cost of miscellaneous materials, the total cost was ~$100 plus time and labor.  The end result is a robust temperature control that succeeds in cooking to within 1°F of the target.

For the inaugural test I decided to try a 48 hour brisket recipe: Salt to taste, flavor with worcester sauce, vacuum seal and cook for 48 hours at 142°F.  The result is an evenly-cooked, moist and delicious brisket.

Projects Inspired by this One

Several people have built their own variations on the PID controller presented on this page.  Send a link to your write-up and I’ll add you to the list.


schController Board Schematic: Eagle schematic for the controller board. (66.77 kB)
27 Mar 2011   4384 downloads
brdController Board Layout: Eagle layout for the controller board. (18.82 kB)
27 Mar 2011   2678 downloads
schButton Pad Schematic: Eagle schematic for the button pad. (51.95 kB)
27 Mar 2011   2104 downloads
brdButton Pad Layout: Eagle layout for the button pad. (8.16 kB)
27 Mar 2011   2078 downloads
pdeSous Vide Code: Arduino code for the sous vide controller. (15.82 kB)
27 Mar 2011   6372 downloads
zipSous vide Enclosure: The layout used for fabricating the enclosure with Ponoko (73.02 kB)
27 Mar 2011   1454 downloads

I release the software and design into the Creative Commons. Feel free to modify, but let me know what you do with it.
Creative Commons License

  1. […] search of a perfectly-cooked brisket, [Aaron] recently completed this DIY  PID-controlled sous-vide slow cooker. Sous-vide (French for “under vacuum”) is a cooking technique in which foods are typically […]

  2. Eric says:

    This is very impressive, and a great way to explain PID to people unfamiliar with the principles.

    I built something similar with a cheap ($40) Chinese PID controller wired to a solid-state-relay to control a 120V outlet. Then I plugged in a turkey roaster to that outlet. It only controls in on-off fashion, but after the initial temperature overshoot it keeps my bath stable to about 0.2F. I am using a PT-100 resistive temperature device, so accuracy and repeatability is pretty good.

    I achieved [more] uniform heat results by using a submersible aquarium pump I got for $20 at Walmart. I know there are cheaper pumps online, but Walmart will let you return anything…perfect for when I’m cooking at 160F!

    My recent project consisted of cooking brisket at 150F for 72 hours, then using the same PID controller to control the temperature of my electric smoker. I smoked the meat at 200F for four hours using apple wood chunks. The meat was done perfectly.

  3. […] search of a perfectly-cooked brisket, [Aaron] recently completed this DIY  PID-controlled sous-vide slow cooker. Sous-vide (French for “under vacuum”) is a cooking technique in which foods are typically […]

  4. […] search of a perfectly-cooked brisket, [Aaron] recently completed this DIY  PID-controlled sous-vide slow cooker. Sous-vide (French for “under vacuum”) is a cooking technique in which foods are typically […]

  5. Gio says:

    You do all that amazing work only to spoil it by putting worcester on your meat!

    On a serious note, very nice intro to PID – gonna set one up for myself sometime. I want to cook super-tender sea salt roast and maybe the grill the odd T-bone steak.
    Well done!

  6. Anonymous says:

    I call Shenanigans!

    In your “temperature cutoff method suggested by Porter” plot, it goes up 30 degrees in 40 mins, and you complain about overshoot and undershoot and say it isn’t well controlled.

    In your “improved” system, it appears to go up 40 degrees in 300 minutes?!!?! So you cranked it from high to low on the crockpot or doing some serious PWM, or changed amount of water. Either way, yes, it is much easier to reduce overshoot when you reduce the power to the system by huge amounts.

    One final comment, you are violating food safety by ramping up the temperature that slowly. You should be above the safe warming temperature within 4 hours to prevent botulism growth. So you might want to reprogram it to apply more heat at first until you are within a certain number of degress from the set point(?) then switch to your control theory perfect tau before you poison yourself.

  7. Aaron says:

    Thanks for the comments.

    I’ll address Anonymous’ comments:

    During both tests the crock pot was set to “High”, the temperature of the tap water does affect the heat time, I didn’t control that during my comparisons. The PID algorithm was completely responsible for setting the PWM and it tends to crank it all the way up when you’re far from the SP, you can see that it starts to step down the PWM as the PV approaches the SP.

    Yes, food safety is a consideration, the tests that you see were food free. When doing it for real, it is important from food safety standpoint to quickly ramp up to a reasonable temperature within about two hours of starting.

    • Jon says:

      So what explains the almost 3 times increase in initial warm up time between the pid method and the uncontrolled one? Based on the “Closed-Loop Response” graph it looks like the output is maxed out (255) up until the point where PV goes past the SP. this is the same output for the uncontrolled crock pot I imagine, which only takes about 70 minutes to reach 120 starting at 80.

      Also the temperature doesn’t get to the steady state until after 9 hours? Im assuming that crockpots are decently insulated so overshoot could have disastrous effects on settling time.

      I realize this was posted back in march so I also wonder if you have made any modifications to address these issues.

  8. Stephan says:

    Nice layout, I am pretty new to AC circuits and don’t quite get the way you hook up the triac and how you use the zero crossing. Do you have a reference where I can learn about that? Thank you!

  9. Aaron says:


    I truncate the AC waveform to control the amount of power the crock pot receives. The zero-crossing detection is used to know when the AC voltage crosses from positive to negative (or vice versa). From there it is a matter of timing for how much power you want to deliver. You can see graphs of the truncated waveforms here:

  10. Clay says:

    The book is by Jeff Potter, not Porter.

  11. Robert says:

    I’m curious if anyone has tweaked the enclosure layout to use one of Ponoko’s less expensive, 3.0mm acrylics (like clear)? As a Ponoko newbie, I’m a bit afraid that I’d get something wrong.

  12. Waldas says:

    Nice project

    I think it is a bug here. Should be used MOC3021 without the zero-cross detection because it is phase controlled dimming.
    Correct me if I’m wrong

    • Aaron says:

      I’m not familiar with the differences between the two component numbers. I’m handling all the phase dimming in software, so I just need to know when the zero cross occurs and I can start the current a calculated time afterwards.

    • Aaron says:

      Ah, I understand the comment now. I used an MOC3020 for that part, any part from MOC3020-3023 will work in its place.

  13. […] hundred dollars for a device that I can make for a lot less than that? There are several DIY sous vide projects on the web, one of which was featured in Make magazine issue […]

  14. John says:

    Are the resistor values in the schematic correct? Also what power ratings did you use (1/2W, etc)? This is a great project I am about half way done building one thanks!

    • Aaron says:

      The resistor values shown are correct. The 15k and 27k ohm resistors shown on the zero-cross detection circuit work well for North American mains current but may need to be adjusted if you’re on 200+ VAC, check the datasheet to be sure. Though it is complete overkill, I used 1/2 W resistors on everything just to be sure.

  15. […] Chemical engineer Aaron wanted to give sous-vide cooking a try, but didn’t like the price tag of commercially-available units, so he built his own cooker controller. […]

  16. Anonymous says:

    This is seriously impressive: I’d like to build one myself.

    I would think that if you eliminated the delay time from your model you might smooth out those bumps in the final response. It may look like it took all of 17 minutes to respond to the change in setpoint, but bear in mind how low the resolution of your instrumentation is. It may have taken that long for the difference to get big enough to see.

    As soon as you throw electrons through the heating element you get heat. I would assume, therefore, that the actual delay time is 8.3 ms or something like that.

    • Aaron says:

      Agreed, the heat is applied instantly, however the dead time is a result of the time required to increase the temperature of the thermal mass (of which water has a lot). A better heater would mitigate the dead time issues.

      I never tried a tuning model without accounting for the dead time. I toyed with the idea of using a compensator (like Smith’s), but never did it.

  17. Barton says:

    Great project, very informative. I’m a little confused about the zero cross chip. The datasheet says the max input reverse voltage is 6V, I see you have the resistors on the AC side, but that would only limit the current not the voltage right? Should you be using something like a LTV-814H that is meant for AC input?

  18. Barton says:

    Actually, I’ve been thinking about it, would the H11A1 work if if you had a protection diode for when the current reverses and set the interrupt to trigger on both rising and falling?

    • Aaron says:

      I believe the resistors would limit both voltage and current. The H11A1 is rated for AC service. I copied those resistor values from the datasheet sample circuit for AC zero cross detection, no diodes required. I’ve used those resistor values to dim christmas lights continually for a month with no failures. Hope that helps.

      • Barton says:

        Thanks, which data sheet exactly? I found a motorola, fairchild and vishay one and didn’t see any sample circuits. I was just thinking the LED in the H11A1 will only light up when the current is going one way but it won’t light up when it goes the other way? Which is why I thought you might need a part like the LTV-814H I suggested earlier. Anyways I’m planning to do something similar but with a MSP430 and this project has helped me learn a lot.

  19. Rich G says:


    I built my own PID controlled Sous Vide setup using similar components (but an immersion heater rather than a Crock Pot).

    My question is about the PID output value. I noticed that you use the PID equation value as an offset to the previous frequency (PWM) value. Other example code on the net uses the PID output directly as the PWM value (not as an offset).

    I’m trying to figure out which is correct. I also posted thi question to the DIY PID Google group, so we’ll see what they have to say also.


    • Aaron says:

      I think it depends on how your library implements it. The output offset equation that I used comes from taking the discrete time derivative of the PID control equation. I like this form because it requires storing limited historical information, is fairly stable, and is easy to range. Wiki has a brief discription of the “velocity” form of the equation (, though they appear to use a Type A equation over the Type B that I used.

  20. Kevin R says:

    I built this system. For the most part, it worked as specified, though I had to make a small code change for the DS1B20 temperature sensor.

    I’m curious how you managed the LCD… I ordered the exact same part from Sparkfun, and used your case template, but the LCD isn’t even close to fitting into the case. The cutout is in the center, but the LCD’s board extends beyond the edge of the case.

    I’m also curious why you used a breakout board for the buttons… it’s cheaper and easier to make as one piece, and still fits fine in the case.

    Otherwise, thanks lots for the design. It was a fun project.

    • Aaron says:

      Feel free to send me your code changes for the DS1B20 sensor, I’ll include it in the download section.

      I think the LCD screen fitting depends on if you get the one with the control board on the back ( or on the side (, I used the former when doing mine. I could see how not doing a breakout board for the button pad would be a lot easier, if I was doing it again, I would change the board layout.

      Otherwise, I’m glad you enjoyed the project!

  21. Anders says:

    “byte” is no longer supported by arduino – do you have a fix for that ?

    btw nice work

    • Aaron says:

      I haven’t been keeping track of arduino development. Look into ‘char’ or ‘unsigned short’, they should be equivalent to a byte. Glad you enjoyed the project!

  22. Jack Etsweiler says:

    Might as well start with water close to the target temperature. Preheat the vessel a bit, too, and you might eliminate some of the overshoot. It’s a brilliant project and I hope to get my other half, the MS-EE, to assemble one for me.

  23. bentod says:

    At work we use hot air welders to weld plastic. We made a box that has adjusts the voltage to the coil. The coil is always fed with electricity.

    What is wrong with trickling electricity to a water heater element? Couldn’t the temperature be precisely controlled? Granted, it would take some experimenting to get the voltage lined up with the temperature.

    Also, I’m thinking of using a Norpro mini mixer to keep the water moving.

  24. […] some further research, I found Aaron Stubbendieck’s web site “over-engineered.” On his site, he decided to use PID control theory to control a Crock-Pot so he could try sous […]

  25. Leigh Jones says:

    I’ve been using a 7 qt oval Rival Crockpot with various temperature control methods for real home cooking uses for many months now, and have also constructed a 25 qt sous vide cooker using a Coleman 28 qt cooler with molded handles heated by a 240 VAC 1500 W water heater element with 110 VAC applied yields about 325 watts. All there use aquarium airstones to circulate the water. The food quality has been excellent, with much new technique to learn. Hint 1: a teapot on the stove is used whenever quick temperature increases are needed, as when initially heating the water bath for tomorrow’s meal, and again when the temperature dips when the cold meat is dropped in. Hint 2: Ziplock freezer bags are effective, you never really need a vacuum sealer to do this, they are desirable when the food will be stored for days in the refrigerator after cooking.

    The PID controller adjustments needed for the Crockpot are very different from the water heater element due to the thermal mass of the Crockpot interfering with the thermal coupling resulting in significant overshoot potential. Contrast the water heater element with zero overshoot. Still, both require manual assistance getting the temperature quickly into the ballpark; this becomes a simple routine at startup.

    All beef cooks at 131F, if medium finish is desired on someone’s serving, the microwave seems the best method. All chicken cooks to 142F, often I start chicken at 132F in the morning then increase to final temp for final hour or two. Turkey breast and pork loin cooks to 148 for the final hour or two. Everything cools a few minutes before searing to keep the core temp from rising above the desired final temp during searing. Bag juices are used to flavor sauces.

  26. […] overkill. Digging around the internet, you can find folks building Arduino based projects that are WAY over engineered. Including anything on hack a day with an arduino tag. Why pay 35 bucks for a board […]

  27. Subtrac.Com says:

    Spot on with this write-up, I actually think this web site needs much more attention.
    I’ll probably be returning to read through more, thanks for the advice!

    My site; Dead Trigger 2 Hack, Subtrac.Com,

  28. William Byrne says:


    The Sous Vide range of Cooking appears to be 115 F to 190 Deg F
    I am curious at what temperature you created your PID values

    I am fairly certain that if you created PID values using an original Set Point value of 115 F they would not be adequate (particularly for Integral time) at 190 F

    I assume your PID values were created at some mid range Sous Vide Cooking value ex. 152 F, to cover a Design Level of Operation of 115 to 190 F?

    Your comments would be appreciated.


    • Aaron says:

      I did my tuning around at 120°F because that is where my water bath was at the time. My cooking range is typically in the 140 – 150°F range.

      It is not necessary to put a lot of effort into picking a temperature to tune at, it should just be a reasonable value that is somewhat representative of where you will be operating at. Over your range of 150 – 190°F the specific heat capacity of water changes by ~5% and can be considered constant and the rate of heat transfer can be approximated as linear. But there are other variables: the volume of water, the type of meat/food, and the amount of that food. Since these cannot be constant, use representative valves and allow the error correction of the PID controller to adjust for the other factors. No set of P, I, and D will address every situation.

      That being said: tune at a mid-range temperature and fill the bath up to the same level every time and the parameters should be fairly robust.

  29. BobT says:

    thanks for publishing this. I’m glad to see another arduino-based sous vide example rather than all the PID-controller ones out there. I am in the process of building one using arduino based on the adafruit design except converting it to immersion heating element, full keypad, buzzer etc. I thought your use of zero-crossing for interrupts was very clever and looks to provide you with a very precise control of energy to the heater. However, I wonder if it is overkill. Given then very slow response time of this system and the variance from water volume, outside temp, density of product being cooked etc, can the fine control provided by zero-crossing really be superior to just using a periodic timer interrupt? I look forward to your opinion

    • Aaron says:

      I chose the zero-cross method because it was the easiest way for me to control the power output. The triac can only reset at the zero-cross, so I had to time starting the load accordingly. There may be simpler ways to manage the load, but that was one I was familiar with.

      I don’t think this gains significant control advantages. I only execute the PID calculation twice a minute to minimize the response to noise, that frequency could probably be decreased and the same results obtained.

      • BobT says:

        Ah. That makes sense. I’m using a relay to turn heating element on/off so this shouldn’t be an issue for me. One more question. I understand the calculation of tau and dead time in your open-loop tuning but I don’t understand how you calculated K. At first I thought it was the ratio of increase OP to increase in PV, but that isn’t right. Where is this coming from?


  30. BobT says:

    Okay I’ve read several sources on tuning TF with dead time including the paper you refer to ( and am more comfortable with the the theory and process for calculating K. I still don’t understand how you came up with 3.44 (I see change in PV as 25 and change in OP as 20 with K = 1.25) but I think I have enough understanding to move forward with tuning my own sous vide system.

    • Aaron says:

      I don’t recall which method I used to initially estimate the K (though I think it was catered to the type B equation), I manually tweaked the constants as needed after the initial estimate.

  31. Felipe says:

    Hey, great post! I am so excited to build this thing, you can’t imagine how much!

    One problem I’m facing is the heat dissipation on the triac. I am using a shower resistor that outputs about 1700 W (I = 13 A, R = 9.5 Ohm, U = 127 V ac) to heat the water. The triac I was planning to use has a thermal resistance of 60 ºC/W without any heatsink and dissipates 15 W that current is applied.

    Doing some math the triac operation temperature would be over 900 ºC, way above the limit (115ºC)!

    So could you explain me how did you solve this problem on your setup? Some photos of it or some tips on what should I do are appreciated.


  32. […] Chemical engineer Aaron wanted to give sous-vide cooking a try, but didn’t like the price tag of commercially-available units, so he built his own cooker controller. […]

Leave a Reply