I wanted to try converting my crock pot into a sous vide rig. Or perhaps I should say I wanted to try building a thermostatic controller that would let me use my crock pot as a sous vide rig.
It seemed pretty simple. I'd drop a temperature sensor inside, read the temperature, and turn the heating element on and off via a 5V relay. The relay was the only really new piece of tech involved, and Meg and I'd played around with it a bit while working on an experiment from Make: Electronics.
The first problem was that while I had a couple type K thermocouples, they just had bare wire on the end, instead of nice metal covered probes. I was all set to pull the trigger on a couple $20 probes (always buy a spare!), when I read in the manual for a multimeter that you could just drop the probe into a liquid. Well, given that my Extech brand meter seems to have the same sort of bare probe with no hint of waterproofing as the probes I got from Sparkfun, I thought I should give it a try and maybe save $20. Worst case: I somehow ruin a thermocouple. Best case: I have my parts and can start with the sous vide experiments right away.
I hacked up the previous sketch I'd used with these probes to monitor my smoker so that instead of talking wireless and sleeping it would just output to serial every second or so. I grabbed a glass of hot water and tested it out by putting the probe in a ziploc bag and dropping it into the glass. It registered 98-99F, pretty consistently. I tried taking it out of the bag and it registered 98-99 as long as it didn't touch the glass, which would drop it down to 96 or 97. I think that's a success! That means I'd got all the parts I needed, right here :)
I love the portability of the arduino system. It lets me work on things out and about, instead of being confined to a dark room. In this case, I worked on the back porch until it got too warm for me.
First up, getting an LCD and inputs set up to control this thing. I don't want to have to reprogram it with my laptop each time I change the temperature, and I don't want to have to keep the laptop on the counter the whole time it's running so I can see how it's doing.
This is where having an arduino shield would be a huge win. I hate hooking up LCDs - they always seem fiddly and dreading doing it keeps me from starting projects. Sooner or later I'll do a blog post about how it's important to remove those barriers to entry that discourage working on things. I mean, I already got some blog software so I don't have to manage this thing with raw HTML...
Anyway, back to the LCD. I've got a Xiamen GDM1602K 16x2 LCD from Sparkfun, and I presciently already soldered some breakaway headers onto it so I can put it on a breadboard. Likewise, I'm going to switch from a normal Arduino to a RBBB, which will sit nicely on a breadboard. That's another labor saving technique :)
I wired up the LCD on my breadboard. I got it working, minus the backlight :( Here's what it looks like without the LCD and with the LCD. You can see that the pins for the LCD are above the screen, so I'm going to end up with my control buttons above the screen instead of below it as a more conventional layout would have them. *shrug*
I tested the LCD with the example included with the LCD4Bit library. Using the example code is always the best way to make sure you got your hardware connected right. I did run into one snag. The LCD4Bit library hard codes what pins to use, and they used some of the same pins I'd already been using for the MAX6675. What to do? I could have just redefined the MAX6675 pins. Those, at least, are easily configurable. That offended my sense of propriety, though. Instead I editted the library and moved them around. Specifically, RS and Enable needed to move so I could use pins 11-13 for the Max6675.
Once I had the example running, it was time to add the max6675 and thermocouple. That was fairly straightforward, though it did use the last bit of the end of the breadboard.
Somewhere along the way I realized that newer versions of the Arduino environment ship a LiquidCrystal library that already runs in 4 bit mode. And they let you specify what pins to use for everything. Very nice. No more hacked library.
So now I just needed to display set point in addition to current temp and add the buttons that control that set point.
Since this will only do one thing, I opted to go with the bare minimum interface - two buttons, one for up, one for down. At first, I went for all sorts of sophisticated debouncing algorithms, but eventually I just settled on running through the main loop 10x per second and reading the button then. That gave me autorepeat for free, and I didn't need to worry about tracking previous key state.
One problem: once I went to updating 10x per second, the temperature readings started going crazy. It took me forever to figure out, but apparently 10x/sec is just a little too fast for the max 6675. That seems weird, but the problem went away when I switched to a 200ms sleep in my loop instead of 100ms.
Once the readings stabilized, I put an LED on pin 4 to take the place of having a relay and played around with making it go off and on by changing the setpoint or heating up the thermocouple. Awesome. Obviously the hard part is done and all that was left to do was assemble a relay controlled power outlet and put this baby to work.
But you know that's not how things work around here, right? I started by building the relay circuit on a breadboard. No load, but just actually flipping the relay on and off. Suddenly, whenever the relay went on, the temperature readings on the max6675 went nuts. Crapola.
Adding a filter cap between power and ground on the max6675 seemed to help. I hoped that longer lead wires to the actual relay setup would solve what seemed to be a noise problem.
I with a few trials and tribulations, I built my relay controlled outlet. It's pretty much a clone of the one described in this Sparkfun tutorial, the main difference being that I did it all on some protoboard instead of buying a PCB from them.
As I was soldering it together, I needed a little more flux, so I used my flux pen to add it. Somehow, the tip of the pen stuck and I actually pulled it out - getting lots of flux on the board. I didn't realize just how much until I went to test it and got a shock via the +5V and ground wires. It turns out that the residue of liquid flux on the board under the relay was shorting the pins - the multimeter showed 120k Ohms between the control pins and the 120V power pin. Desoldering the relay, wiping everything down and soldering it again got me a working relay board.
Once I put everything together (arduino, relay and crock pot), the temperature was still going nuts whenever the relay switched on. I put a delay on it, so it wouldn't switch the relay state more than once every 5 seconds, but since the temperature would suddenly start reading 200+ degrees after the relay switched on, that pretty much just left it with a 50% duty cycle. The problem was obviously not some kind of switching noise as the relay went on. Eventually I got it somewhat stabilized by trying different resistors between arduino and relay until I found the largest one that still passed enough current to trip the relay. It seems that the extra current draw of trying to operate the relay affects how well the max6675 works. I ended up with a 4.7k resistor. 10k was too high and the relay wouldn't trip.
At this point, it all worked well enough to cook a chuck roast. I used a meat thermometer to verify the water temperature, as the readout on the LCD still jumped around quite a bit. Once it got up to temperature, the temperature would change very slowly. It was hard to resist the temptation to fiddle with the set point before the water had time to adjust - it could take several minutes to change by a degree or two, since it was effectively running at or very near a 50% duty cycle.
I let it cook for almost a day and a half. The meat that came out was quite tender, reminiscent of pot roast. The flavor, however, was much more meaty. The juices that came out were almost fat-free and also tasted very meaty. The downside is that the lower temperatures did not cook out any of the fat and my two test subjects complained that it was unpalatable.
What's next? I want to figure out what's going on electrically with the jumpy temperature readings. That means a session with the oscilloscope. I also want to try smoking a brisket really heavily for an hour or two and then letting it sous vide until tender. I think I can pump enough smoke into the meat to get a good smoke flavor, and the sous vide will get it tender without requiring constant attention on my part.