Thermistor and DMM Measure Temperature
Werner Haussmann, Hewlett-Packard, Loveland, CO -- Test & Measurement World, 10/1/1999
|
|
| Figure 1. A Visual Basic form displays temperature in ºC or ºF. |
To control the DMM, I developed Visual Basic (VB) code that uses the ActiveX control I described in the June 1999 issue of Test & Measurement World.1 The control lets a PC communicate with instruments over an IEEE 488 bus. Because my DMM measures resistance, I had a choice of using an RTD or a thermistor as a sensor. I chose a thermistor because these devices have better resolution than RTDs over my temperature range of interest, 25ºC to 100ºC.
A thermistor is a semiconductor device that changes its resistance as a function of temperature. Most thermistors have a highly nonlinear negative temperature coefficient and go by the name NTC thermistors. These devices are quite sensitive to temperature changes, so they make a good choice when an application demands measuring small changes over a limited range of temperatures.
But sensitivity comes at a price. You must linearize the resistance measurements to get units of temperature. Temperature meters that use thermistors (or other sensors) will linearize the measurements internally. If you use a DMM to measure resistances, however, you’ll have to linearize the measurements yourself. But a PC can do the work for you.
The most common way to linearize a thermistor’s resistance is to use the Steinhart-Hart equation, a nonlinear least-squares-fit of resistance vs. temperature:
![]()
The constants A, B, and C represent thermistor-specific values you obtain from thermistor manufacturers, or you can generate them yourself from several resistance measurements. T represents temperature in units of Kelvin (ºC + 273.15), and R represents the thermistor’s measured resistance in ohms. Manufacturers typically calibrate their thermistors at 0ºC, 50ºC, and 100ºC. They publish in their data sheets the A, B, and C values as well as the thermistor’s resistance at 25ºC, its temperature-to-resistance ratio for 25ºC to 125ºC, and its accuracy. Typical resistance values for different types of thermistors at 25ºC are 2230 W, 3000 W, 5000 W, and 10 kW.
If you need better accuracy over a smaller temperature range than specified by the supplier, you can calibrate a thermistor on your own. Calibration involves measuring the thermistor’s resistance at three temperatures at least 10ºC apart and then calculating new A, B, and C constants for the Steinhart-Hart equation. Just insert each measured resistance (R) into its own Steinhart-Hart equation, and solve the three simultaneous equations for A, B, and C. Now you can use the Steinhart-Hart equation to convert a resistance to a temperature. (You can download an Excel spreadsheet, courtesy of YSI Precision Temperature Group, that calculates the Steinhart-Hart constants from the Test &Measurement World Web site.)/p>
I entered the three constants, A, B, and C, for the type of thermistor I used into the VB code in Listing 1. After adding the ActiveX control to my VB project, I named the control "dmm" and used the first four lines of Listing 1 to get the thermistor’s resistance from the meter. (Download the VB code)
| LISTING 1 |
Dim Resistance as Double dmm.Output "Conf:Res " dmm.Output "Read?" dmm.Enter Resistance Const a = 0.001288 Const B = 0.0002356 Const C = 0.00000009557 Private Function Temperature(Resistance, _ Optional Units As String = "C") As Double ' This function takes the input value in ohms ' and converts it to degrees C or F Dim lnRes As Double Dim lnRes3 As Double ' the cube of lnRes Dim temp As Double Dim TempC As Double lnRes = Log(Resistance) lnRes3 = lnRes * lnRes * lnRes 'Calculate reciprocal of temperature in C temp = a + B * lnRes + C * lnRes3 TempC = 1 / temp - 273.15 If InStr(1, Units, "F") Then Temperature = TempC * 9 / 5 + 32 Else Temperature = TempC End If End Function |
The "temperature" function in Listing 1 converts the resistance to ºC or to ºF. After the program retrieves a resistance value from the DMM, the program passes it to the temperature function. An optional second parameter, "C" or "F," selects the corresponding temperature scale. If you omit the second parameter, the function returns the temperature in ºC. The program then displays the temperature in a window and, because the DMM I used has a programmable display, the software sends the result back to the DMM, so it looks like a temperature meter. (Listing 1 lacks the DMM-display code because it was written specifically for the meter I used.)
The VB form in Figure 1 provides two buttons. The "Set I/O" button gives you access to the ActiveX control, which lets you set the DMM’s IEEE 488 address and verifies that the PC communicates with the meter. (I described these functions in detail in the June article.) Each time you click on the "Read Temperature" button, the computer gets the resistance from the DMM, converts it to temperature, and displays the result on the PC screen.
The VB project contains the form in Figure 1, the code in Listing 1, plus some control code to display the temperature. The project gives you the code to get the temperature measurement, and it includes a VB timer control that triggers measurements. You can expand on my software so the program will:
- Store the results of multiple measurements in an array;
- Store the results in a file;
- Plot the results with a VB graph; and
- Import the data to Excel and plot it.
It’s up to you to configure the basic program to meet your specific needs. T&MW
Werner Haussmann is an R&D project manager at Hewlett-Packard, Electronic Measurements Division, Loveland, CO.
FOOTNOTES
1. Haussmann, Werner and Alicia Viskoe, “ActiveX Control Simplifies Instrument Programming,” T&MW, June 1999, p. 57.
2. Temperature Sensors & Probes, Catalog, YSI, Yellow Springs, OH.
FOR FURTHER READING
1. Bowen, Bruce, and Paul Schnackenberg, “Thermistor Calibration and the Steinhart-Hart Equation,” Application Note #4, ILX Lightwave, Bozeman, MT. April 19, 1995.
2. Practical Temperature Measurements, Application Note 290, Hewlett-Packard, Santa Clara, CA.



















