A while back, I had a cooking timer/thermometer that I frequently used around the kitchen. It had a metallic pointed probe, approximately 15 cm (6 in) in length, that could be stuck in a roast or poultry. The probe was attached to a long insulated wire ending in a jack that plugged into the timer/thermometer allowing the temperature to be measured outside the oven and for an alarm to go off when a set temperature was reached. The device eventually stopped working and the probe stayed in the back of one of my kitchen drawers. Going through the drawer the other day, I found the probe and wondered if I could use it without the long gone device. I decided to study it to figure out what type of thermal sensor it was and how I could use it to measure temperature.

In this post, I will explain how I determined the type of thermal sensor that was used to manufacture my cooking timer/thermometer probe. I will then describe how to use the sensor and compute temperature from it. Finally, I will build a small circuit and Arduino program to measure temperatures using the probe and report it back to the computer connected to the Arduino. The featured image at the beginning of this blog post was slightly modified from an original published by Ulf Šustek Seifert, CC BY-SA 3.0 , via Wikimedia Commons.

## Thermal Sensor Characteristics

There are several types of electronic temperature sensors. The four major types are thermocouples, Resistance Temperature Detectors (RTD), thermistors and other semiconductor-based sensors. Unlike the first three major types that describe classes of devices, each semiconductor-based sensor device has its own characteristics and modes of operation. They range from simple silicon bulk resistance sensors to complex hybrid analog/digital integrated circuits. In post Temperature and Humidity Sensor I used the complex hybrid analog/digital sensor DHT22 to measure temperature and humidity. Because my probe is more than likely one of the first three types of thermal sensors, this post will concentrate on them. Their characteristics will be described in the next sections in order to determine the temperature probe’s sensor type.

### Thermocouples

A thermocouple is an electrical device consisting of two dissimilar electrical conductors joined at one end, producing a small voltage, V, between the two conductors when the temperature at the junction of both conductors, T_{j}, is different from the temperature at the other end of the conductors, T_{ref}, as shown in the diagram below. The conversion of temperature differences into a voltage is called the thermoelectric effect. Thermocouples are self sufficient in that they do not need external circuitry to operate and the measured voltage between the two conductors can be used to compute the temperature difference between the junction and the other ends of the conductors.

Thermocouples are an inexpensive way to measure temperature. They are durable, sturdy and can withstand harsh environments. However, since they measure a temperature difference, a reference temperature is required to obtain an absolute temperature measurement. Moreover, precisions below 1 °C (1.8 °F) are difficult to achieve for temperature differentials below 130 °C (234 °F) and precisions below 0.75% for temperature differentials above 130 °C (234 °F). Hence, thermocouples are best used for applications that do not require great precision and for measurements of high temperature differentials such as gas furnaces, diesel engines and ultra low freezers. The resistance across a thermocouple when the junction temperature is identical to the surrounding temperature is typically less than 20 Ω. The following symbols are used to depict thermocouples in diagrams.

### Resistance Temperature Detectors

Resistance temperature detectors (RTD) are electronic devices that rely on the change of resistivity of pure metals at different temperatures. As depicted below, these devices consist of long thin metal wires wound or affixed to an insulated substrate, such as glass or ceramic. The metal used is typically copper, nickel, or platinum, with a preference for platinum which has the most stable resistance-temperature relationship over the the widest temperature range. The resistance of metals increases with temperature. Other materials, such as carbon, are also used for ultra-low temperatures. In a typical application, RTDs are used with other reference resistors and a reference voltage to convert the resistance of the device to a voltage that can be measured.

RTDs are very accurate, typically ±0.03 °C (±0.054 °F) down to ±0.001 °C (±0.0018 °F) for ultra high precision devices. They are stable and suitable for high precision applications, but they are more expensive, especially the platinum based devices, and have a limited temperature range, typically −200 °C (−328 °F) to 500 °C (932 °F) for industrial applications. Furthermore, RTDs have slower response times and are less sensitive to small temperature changes than other temperature sensors. RTDs are best used for applications that require high precision temperature measurements at or below 500 °C (932 °F), such as in laboratories. Typically, RTDs come in two varieties: 100 Ω and 1000 Ω, their base resistance at 0 °C (32 °F). The following symbols are used to depict RTDs in diagrams.

### Thermistors

Thermistors are passive electronic devices typically made of ceramic in the form of compressed metal oxide or polymer shaped into disks or rods whose ends are attached to metal leads. The thermistor material is encased in a heat conducting but electrically insulating material. The electrical resistance of the material used within thermistors is highly dependent on temperature. There are two types of thermistor: devices whose resistance increases with temperature thus having a Positive Temperature Coefficient (PTC) and devices whose resistance decreases with temperature thus having a Negative Temperature Coefficient (NTC). PTC thermistors are mostly used in circuits to protect them against overcurrent conditions. NTC thermistors are mostly used for temperature sensing applications. As for RTDs, thermistors are used with other reference resistors and a reference voltage to convert the resistance of the device to a voltage that can be measured. The diagram below depicts the construction of a metal-oxide thermistor shaped as a disk.

Since we are interested in temperature sensing, we will discuss NTC thermistors. NTC thermistors have varying accuracies across temperature ranges. Metal-oxide thermistors are used for temperature ranging from −70 °C (−94 °F) to 400 °C (752 °F) while single crystal semiconductor thermistors are designed to be be used in ultra low temperatures, from 0.01 °K (−273.14 °C, −459.652 °F) up to 100 °K (−173.15 °C, −279.67 °F). Metal-oxide NTC thermistors can achieve fairly accurate temperature measurements over relatively small temperature ranges, typically ±0.1 °C (±0.18 °F) over a −40 °C (−40 °F) to 125 °C (257 °F) range. These thermistors are available in many resistance values ranging from 1 Ω to 5 MΩ, their resistance value at 25 °C (77 °F). NTC thermistors have good response times and are sensitive to small temperature changes. The following symbols are used to depict NTC thermistors in diagrams.

## Determining Sensor Type

In order to figure out the type of temperature sensor that was used in the cooking timer/thermometer probe, I used a digital multimeter to measure the resistance across the leads at different temperatures and a cooking thermometer to provide a temperature reading. The very first measurement I made was at room temperature. The temperature was 23.7 °C (74.66 °F) and the measured resistance was 244.0 kΩ. From this first measurement we can readily say that the temperature sensor is neither a thermocouple nor a resistance temperature detector as the measured resistance is orders of magnitude higher than it would be for these sensor types.

I continued the experiment using a sous-vide precision cooker, a pot of water and a cooking thermometer. I installed the sous-vide precision cooker heating element, the cooking thermometer probe and the temperature sensor probe in the pot of water. I set the precision cooker to heat the water to 35 °C and took a first measurement when the temperature had been reached for at least 5 minutes. As the temperature was slightly changing over time, I measured the minimum and maximum temperatures and the minimum and maximum resistance values over 5 minutes and I jotted them down. I repeated the exercise, setting the precision cooker temperature and taking measurements for every temperature multiples of 5 °C (9 °F) until the precision cooker temperature reached 80 °C (176 °F). I computed the average temperature and the average resistance for each set temperature and wrote them down. The following table lists all temperature and resistance average values I obtained.

Temperature (°C / °F) | Resistance (Ω) |

35.0 / 95.0 | 148 100 |

40.0 / 104.0 | 119 400 |

45.0 / 113.0 | 97 050 |

50.0 / 122.0 | 79 300 |

55.0 / 131.0 | 64 950 |

60.0 / 140.0 | 53 435 |

65.0 / 149.0 | 44 280 |

70.0 / 158.0 | 36 765 |

75.0 / 167.0 | 30 670 |

80.0 / 176.0 | 25 370 |

As can be seen in the table, the resistance values decreased as the temperature increased. In other terms, the sensor being tested has a negative temperature coefficient. From this information, we can determine that the sensor within the temperature probe is an NTC thermistor. The following graph shows the temperature as a function of the thermal sensor probe’s measured resistance. As can be seen, it is not linear.

## Resistance and Temperature Relationship

The relationship between the resistance of a semiconductor, such as a metal oxide, and temperature is well known. In 1968, John S. Steinhart and Stanley R. Hart proposed an equation that modelled very well the relationship between the resistance and temperature of thermistors. It is called the Steinhart-Hart equation and goes as follows:

1/*T* = *A *+ *B* ln *R* + *C* (ln *R*)^{3}

Where *T* is the temperature in degrees Kelvin, *R* is the resistance across the thermistor leads and *A*, *B*, and *C* are the Steinhart-Hart coefficients specific to the thermistor being used. In order to convert resistance to temperature, we must determine the values of coefficients *A*, *B*, and *C*. We need three temperature-resistance value pairs, that is the thermistor resistance value at three different temperatures to form a system of linear equations with three unknowns, *A*, *B*, and *C*. Let’s find the coefficients using the thermistor resistance values measured when the precision cooker temperature was set to 40 °C, 60 °C, and 80 °C respectively. Since 0 °C is equal to 273.15 degrees Kelvin, *T _{1}* = 313.15 °K,

*T*= 333.15 °K, and

_{2}*T*= 353.15 °K. The corresponding thermistor resistance values are

_{3}*R*= 119 400 Ω,

_{1}*R*= 53 435 Ω, and

_{2}*R*= 25 370 Ω. Rewriting the Steinhart-Hart equation using the three resistance and temperature value pairs, we get the following system of linear equations.

_{3}*A* + *B* ln 119 400 Ω + *C* (ln 119 400 Ω)^{3} = 1/313.15 °K^{−1}*A* + *B* ln 53 435 Ω + *C* (ln 53 435 Ω)^{3} = 1/333.15 °K^{−1} *A* + *B* ln 25 370 Ω + *C* (ln 25 370 Ω)^{3} = 1/353.15 °K^{−1}

or,

1 *A* + 11.690234 *B* + 1 597.6059 *C* = 3.1933578×10^{−3} °K^{−1}

1 *A* + 10.886221 *B* + 1 290.1240 *C* = 3.0016509×10^{−3} °K^{−1}

1 *A* + 10.141322 *B* + 1 042.9987 *C* = 2.8316579×10^{−3} °K^{−1}

Solving the system of linear equations we get:

*A* = 7.3927571×10^{−4} °K^{−1}*B* = 1.9407191×10^{−4} °K^{−1}*C* = 1.1600851×10^{−7} °K^{−1}

Substituting these values for the coefficients in the Steinhart-Hart equation, we get the following formula to get the temperature, *T*, in degrees Celsius, from the value of the resistance, *R*, of my temperature probe.

*T* = 1 / (7.3927571×10^{−4} + 1.9407191×10^{−4} ln *R* + 1.1600851×10^{−7} (ln *R*)^{3}) − 273.15 °C

In order to check the precision of the equation, I used previously measured temperature sensor probe resistance values to compute the corresponding temperature. The following table shows the measured temperatures and resistance values, the computed temperature as well as the difference between the measured and computed temperatures, Delta T.

Measured T (°C) | Measured R (Ω) | Computed T (°C) | Delta T (°C) |

35.0 | 148 100 | 34.9597 | −0.0403 |

40.0 | 119 400 | 40.0000 | 0.0000 |

45.0 | 97 050 | 44.9716 | −0.0284 |

50.0 | 79 300 | 49.9367 | −0.0633 |

55.0 | 64 950 | 54.9643 | −0.0357 |

60.0 | 53 435 | 60.0000 | 0.0000 |

65.0 | 44 280 | 64.9665 | −0.0335 |

70.0 | 36 765 | 69.9991 | −0.0009 |

75.0 | 30 670 | 75.0205 | 0.0252 |

80.0 | 25 370 | 80.0000 | 0.0000 |

All computed values are within 0.1 °C of the measured values which is the precision of the cooking thermometer that I used. I further tested the precision of the equation using the very first temperature sensor resistance value, 244.0 kΩ, measured at room temperature, 23.7 °C (74.66 °F). Computing the temperature using the Steinhart-Hart equation, we get 23.7470 °C, a difference of 0.0470 °C, again, well within 0.1 °C of the measured value.

## Converting Resistance to Voltage

As we did in post “A Light Activated Switch“, we will use a voltage divider as a mean to convert the thermistor’s electrical resistance into a voltage. The following circuit diagram depicts the voltage divider circuit and its connection to the Arduino micro-controller.

where the fixed resistor and the thermistor,* R _{VD}* and

*R*respectively, form a voltage divider that divides the reference voltage,

_{NTC}*V*, according to the formula

_{Ref}*V _{RNTC}* =

*V*

_{Ref}*R*

_{NT}_{C}/ (

*R*+

_{VD}*R*)

_{NTC}We need to find a value for *R _{VD}* that maximizes the voltage across

*R*for the temperatures we intend to measure with the thermistor. For this project, I intend to use the probe to eventually build a cooking thermometer and thus measure temperatures between 40 °C and 80 °C (104 °F and 176 °F). The voltage range across the thermistor between the chosen temperatures,

_{NTC}*ΔV*, determined by the voltage difference when thermistor values are between

_{RNTC}*R*and

_{low}*R*, the thermistor resistance values at the lowest and highest temperatures. Using the formula above, the voltage range is

_{high}Δ*V _{RNTC}* =

*V*

_{Ref}*R*/ (

_{low}*R*+

_{VD}*R*) −

_{low}*V*

_{Ref}*R*/ (

_{high}*R*+

_{VD}*R*)

_{high}If we plot the voltage range, Δ*V _{RNTC}*, provided by the voltage divider for thermistor values between 40 °C and 80 °C (104 °F and 176 °F) as a function of

*R*, we obtain the following graph.

_{VD}In the graph, we see that there is a value for *R _{VD}* that maximizes the voltage range for thermistor values between 40 °C and 80 °C (104 °F and 176 °F), thus maximizing the analog to digital conversion accuracy of the Arduino Uno. To find this value, we compute the first derivative with respect to

*R*and find the value of

_{VD}*R*for which the derivative is zero giving us the

_{VD}*R*value for which the slope of the curve in the graph above is zero, corresponding to the curve’s maximum point. The first derivative with respect to

_{VD}*R*for the voltage range equation is

_{VD}Δ*V _{RNTC}*‘ = −

*V*

_{Ref}*R*/ (

_{low}*R*+

_{VD}*R*)

_{low}^{2}+

*V*

_{Ref}*R*/ (

_{high}*R*+

_{VD}*R*)

_{high}^{2}

Finding the value of *R _{VD}* for which this equation is zero, we get the value of

*R*that maximizes the voltage divider voltage range

_{VD}*ΔV*.

_{RNTC}The value of *R _{VD}* determined using the formula above works when both

*R*and

_{low}*R*are greater than 0. Since the thermistor resistance at 40 °C, R

_{high}_{low}, is 119 400 Ω and the thermistor resistance at 80 °C, R

_{high}, is 25 370 Ω, we get

The closest Resistor value is 56 kΩ. The circuit now looks like the following

## Breadboarding

The following picture depicts how to connect the different parts using a solderless breadboard, jumper wires, a thermistor, a 56 KΩ resistors, and an Arduino Uno micro-controller. In the schematic, I used a thermistor instead of the probe. Of course, wires connected to the sensor can be used in lieu of the thermistor depicted.

## The Program

Here is the program that reads the thermistor’s voltage at the voltage divider, converts it to a resistance, then using the Steinhart-Hart equation, converts the resistance across the sensor to a temperature in degrees Celsius. The resistance across the sensor and the computed temperature are then returned to the connected PC.

/* Thermistor demonstration Program that computes the resistance across a thermistor and converts the value to a temperature. The temperature is then sent back to the connected PC through the serial interface. The blog post associated with this program can be found at https://lagacemichel.com MIT License Copyright (c) 2021, Michel Lagace */ // Steinhart-Hart equation parameters const float zeroKelvin = -273.15; const float coefA = 7.3927571E-04; const float coefB = 1.9407191E-04; const float coefC = 1.1600851E-07; // Temperature voltage divider parameters const float dividerResistor = 55440.0; const float vcc = 5.011; const int analogSteps = 1024; // Wait time const int oneSecond = 1000; // void setup() // Setup serial communication with connected PC. void setup() { // Serial.begin(9600); } // void loop() // Repeatedly read sensor and return temperature to PC void loop() { // Read voltage at the thermistor, convert to resistance, then to temperature float voltageR = analogRead(A0) * vcc / analogSteps + 1.0/(2.0*analogSteps); float resistance = voltageR*dividerResistor / (vcc - voltageR); float lnR = log(resistance); float temperature = 1.0 / (coefA + coefB * lnR + coefC * pow(lnR, 3.0)) + zeroKelvin; // Return thermistor resistance and temperature Serial.print("Thermistor resistance: "); Serial.print(resistance); Serial.print(" ohms, temperature: "); Serial.print(temperature); Serial.println(" C"); // Wait one second delay(oneSecond); }

After the standard program header, we declare the Steinhart-Hart equation coefficients, coefA, coefB, and coefC as computed in the previous sections above, and the value of absolute zero, zeroKelvin, in degrees Celsius. We then declare the values used in the voltage divider, measured using a digital multi-meter for maximum accuracy. We use the measured dividerResistor (R_{VD}) and the measured Arduino board vcc (V_{CC}). The number of steps in the analog to digital converter, analogSteps, is also declared. We declare the oneSecond constant to be used in the main loop to wait one second before starting a new iteration. The standard function setup() initializes the Serial communication channel and sets the communication speed to 9600 baud.

In the standard loop() function, we first read the analog input channel A0 taken across the thermistor and convert the analog step value to a floating point value in volts, voltageR. We use that value to compute the resistance across the thermistor, resistance. The temperature is then computed, using the Steinhart-Hart equation. The resistance and temperature are sent back to the PC using the Serial library. Finally, we wait one second before exiting the loop() function.

## Putting It to Work

Build the circuit shown above and connect the Arduino Uno to your computer using a USB cable. On the computer, within the Arduino IDE, copy and paste the code above into a new sketch, compile and download the sketch then press the control, shift, and M keys simultaneously. This will make the Serial Monitor window appear. Every second, the Arduino program will send the temperature measured by the sensor as a character string back to the computer. The text is displayed on the Serial Monitor window and the output should look like the following:

## What Next

Now that I have a way to use the thermistor sensor, I could build a standalone device, using the temperature probe, that would display the temperature at the probe and sound an alarm when a set temperature has been reached. In an upcoming post, I will discuss the construction of such a device.