BASIC Stamp Thermoelectric Temp Controller

In the world of electronics, it's all too easy to generate heat. Once in a while though we need to cool and that's where thermoelectric coolers, TEC's, or Peltier coolers come in.

This circuit controls the temperature of a small mass with a 20X20mm TEC from melcor to within 1 degree C. Applications for this circuit could include:

1. Chilling a CCD to reduce dark noise and improve SNR under low light conditions
2. Cooling a CPU or graphics chip so that overclocking speeds can be increased.
3. Controlling the temperature of a liquid or solid for scientific experiments

TEC's are fascinating devices but we are not going to cover their functionality in detail. Go to http://www.peltier-info.com, to learn more about the properties of these devices. A few notes regarding thermal issues however:

1. Mount a large heat sink to the "hot" side of the TEC
2. Do not epoxy or bond anything to the TEC's. Instead they should be "captured" mechanically.
3. Do not compress or squeeze TEC's,.
4. Use plenty of heat sink compound to maximize thermal conductivity between the TEC and the heat sink as well as between the TEC and the temperature controlled device.
5. Use plenty of heat sink compound between the temp sensor and the temperature controlled device.
6. Mount the temp sensor close to the TEC.

Theory of Operation
On a periodic basis, the BASIC Stamp from parallax inc will read the Dallas Semiconductor 1620 digital thermometer. The error between the measured temperature and the desired setpoint is calculated. For the sake of this discussion we'll assume that the measured temp is too high - therefore, the TEC will be driven in COOL mode. The following sequence then occurs:

1. *heat_enable is set to high. This turns off Q2 and turns on Q5.
2. *cool_enable is set to low. When this occurs, Q1 is turned on and Q6 is turned off. This enables the cooling leg of the H-bridge.
3. A pulse-width modulated signal is placed on PWM and is integrated by C9. The BASIC Stamp has a pulsewidth modulation function which can be used for D/A conversion.
4. C9 is buffered by U5B.
5. The output of U5B is divided by 1/10. and placed on the input of U5A. Since the integrated output of the PWM can swing from 0 to 5 volts, this signal can swing from 0 to 0.5 volts
6. U5A, Q4, and R14 form a voltage to current converter with a gain of 10amps/volt. So a 0 to 0.5 volt swing on pin 3 is amplified to a 0 to 5 amp current through the TEC.
7. If heating is required, the cooling circuit is disabled and the heating circuit is enabled.

Click this link, tempcon.bas for the code listing. The code is based on the example in the Stamp manual for the Dallas Semiconductor DS1620 Temp Sensor. However, additional lines have been added to perform a simple control loop based on integrating the difference between the desired and measured temperatures. One of the terms, LOOP_GAIN will be system dependent so be prepared to experiment with its value.

Since the BASIC Stamp has an awkward time with negative numbers, the code may appear somewhat convoluted.

Due to code space limitations, the temperature is only displayed in Celsius. Be sure and study the description of the DSAB format at the beginning of the code listing before you setup your system.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.