c. Temperature and illumination measurement and control

HOW TOs:

Temperature sensor adjustment (calibration)

Correlation between ambient temperature and A/D output value always requires measurement of one or more reference temperatures and adjustment of trimmer and program setting accordingly. A very strong reference temperature is 0 °C, which can be achieved by measuring the temperature of ice cold water in the glass with melting ice cubes. The glass must be first filled with ice cubes (no water added) and then it has to be let to melt at room temperature. The water that comes from melting ice has about 0 °C. Other reference points can be determined by a quicksilver thermometer.

The most precise temperature measuring applications may require a little different approach. The temperature sensor manufacturer original specification usually includes an equation that defines correlation between the sensor (thermistor) resistance and the ambient temperature. The thermistor resistance must be measured only at specific temperature (specified by the manufacturer).

The next task is to extend the thermistor equation to include the operation amplifier characteristics. The latter should be linear. Therefore one must only take into account the offset and gain values, which determine A/D value at reference temperature and the A/D values at other temperatures.

How to determine thermistor resistance at a particular temperature

Thermistor resistance at a known temperature and a known electrical current through the thermistor can be measured as follows:

1.Use a voltmeter to measure the voltage (VTE) on thermistor as it is connected to the temperature measuring circuit at a given ambient temperature (Tref).

2.Use an ampere meter to measure electrical current (ITE) through the thermistor as it is connected to the temperature measuring circuit at the same ambient temperature (Tref) and in step 1.

3.Calculate the thermistor resistance as follows:

RTE = VTE/ ITE

NOTE: It is not enough to use an ohmmeter to determine thermistor resistance as the resistance is also depends on the electrical current through the thermistor.

There are countless practical problems that may be solved by temperature and illumination sensors. One example is setting shutters positions. In winter time, when there is sunny weather we wish to collect as much sunlight as possible to get free heating. During a hot summer day we wish the opposite to keep the house cool without the need to switch on the air conditioner. There are many other uses of these sensors. By placing one temperature sensor inside the refrigerator and the other in the room, it is possible to extend its operating range beyond the manufacturer specified room temperature. If the temperature drops below 10 °C the refrigerator thermostat may malfunction and keep cooling the foods even when the temperature inside the refrigerator drops below 0°C. Microcontroller can prevent this by automatically switching the refrigerator power supply…

APPLICATIONS:

@. Software application for temperature measurement (for subsections I, II and III)

I. Termometer application with multiple temperature sensors

II. Illumination measurement application with multiple light sensors

III. Thermostat application that precisely controls your refrigarator internal temperature and extends its operating range bellow 16°C

IV. ADT7410 & PIC32MX250F128B: 16-bit digital thermometer (NO CALIBRATION NEEDED!)

V. 16-bit thermometer and thermostat application with source code (NO CALIBRATION NEEDED!)

However, it is almost too easy to measure illumination and/or temperature with a K8055 or a K8055N Velleman experimet board!

And it is also possible to measure temperature with K6001 and a PC inbuit sound chip or a sound card. See Digital oscilloscope section.

A/D output value and temperature correlation

As a thermistor can only be connected to the PIC18F2xJ50 A/D converter through an operation amplifier, it is important to determine the right correlation between A/D converter output values and thermistor resistance. The amplifier should have a linear response in the operational range. Therefore we seek a correlation constant between A/D converter output value and thermistor resistance.

The easiest way to determine the correlation constant is by measuring the A/D output values (DTref1and DTref2) and thermistor resistance values (RTref1 and RTref2) at two different temperatures (Tref1and Tref2). The correlation is now given by the following relationship correlation coefficient (Cf):

Cf = (R Tref2 - R Tref1) / (DTref2 - DTref1)

The thermistor resistance can now be calculated at any given temperature from the thermistor operational temperature range:

RT = Cf* (DT – DTref1) + R Tref1

… where DTis current A/D converter output value.

Finally the ambient temperature can be determined from the equation:

T = 25 + (sqrt(a2+ 4 * b * (RT/R25 - 1)) – a) / 2 / b [° C]

After inserting RT equation, we can calculate the temperature directly from an A/D output value and the as follows:

T = 25 + (sqrt(a2 + 4 * b * ((Cf * (DT – DTref1) + R Tref1) /R25-1)) – a) / 2 / b [° C]

where:

R25 = RTref1/ (1 + a * (Tref1 – 25) + b * (Tref1– 25)2)

Temperature calculation from a known thermistor resistance*

*NOTE: The following calculation is valid for Infineon KT and KTY temperature sensors: KT100, KT110, KT130, KT210, KT230, KTY 16-6, KTY 10-x, KTY 11-x, KTY 13-x, KTY 21-x, KTY 23-x and KTY 19-6

First RTrefhas to be determined by measuring thermistor resistance at Tref, where Tref is a known temperature from the sensor operating range.

Next, thermistor resistance at 25°C must be calculated as follows (a and b are constants):

a = 7,88 * 10-3 K-1

b = 1,937 * 10-5 K-2

kTref= 1 + a * ( Tref – 25) + b * (Tref– 25)2

R25 = RTref / kTref = RTref / ( 1 + a *( Tref – 25) + b * (Tref – 25)2)

Now an unknown temperature can be calculated from a measured thermistor resistance:

T = (25 + (sqrt(a2 + 4 * b * (RT/R25- 1)) – a) / 2 / b

… where sqrt is stands for square root.