View Single Post
  #27  
Old 24-12-2011, 08:58 AM
rcheshire's Avatar
rcheshire (Rowland)
Registered User

rcheshire is offline
 
Join Date: Apr 2010
Location: Geelong
Posts: 2,617
Temperature control with PWM - PID

Cooling screen shots here.

I'm using two TMP36 temperature sensors at the moment, one reads ambient air temperature and the other cold finger temperature. PWM values are calculated as a function of the ambient and set point temperature delta.

Testing shows the need to improve on the code. Still getting my head around the Arduino PID library, which I am told will produce more accurate results. In any case PWM is still required.

An easier method is to calculate the desired PWM value and set that in place of a target temperature, eliminating the need for two sensors, with which there is a lot of noise due to read errors of both sensors with PWM chasing set point temperature. The down side to this is that as ambient temperature changes so does cold finger temperature - PWM values range from 0-255, with 0 being the ambient state and 255 max cooling. So at an ambient temperature of +25C and 0C, PWM = 0 (120 approximating a drop of 24C - with this system).

Overall I think calculating the mean based on the thermal inertia of the cold finger is probably more representative of the actual temperature (that is, temperature change is not rapid when removing power from the Peltier, except at very low temperatures operating near the maximum differential of the system - decrease in cold finger temperature is slower due to increasing power requirements).

I have a few ideas for improving the code and smoothing things out, then again I might just average all the readings and print the result - doesn't look as bad.

EDIT: Analog sensors are subject to interference. A 0.1uf capacitor strung across Vin and GND may stabilize the readings, with the capacitor located as close to the input pin as possible. So I guess straddling the pins is as close as you can get. That will be impossible for the cold finger sensor as it is well and truly embedded now.

The temperature control system is fairly easy to build. Peltier and power supply, a Logic Level N-Channel MOSFET very low Rds(on). The -ve side of the Peltier to FET Drain. PWM signal from an Arduino PWM pin to FET Gate and the FET Source to GND, controlling current to the Peltier. To avoid overheating of the FET you need the lowest Rds(on) that you can get.

Then again sourcing the right FET and getting them to Aus at reasonable shipping costs can be a headache. Love to hear of an Australian supplier.

Choosing a heat sink was tricky, in that it needs to be tuned to the system. Basically, not so big as to be cumbersome and big enough to extract as much as heat from the Peltier minimizing the hot / cold sides delta.

Theoretically, I think the system is capable of a max differential of 46C, but that is lost in inefficiencies over which I have no control. 34C is pretty good and provides flexibility and control. Most of the time the system will run at half that or less due to high dew point temperatures.

I used TMP36 sensors because they are inexpensive, linear and quite accurate without calibration. Comparing temperature readings with other electronic thermometers in the house and the local weather readings both sensors are well within the ball by 1/2 a degree or so.

Next task is to vent air from the cooling fan filtered and dried to the face of the low pass sensor, much like car defogging, to overcome high dew point temperatures. 16C at the moment, so there is little point in using cooling at all.

Last edited by rcheshire; 26-12-2011 at 01:52 AM.
Reply With Quote