circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 154 May 2003
Automatic Temp Controller
Data Logger for Slow Cooker


CONTROLLER ELECTRONICS

Figure 2 shows the schematic for the controller. The microprocessor is an ATmega8, which has 8 KB of flash memory for program storage and 1 KB of RAM. The on-board oscillator is used at its default setting of 1 MHz, so a crystal or clock circuit isn’t needed. Four of its six A/D channels are used for the thermocouple amplifier output, LM34 temperature sensor, and potentiometers needed for the cooker and food temperature settings. Digital lines are used for the LCD, which has an HD44780-type interface, fan, analog multiplexer channel select, piezoelectric alarm, missing thermocouple detection circuit, and RS-232 connections.

(Click here to enlarge)

Figure 2—The goal is to build a system that is comparable to or better than a kitchen oven. Atmel’s ATmega8 microcontroller is at the heart of the controller.

The ATmega8 can be in-circuit programmed. Power is supplied through an unregulated 12-V wall wart or 12-V sealed lead-acid battery. Regulators are needed to convert this to 5 V for the electronics, a 2.5-V 0.2% precision reference voltage, and 12 V for the fan. The transistor that controls the fan must be rated according to the fan’s current requirements. The fan that I used draws 100 mA, so a 2N7000 MOSFET that can handle 200 mA is adequate. With a backlit LCD and the fan turned on, the current draw is only 120 mA, so a 7-Ah battery can power the controller for several days.

The RS-232 port is used primarily for data logging. Because the barbecue is usually outdoors and the computer indoors, a MAX232 and low data rate (i.e., 2400 bps) are used to allow for the greatest possible distance between the controller and data logger. Using six-conductor telephone cable with RJ11 to RS-232 modular connectors, distances of 100' are easily achieved. The alarm signal is also brought out on the RS-232 cable, so the outdoor on-board alarm can be muted at night, and a smaller piezo alarm that’s connected to the end of the cable can be placed indoors where someone is likely to hear it.

Photo 6 shows the electronics, which are mounted on the lid of a standard doublewide outdoor "wet location" electrical box. The box itself is mounted to the lower draft door of the cooker. The cover supplied with the box allows the controller to stay outdoors and mounted on the cooker at all times. Alternate packaging schemes are possible, such as mounting the fan on the draft door, with the electronics further away in a separate box. Or you could choose to mount nothing on the cooker itself and pipe the air to the cooker through a metal pipe or flex tubing.

(Click here to enlarge)

Photo 6—The electronics are assembled on a piece of double-plane prototype board and mounted over the LCD. The weatherproof gasket and cover come with the electrical box.

CONTROLLER SOFTWARE

The software was written with the ImageCraft ICCAVR C compiler. Approximately half of the 8 KB of flash memory has been used so far. The ATmega8’s flash memory is in-circuit programmed through an Atmel standard ISP header. The ImageCraft IDE provides a programmer. In addition, stand-alone programming software is widely available on the Internet. ImageCraft also offers a free 30-day unrestricted trial period for its IDE and compiler.

The software continuously reads the thermocouple temperatures, cooker, and alarm settings, and then displays them on the LCD. The alarm is sounded if there is no cooker temperature probe, the cooker temperature is too high or too low, or the temperature of the food has reached the alarm temperature. A simple software state machine is used to prevent "temp too low" alarms during the time the cooker is coming up to temperature, set-point changes, and when the lid is opened during cooking. The settings and temperature readings are sent to the RS-232 port once per second so that a terminal capture program, such as HyperTerminal, can be used for data logging.

The temperature reading and settings are used to implement the controller’s main function (i.e., the process-control algorithm). Once per second, the desired and actual cooker temperatures are used to determine the fan’s speed. Note that the controller was designed with two control strategies in mind, On/Off and PID.