Introduction The goal of our final project was to design a thermostat using an Atmel AT90S8535 microcontroller. The thermostat was to compute the current temperature once per second and then send an on/off signal to a heating device which would then regulate the temperature to a desired target temperature. In addition, the thermostat was required to keep a time of day clock, as well as record the maximum and minimum temperature values that have occurred.
Setup We accomplished our goal by using an analog thermistor-based temperature sensitive circuit whose output voltage was inversely proportional to the temperature of the system. In order for the microcontroller to obtain the current temperature, the thermistor voltage was input to the ADC of the 8535 and then converted to a temperature using a simple linear equation involving fixed point mathematics. In addition, the thermostat also required the use of both an LCD and a keyboard for the purpose of user interaction. Specifically, the LCD performed the following display functions:
- display the current temperature
- display the target temperature
- display the min and max temperatures
- display the time of day
- displaying keyboard input for verification
The keyboard was used for:
- setting the target temperature
- setting the time of day
- selecting the view min/max mode
- clearing the min/max values
As you can see, this project combined many if not all of the concepts taught over the course of the semester. These include timing, use of a keyboard (including debouncing it), use of an LCD, fixed point mathematics, analog circuit design and analog-to-digital conversion.
Thermistor Calibration
The first step in creating a thermistor based temperature controller is the calibration of the thermistor, that is figuring out how the amount of voltage drop across the thermistor corresponds to its temperature. To come up with this data we used the calibration setup circuit shown in Figure 1. We then heated the thermistor up from 30 to 90 degrees Celsius (since this setup did not have a safe method for cooling the thermistor to down below ambient temperature) and recorded both the voltage across the thermistor and its temperature. These values are plotted in Figure 2. We accurately knew the temperature of the thermistor because our calibration setup included a thermometer which was thermally coupled to the thermistor. Find our experimental data in Appendex 1. One complication which arose in this part of the project was that because the thermistor is not a perfect device per se, it requires on the order of ten or so seconds for its resistance to accurately respond to a change in temperature. Because of this effect, there was a thermal lag which existed between the thermistor and the thermometer used to know its temperature. Nonetheless, we found that the way to minimize this source of error was to take calibration data both during a heat up cycle a cool down cycle. This is effective in minimizing this source of error because the thermal lag is effectively canceled out by the fact that during the heat up cycle there is a positive thermal gradient between the thermometer and the thermistor while during the cool down cycle there is a negative thermal gradient. Therefore we were able to accurately obtain values correlating the voltage drop across the thermistor to the thermistors temperature. We then converted these analog voltages (Vread) to 10-bit binary values such as would appear at the output of the ADC using the following equation:
For more detail: A m -Controller Based Thermostat