Tuesday, April 28, 2009

The Basic Setup

Sitting on my desk is a very rough approximation of the hardware setup. I have an Arduino Duemilanove with an Ethernet shield, and I'm using my trusty variable resistor as a simulated temperature probe (not very practical to have things on my desk at 240 degrees F). I also have a small 12vdc computer fan hooked to an NTE 241 NPN power transistor, which in turn is biased by one of the Arduino's PWM-capable pins. An old wall-wart power supply from a sump-pump backup system supplies 12vdc to the fan and the Arduino's regulator.

I started out by writing some simple code for the Arduino that tests out the basic capabilities. I can read analog values from the fake temperature probe and convert them to actual temperatures using a lookup table. I can control the fan and adjust its speed by adjusting the duty-cycle of the output pin. Then I made the system 'smart' by adjusting the fan speed to according to the temperature error value.

With the Ethernet board, I can also communicate over TCP/IP. For now it's a wired connection; once the code's all figured out, I'll add wireless capabilities either by adding a Wifi bridge or by using a Wifi module instead of the Ethernet board.

I wrote some very simple code to implement a basic web server, and I can serve up a simple web page to show basic info about the temperature and fan speed. The html includes a refresh tag so that the browser automatically reloads it every five seconds. Pretty cool. :-) Next, I'll write a bit of code to send alerts via email or Twitter.



So far I've already used about 9k of my available 30k code budget; granted, nothing's optimized yet, but I'm gonna need to write some pretty tight code to cram everything in there!

Monday, April 27, 2009

Controlling The Heat

Now that I can measure the temperature, I also need a way to control the smoker. Like most basic smokers, my Char-griller has an offset firebox with an adjustable damper; the fire has an abundance of fuel, and heat output is controlled by adjusting the amount of oxygen available.

One option would be to rig a servo motor to the damper to adjust its position. However, that would make for a pretty complicated system since the servo would have to be located far from the heat of the firebox and the linkages would need to be heat-resistant.

Another option is to use a fan to control airflow. By adjusting the speed of the fan, I could control the flow of air and the heat of the fire. Given the design of most fans, air would still be able to pass through with the fan stopped, so I'd need some sort of flap to effectively shut off the airflow.

One nice benefit of the fan approach is that I can create more airflow than I could with just an open damper, a nice bonus when the smoker needs to heat up quickly after I opened the lid to sneak a peek.

As with the servo approach, the fan will need to be protected from the heat. For that I can mount the fan at the end of a long duct, and the duct can extend down from the firebox to further minimize heat exposure.

Friday, April 24, 2009

Brains For QPID

Obviously, QPID is going to need some form of microprocessor to do what it needs to do. It also needs the ability to read voltages, control motors, and connect to the internet. Thankfully, there's an open-source hardware platform known as Arduino that fits the bill perfectly.

I decided to use the Arduino Duemilanove which is based on the Atmel ATMega328 microcontroller. It includes 6 10-bit analog-to-digital converters, 14 digital I/O lines, and is capable of generating pulse-width-modulated (PWM) signals (ideal for controlling servos and motors). And to make things even easier, an optional Ethernet board is also available along with a software library.

The Arduino platform also includes a set of open-source tools for editing, compiling, and debugging code, and it includes standard libraries for reading analog values, generating PWM signals, etc. Thus, I can spend my time working on QPID instead figuring out a proprietary toolchain and development environment.

Measuring Temperatures

Given what QPID is supposed to do, measuring temperatures is a fundamental capability. There are a variety of ways to electronically measure temperatures, but the most common methods employ either thermocouples or thermistors.

Thermocouples can be extremely accurate, but given the tiny voltages involved, they require special amplifier circuitry in order to be read by a typical analog-to-digital converter. And to make things more complicated, you also need to measure the temperature where the probe is connected to the circuitry since the voltage is dependent on the difference in temperature. Hmm, seems like a lot of work.

Thermistors are much easier to use than thermocouples. Their resistance changes with temperature, so a simple voltage divider circuit with a second resistor provides an ideal signal for the analog-to-digital converter. Their response is quite non-linear, so a lookup table is generally needed to convert readings into actual temperatures, but that's just software (which of course is easy).

Turns out the probes on my old ET73 unit are thermistor probes, so that got me thinking. They're relatively inexpensive (replacement probes can be purchased for about $10), use a standard 2.5mm plug, and they're designed specifically to measure the temperature range of a smoker. Best part is, I already have some. So I decided to use them for Project QPID.

Of course, I still needed a lookup table for the probes in order to use them. One option would be to heat or cool the probe to a known temperature and measure its resistance, but that's not easy to do without special equipment.

I realized that the ET73 unit had to know the lookup table data, I just needed a way to get that information out. Using a variable resistor hooked up to the ET73, I adjusted the resistance so that a given temperature was read. The resistor was then disconnected from the ET73 and measured using a digital multimeter. This process was repeated in 10 degree increments from 50 to 370 F degrees, thus providing a table of temperatures and corresponding resistance values.

On a long shot, I decided to also email Maverick Industries to see if by chance they could provide me with a lookup table for their probes. Suprisingly, they were very accomodating and emailed me a complete lookup table provided by their probe vendor. Many thanks to Maverick Industries for being so cool! :-)

So, how did my reverse-engineered lookup table stack up against the probe vendor's? Pretty damn close (typically with a degree or two).

What Is QPID?

A few years ago I started messing around with Texas-style BBQ (smoked ribs, brisket, turkey, etc.). It's pretty easy to do, but the tough part is having to keep a vigilant eye on the smoker and maintain a constant temperature for 7 or more hours. While it doesn't require a lot of time per se, it does mean that you need to hang around the house all day and remember to check it every 30 minutes or so. It'd be great if I could go for a bike ride, run some errands, or even take a nap.

Two years ago I got an ET73 remote temperature monitor made by Maverick Industries. It works great, but it only allows me to see the smoker temperature from inside my house due to a short-range RF link, and it still relies on me to go out and adjust the smoker. Clearly we need something more sophisticated...

The goal of Project QPID is to create an Internet-enabled controller for a my smoker that can do the following:

- Monitor and maintain the smoker at specified a temperature
- Monitor the meat temperature as it cooks
- Allow remote monitoring of the smoker via a web interface on a PC or mobile phone
- Provide updates and alerts via email, Twitter, etc. when the meat reaches a certain temperature, the fire needs attention, etc.

As for the name? Well, I expect that controlling the temperature of my BBQ may use some form of PID algorithm. And in case you're wondering, I absolutely refuse to call it 'iSmoke' or use any parts that are white. ;-)