Thursday, 26 July 2012

Sous Vide cooker with Arduino

Filed under: Uncategorized — Michael @ 15:28

A while back I came across Sous Vide cooking. (I also occasionally cook, among my other interests.) Sous Vide is French for “under vacuum” and refers to a style of cooking where the food is sealed in a bag and cooked at a controlled temperature in a water bath. I tried a couple of experiments using a pot of water on the stove with me as the temperature controller, switching the stove on/off while watching a thermometer. The results were certainly worthwhile and prompted me to explore the possibility of building a temperature controller using the Arduino, a very capable micro-controller hardware/software platform, and a hot plate. A search of the inter-tubes quickly showed that I was not alone and that many had traveled this or a similar road. (One reason for DIY is the relatively high cost of commercial Sous Vide appliances. At least in my case it was. And besides, hacking something together would be fun.) Most of the existing DIY attempts were either pretty crude or too sophisticated for me (and my budget). And I’m kind of a re-invent the wheel sort, anyway.
I figured a good first place to start would be to get a sketch going that would read the temperature. (‘Sketch’ is an application program in Arduino-speak.) The result is the library I described in the last post.
I knew I wanted the end result to be stand-alone and that meant some kind of user interface. The great folks at Adafruit had just introduced their LCD Shield with a 16×2 display and input buttons. I ordered one and started work on a display/menu system. Soon, I was able to set the desired temperature and display the actual vs. goal temperatures. It was easy enough, then, to send a control signal, based on the water temperature difference, to the hot plate.
Now, I needed to turn on/off the 230V mains using a 5V signal from the Arduino. The answer was a solid state relay but they aren’t cheap so I built one. I used the MOC3041M triac driver and a BT139/600 triac using the basic circuit described in the Fairchild Semi MOC3041M datasheet. The triac is mounted to a processor heatsink (way bigger than necessary) salvaged from an old PC. It easily controls power to the 230V, 1800W hot plate I am using.
Putting it all together, the first tests showed that, in concept, everything worked! But the hysteresis of the system was way too large, swinging 15-20 degrees over the goal temperature. So, simple on/off control was not going to work. A post to the Adafruit forums and within minutes I learned that what I needed was a PID control algorithm. That’s Proportional/Integral/Derivative and it’s a basic concept in systems control. I had something new to learn about! The Arduino Playground page had a couple of implementations of PID. I chose the PID Library written by Brett Beauregard. (For this purpose, it is slightly modified and is the PID_SV library in the attached code.)
I added to the menu/display code to allow setting the PID parameters and monitoring the PID output on the display. It is still just in the breadboard stage but all is working very well allowing temperature control within a couple of tenths of a degree. Here is a picture of the system spread out on my workbench.

The next step is to package this all up. For the electronics, I have a chassis that is just the right size for the hot plate to sit on. And I’ll make a separate unit to place in the pot that holds the temperature sensor and a circulation motor/propeller.
If you want to see the current state of the code, click here to download a zip file with the sketch and the necessary libraries. I have run this on the Arduino Duemilanove and Uno.

Sunday, 1 July 2012

Arduino library for DS18x20 temperature sensor

Filed under: Uncategorized — Michael @ 22:11

I wrote an Arduino library for the MAXIM DS18B20 temperature sensor sold at Adafruit Industries. (The library also works with the DS18S20.) Based on the Arduino OneWire library, I think it’s a pretty good start for anyone who wants to use this device. To download, right-click here and save it somewhere.
Let me know if it’s useful to you.