This action might not be possible to undo. Are you sure you want to continue?

James Yu March 9, 2003

Abstract

The purpose of the project is the creation of a temperature controller through the use of a thermistor. The thermistor resistance is modelled to have an exponential relationship with temperature, and this relationship is conﬁrmed through measuring the resistance of the thermistor for diﬀerent temperatures. This data is then analyzed to calibrate and assess the error (or accuracy) of the thermistor. Finally, the thermistor is successfully used with a computer and a heater to control the temperature around the heater to ±3◦ C of a speciﬁed temperature.

0.1

Introduction

The temperature controller project’s goal is to produce an inexpensive scheme to maintain the alexandrite laser rod at a given temperature with an accuracy of ±3◦ C. This is done by using a thermistor to measure the temperature of the rod and convey that information to the computer, which will maintain a given temperature using a heater. The thermistor is basically a resistor, and these are cheap, abundant, and useful. By taking advantage of the fact that the resistance of a resistor varies as an exponential function of temperature, a computer can calculate the temperature by measuring the resistance of the thermistor. Once this is done, the computer can judge whether or not to turn on a heater to regulate the temperature. It is found that the thermistor conforms to the exponential relationship well enough to achieve a ±3◦ C accuracy when used in a temperature controller. The rest of this report discusses the theory behind the thermistor, the apparatus and methods used, and the results obtained from the experiments. The appendix summarizes the error analysis and contains the computer programs that are used to control the temperature.

0.2

Theory

**The resistance R of a thermistor is related to the temperature T by the model R = R0 e T
**

T0

(1)

where R0 and T0 are the parameters that are unique to each thermistor. The resistances are measured in Ohms, and the temperatures in Kelvins. This relationship says that the resistance of the thermistor varies exponentially with the inverse of the temperature. Essentially, as the temperature gets larger the resistance R approaches R0 , and as the temperature approaches absolute zero the resistance theoretically approaches inﬁnity. 1

Solving for T in equation (2) results in T = T0 ln R − ln R0 (2)

and thus, the computer can obtain the temperature of the thermistor by measuring its resistance R and calculating T in equation (2). Before that can be done, the calibrating constants R0 and T0 must be obtained. By taking the natural log of equation (1), a linear relationship is obtained: ln R = ln R0 + T0 T (3)

Measuring the Resistance Temperature curve of the thermistor, one can obtain the values 1 of T0 and R0 by applying a linear least squares ﬁt on ln R versus T . After an error analysis on these quantities, we can use error propagation to obtain the uncertainty in a measured temperature T T ∆T = (∆T0 )2 + (T ∆ ln R)2 + (T ∆ ln R0 )2 (4) T0 This ∆T represents the uncertainty of the calculated temperature when measuring values for R of the thermistor, based on the uncertainties in R, R0 , and T0 (which are the values in the equation with ∆’s). It is the expected range within which the measurement will lie with a 68% probability. A summary of the error analysis can be found in Appendix 1.

0.3

Apparatus and Method

The temperature controller consists of three main components: the thermistor, the computer, and the heater. Basically, the computer measures temperature information from the thermistor, and regulates the heat using the heater. The following speciﬁc components are needed for the temperature controller: 1. 2. 3. 4. 5. 6. 7. IBM-PC computer Thermistor Protoboard Lab PC+ I/O Board Heater Thermometer Resistors and Miscellaneous Wires

There are three main stages in building a functional temperature controller: connect the individual components, calibrate the thermistor, and develop a computer program for temperature regulation. 2

0.3.1

Connect and Calibrate the Thermistor

First the components are connected as shown in Figure 3, noting that the thermistor and heater are physically in the space where the temperature needs to be controlled. To calibrate the thermistor, the Resistance-Temperature curve for the thermistor must ﬁrst be obtained. To do this, note that the resistance RT can be calculated by measuring the voltage VT and using the relationship VT R1 RT = (5) V0 − VT A wire is connected from the node between R1 and the thermistor to the ADC0 pin on the Lab PC+ board. Then a C++ program is written that asks the user to input a temperature, and then calculates R0 by reading the voltage VT on the ADC0 pin. This is done by initializing an analog to digital conversion on the ADC0 pin (refer to the AEP264 packet Exercise 3 for more information). Then, the program simply uses eq. (2) to calculate R0 . This program loops until a bogus temperature is inputted, and will then output the data into a text ﬁle. A thermometer is now placed at the same location as the thermistor, and heat is applied in the range of 30◦ C to 90◦ C while running the program. The temperatures are carefully read by the thermometer every 3◦ C to 4◦ C and inputted into the program. The data is then used in a Matlab script ﬁle that will ﬁnally calculate R0 and T0 .

1 The script ﬁle plots the ln RT versus T to obtain the relationship in eq. (2). It then performs a linear least squares ﬁrst order ﬁt on this data to obtain the slope and “ln(R)”-intercept of the straight line through the points. This was done using the function polyﬁt() with the ln R 1 and T data as the parameters. The slope of the line is then T0 and the intercept is ln R0 . Once these values are obtained, the calibration is complete.

0.3.2

Develop a Program for Temperature Regulation

Now the push-button in Figure 3 is replaced with a Hexfet transistor (basically a switch) as seen in Figure 4. By connecting the gate of the Hexfet to the PA0 output on the PC+ Lab board, the computer can now turn on the heater by applying 5 volts on PA0 or turn it oﬀ the heater by applying 0 volts on PA0. The temperature regulating C++ program will ﬁrst initialize ports A, B, and C on the Lab PC+ board as outputs. It will then 1. Prompt the user for a desired temperature TD 2. Read the RT of the thermistor and calculate the temperature as was done in calibration using R0 and T0 obtained from before. 3. If the temperature is greater than TD + 1 then apply 0 volts on PA0 to turn oﬀ the heater, if it is less than TD − 1 then apply 5 volts on PA0 to turn on the heater, else do nothing 3

4. Write the data point (time, temperature) to a ﬁle 5. Repeat steps 3 through 5 every 2 seconds until a key is pressed Finally, the program is run for a few minutes set to maintain an arbitrary temperature, and afterwards, the data is written to a ﬁle. Using Matlab, the temperature-time history of the controller is plotted.

0.4

0.4.1

Results

Calibration Results

The resistance-temperature curve obtained from our thermistor is shown in Figure 1 along with the ﬁrst order least squares ﬁt line. As seen in this data, there is a systematic error between the heating and the cooling data; this is a result of the thermometer “catching up” with the actual temperature. It will be higher than the actual temperature when cooling and lower than the actual temperature when heating. This is most easily seen in the plot of the residuals, or the diﬀerence between the measured data and the ﬁtted line, as seen in Figure 2. I ﬁtted only to the heating data to eliminate this error, and obtained the calibrating constants (with errors) ln R0 = −4 ± 0.1955 T0 = 3600 ± 64.4789 (6) (7)

And from this, I have obtained an average uncertainty in a given temperature measurement of ∆T ≈ 8.4790 (8) This temperature uncertainty is actually related to the accuracy of the temperature controller in reading the correct temperature; it has nothing to do with the actual precision of the controller which is dictated by the heating and cooling properties of the material. In order to eliminate this error in actual use, I changed T0 in response to the accuracy of the temperature reading based on the thermometer, and, by doing so, achieved a high level of temperature accuracy using the thermistor.

0.4.2

Controller Results

When plotting the temperature versus time curve for the controller, a jagged graph seen in Figure 5 arises. This is due to the fact that V0 is not a constant 5 volts, but actually ﬂuctuates in time. To eliminate this error, I adjusted the resistance calculating part of the C++ program to measure V0 using an ADC. After obtaining V0 I use it as part of eq. (5) instead of using 5 volts: this eliminates the said ﬂuctuations and produces Figure 6. 4

Figure 6 shows that the temperature controller is successful in maintaining a desired temperature within ±3◦ C. From the graph it is estimated that the overshoot is within 2◦ C and the undershoot is within 1◦ C. The reason the overshoots are bigger than the undershoots is because the element is faster in heating up than it is in cooling down.

0.5

Conclusion

The design of a temperature controller using a thermistor coupled with a heater and a computer is precise and accurate enough to ﬁt the criteria of the requirements. However, there are some performance limitations to this scheme. Due to the properties of the heater and the object being heated, there may be an uneven amount of time spent above and below the desired temperature TD . In the speciﬁc case of Figure 6, more time is spent above TD , and thus the mean temperature is a little higher than TD . A possible extension to the testings would be to test the precision for diﬀerent temperatures. Testing for the range of all temperatures that the controller would still have precision ±3◦ C would be useful in knowing the operating range of the controller. Extending the testings to diﬀerent kinds of thermistors would also be a valuable test to determine which kind of thermistor is best suited for the job. A more concrete test for the controller would be to actually use it to control the temperature of an alexandrite laser rod, and use more precise temperature instruments to measure the temperature that is maintained in the rod. This would truly determine the overall eﬀectiveness of the temperature controller on the rod.

5

0.6

Appendix 1: Error Analysis

Since this experiment is based on measurements in resistances, there are uncertainties and errors in all the quantities leading up to the uncertainty in the ﬁnal temperature reading T by the thermistor. First, the rms deviation, or probably error associated with a single measurement, may be calculated by ∆y =

N 2 i=1 (δyi )

N

(9)

**where the δyi = yi − yt , or the diﬀerences from the measured values yi and the theoretical yt .
**

1 Now, when a linear least squares is applied to the plot of ln R and T , there are some error estimates that may be calculated. The uncertainties in ln R0 or the intercept and T0 or the slope will contribute to the overall uncertainty. These uncertainties are calculated using techniques of minimum least squares ﬁt and error propagation, which are detailed in the AEP264 packet pages 42 through 44.

**The resulting uncertainties are given by
**

N

∆ ln R =

i=1

δi N N D

N

(10) (11) x2 i N (12)

1 , δi Ti N 2 i=1 xi

∆T0 = ∆ ln R ∆ ln R0 = ∆T0

i=1

Where N is the total number of measurements made, xi are the measured values the residual or deviations of measurements from theoretical values, and D = N ( N xi )2 . i=1

is −

Realizing now that T is a function of ln R, ln R0 , and T0 , as seen in equation (2), error propagation may be used to calculate the uncertainty in T . It can be written that the uncertainty ∆T is the square root of the sum of the squares of the partial derivatives of each rms value: ∂T ∂T ∂T ∆T0 )2 + ( ∆ ln R)2 + ( ∆ ln R0 )2 (13) ∆T = ( ∂T0 ∂ ln R ∂ ln R0 Solving for ∆T obtains the uncertainty ∆T = T T0 (∆T0 )2 + (T ∆ ln R)2 + (T ∆ ln R0 )2 (14)

This then is the uncertainty associated with each calculated temperature from a resistance measurement of the thermistor. 6

0.7

Appendix 2: C++ Program

This program is the temperature regulating program. It ﬁrsts asks the user to enter a desired temperature. It then reads and calculates the resistance of the thermistor, and through that calculates the temperature. If the temperature is greater than the desired temperature + 1 then it will turn the heater oﬀ, if it is less than the desired temperature - 1 then it will turn on the heater. The program loops every 2 seconds until a key is pressed. #include #include #include #include <stdio.h> <conio.h> <windows.h> <math.h> /* base address of Lab-PC+ */ /* see Appendix A-III */

#define base_addr 0x260 #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define

AD_Clear_Reg base_addr + 0x08 FIFO_Reg base_addr + 0x0A StartCnv_Reg base_addr + 0x03 Comm_Reg_1 base_addr Comm_Reg_2 base_addr + 0x01 Comm_Reg_3 base_addr + 0x02 Comm_Reg_4 base_addr + 0x0F Status_Reg base_addr Count_A base_addr + 0x17 Count_A0 base_addr + 0x14 DMATC base_addr + 0x0A TI_Clear base_addr + 0x0C DAC0L base_addr + 0x04 DAC0H base_addr + 0x05 DAC1L base_addr + 0x06 DAC1H base_addr + 0x07 PortA_Reg base_addr + 0x10 DigCtrl_Reg base_addr + 0x13

void delay(int); void initboard(); unsigned LOBYTE, HIBYTE, V0_LO, V0_HI; int main(void) { initboard(); _outp(DigCtrl_Reg, 0x80); /*sets ports A,B, and C as outputs */ _outp(PortA_Reg, 0); /* sets A to 0 */

7

double VOLTAGE, VOLTAGE_V0; unsigned ADCUNITS, ADC_V0, i; float Temp, R, TempD; int DONE, t=0; float T0 = 3600; float ln_R0 = -4; i=0; FILE *fp; fp = fopen("output.dat", "w"); printf("Temperature (Celsius) Desired: "); scanf("%f", &TempD); TempD = TempD + 273.16; do { _outp(Comm_Reg_1, 0x02); /* selects ADC channel 2 */ _outp(StartCnv_Reg, 0x00); /* write to start conversion */

/* waits for first bit of DONE to be 1 */ do DONE=_inp(Status_Reg); while((DONE & 0x01) != 0x01); LOBYTE=_inp(FIFO_Reg); HIBYTE=_inp(FIFO_Reg); /* low byte of data word comes first ( */ /* both bytes must be read to clear FIFO_Reg */

/* Convert V0 to eliminate fluctuations */ _outp(Comm_Reg_1, 0x01); /* selects ADC channel 1 */ _outp(StartCnv_Reg, 0x00); /* waits for first bit of DONE to be 1 */ do DONE=_inp(Status_Reg); while((DONE & 0x01) != 0x01); V0_LO=_inp(FIFO_Reg); V0_HI=_inp(FIFO_Reg); ADCUNITS=256*HIBYTE+LOBYTE; VOLTAGE=10.0*ADCUNITS/4096.0; printf("\nHIBYTE: %4d, LOBYTE: %4d", HIBYTE, LOBYTE); 8

printf(", ADCUNITS: %d, VOLTAGE %5.2f\n", ADCUNITS, VOLTAGE); ADC_V0=256*V0_HI + V0_LO; VOLTAGE_V0=10.0*ADC_V0/4096.0; printf("\nHIBYTE: %4d, LOBYTE: %4d", HIBYTE_V0, LOBYTE_V0); printf(", ADC_V0: %d, V0 %5.2f\n\n", ADC_V0, VOLTAGE_V0); R = VOLTAGE * 1000 / (VOLTAGE_V0 - VOLTAGE); Temp = T0 / (log(R) - R0_ln); /* calculate R */

printf("RT: %5.2f\tTemp: %5.2f\tTime Elapsed: %d\n\n", R, Temp-273.16, t); fprintf(fp, "%5.2f\t%d\n", Temp - 273.16, t); if(Temp < TempD - 1) _outp(PortA_Reg, 4); if(Temp > TempD + 1) _outp(PortA_Reg, 0); delay(2000); t = t + 2; } while(!kbhit()) _outp(PortA_Reg, 0); fclose(fp); return(0); } /*******************delay()*****************/ void delay(int dt) { unsigned long final; final=dt + GetTickCount(); while(final > GetTickCount() ); return; } /****************initialize board***********/ void initboard() { _outp(Comm_Reg_1, 0x00); _outp(Comm_Reg_2, 0x00); _outp(Comm_Reg_3, 0x00); _outp(Comm_Reg_4, 0x00); _outp(Count_A, 0x34); _outp(Count_A0, 0x0A); _outp(Count_A0, 0x00); _outp(DMATC, 0x00); _outp(TI_Clear, 0x00); 9

_outp(AD_Clear_Reg, 0x00); LOBYTE = _inp(FIFO_Reg); HIBYTE = _inp(FIFO_Reg); return; }

10

Bibliography

[1] T. Cool: Computerized Instrumentation Design: Applied and Engineering Physics 264, School of Applied and Engineering Physics, Cornell University (2003)

11

- Parse Presentation
- Restaurants To Try
- Menu at Sebo in San Francisco
- Facebook Connect for Web Startups Design Guide
- 01 My Great Novel With Numbers
- 01 My Great Novel With Numbers
- 01 My Great Novel
- REST Cheatsheet
- 03-26 Entry Door Copy 4
- 01 thisisthebest
- 03-26 Entry Door Copy 11
- 01 My Great Novel
- 03-26 Entry Door copy 9
- test file text 1
- test file text 1
- 03-26 Entry Door copy 9
- PURCHASE ONLYMy Great Novel
- 03-26 Entry Door Copy 9
- 03-26 Entry Door copy 12
- 03-26 Entry Door Copy 9
- 03-26 Entry Door Copy 12
- PDF Test
- 03-26 Entry Door Copy 9
- iPaper Animation -- Stick Figure Drawing
- 03-26 Entry Door Copy 17

- Tech Report-Temp Controller
- PTC & NTC Sensor Terminology
- lab04_03_LabVIEW
- tmp850A
- Puente de Whistone
- Steady State Multiplicity in a Solid Oxide Fuel Cell Practical Considerations
- An Introduction to Thermistors
- 01289707
- Temp Sensor Ntc Test Calibration method
- Lecture Temperature Transducers 2
- AppNote 2 Copy Copy
- RTD (12)
- RTD(4)
- NTK-termistor
- Evans 1984
- ASTM B 289.pdf
- a level physics - Error
- 5615____ugeng0000
- 5627A___ugeng0000 (1).pdf
- 5627A___ugeng0000
- Rtd Presentatn
- Postlab 6
- Dansk Standard DS en 1264-2
- Datasheet Lm35an[1]
- Temperature Prediction Inside a Greenhouse
- JESD22B112 Warpage Specification 2005
- Apt 0406
- The Main Code
- 1 Temperature Thermal Expansion
- 990 Disc Type -Datasheetz
- The Thermistor as a Temperature Controller

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd