TEMPERATURE SENSORS

# Temperature Sensors

Article by:

## 1. Overview

Temperature sensors are electronic transducers which measure the temperature of the nearby body (which in many cases is the temperature sensor itself) and then converts it into either a analogue or digital electrical signal.

Figure 1. A schematic icon for a temperature sensor.

## 2. Linear Active Temperature Sensors

Linear active temperature sensors output a analogue voltage which is proportional (linear) to the temperature, and require a voltage supply to run.

Figure 2. A photo of the common TMP36 analogue temperature sensor in the TO-92 package. Image from https://www.sparkfun.com/products/10988.

They require contact with the medium that is to be measured. They usually require three connections (power, ground, and $$V_{out}$$, but can be purchased in packages with more pins. They use an internal diode to measure the temperature, surrounded by circuitry which linearises the output, provides an offset, and makes the reading insensitive to other parameter changes.

Figure 3. Graph of the voltage output vs. temperature for a Microchip TC1046 analogue temperature sensor. Image from http://ww1.microchip.com/downloads/en/DeviceDoc/21496C.pdf.

Being encapsulated in a standard through-hole or surface mount component package, these temperature sensors are designed to measure the temperature at the location at which they are soldered onto the circuit board. This is called local temperature sensing. This makes them somewhat unsuitable if you want to measure the temperature of an off-PCB location (remote temperature sensing), although you can mount the through-hole versions onto pretty much anything you want and then attach it to the PCB via a cable. The Texas Instruments LM35DT temperature sensor is one of the last commonly available sensors in a TO-220 package.

This type of temperature sensor is one of the easiest to interface with a microcontroller in an embedded system, since the output can be directly connected to an ADC input, voltage read, and then converted into a temperature by a simple linear equation. They usually output a change of 10 or 19.5mV per degree Celsius, which provides 1bit per degree on a 8-bit ADC with a reference voltage of either 2.5V or 5.0V respectively.

 When looking at the accuracy, be careful, as they usually advertise the typical accuracy, but it is normally the worst case accuracy that is more important to the PCB designer. Sometimes the stated accuracy is only achievable after calibration.

## 3. NTC Thermistors

A negative-temperature coefficient (NTC) thermistor can be used as a temperature sensor. A NTC thermistor is a resistor which has a non-linear change in resistance in a response to a change in temperature. It is a passive sensor.

Figure 4. An example of a NTC thermistor built into a metal lug, and provided with a cable and connector. Vishay component NTCALUG03A103GC. Image from www.digikey.com.

### 3.1. NTCs vs RTDs

A NTC differs from a resistive temperature detector (RTD) in the material used to make the sensor. RTDs have a resistive element made with pure metals, while NTCs have a resistive element made from ceramics or polymers with semiconductor properties.

NTCs are used for smaller, but more accurate temperature ranges such as measuring ambient temperature or fridge/freezer temperature, while RTDs are used for larger, less accurate temperature ranges such as measuring furnace temperature.

### 3.2. Temperature Accuracy

The temperature accuracy of a thermistor can be calculated (at the reference temperature) by dividing the percentage resistance tolerance at 25°C (or whatever the reference temperature is) by the thermistor’s temperature coefficient, $$\alpha$$.

\begin{align} \text{accuracy (at T)} = \frac{\text{resistance tolerance (at T)}}{\alpha\text{ (at T)}} \end{align}

For example, the Vishay NTCALUG03A103GC has a resistance tolerance of $$\pm 2%$$ and $$\alpha_{25} = \pm 4.39%$$. Therefore:

\begin{align} \text{accuracy}_{25} = \frac{2%}{4.39} \\ = 0.46% \end{align}

### 3.3. Self Heating

A NTC thermistor, like any other resistor, dissipates energy as heat when current flows through it. The power dissipation, $$P_{NTC}$$ in a NTC thermistor is:

\begin{align} P_{NTC} = I^2 * R \end{align}

where:
$$I$$ is the current going through the thermistor, in Amps
$$R$$ is the resistance of the thermistor, at the present temperature, in Ohms
$$P_{NTC}$$ is the power dissipation as heat in the NTC thermistor, in Watts

Because the resistance of the NTC changes as the temperature changes, so does the dissipated power. In a simple resister divider circuit, the thermistor dissipates the most power when it’s resistance is equal to the fixed resistance.

 To make sure self-heating doesn’t affect your temperature measurements, make sure that no more than 1mW of power is dissipated in the NTC thermistor at any temperature.

### 3.4. Beta Equation

The Beta equation or Beta formula is a empirical equation used to work out the temperature from the measured resistance of a NTC thermistor.

It uses a single material constant, $$\beta$$, which is also known as the coefficient of temperature sensitivity. The equation is an exponential approximation of the relationship between resistance and temperature in the form:

\begin{align} R(T) = R(T_0)e^{\beta(\frac{1}{T} - \frac{1}{T_0})} \end{align}

where:
$$R(T)$$ is the actual resistance, in Ohms, at the actual temperature $$T$$
$$R(T_0)$$ is the reference resistance, in Ohms, at the reference temperature $$T_0$$
$$T$$ is the actual temperature, in Kelvin
$$T_0$$ is the reference temperature, in Kelvin

At best, the accuracy of the Beta equation approaches $$\pm 1%$$ between $$0-100^{\circ}C$$, and not more than $$\pm 5%$$ other the NTC thermistor’s entire temperature range.

$$\beta$$ can be calculated when you have both the temperature and resistance of the thermistor at two different operating points. $$\beta$$ can be calculated as follows:

\begin{align} \beta = \frac{ln(R_1) - ln(R_2)}{\frac{1}{T_1} - \frac{1}{T_2}} \end{align}

Or, written another way:

\begin{align} \beta = \frac{T_1 * T_2}{T_2 - T1}ln(\frac{R_1}{R_2}) \end{align}

Re-arranged so that we can calculate a temperature from a measured resistance, and using the terminology $$R_0$$ and $$T_0$$ instead of $$R_2$$ and $$T_2$$, we get the following equation:

\begin{align} \frac{1}{T} = \frac{1}{T_0} + \frac{1}{\beta}ln(\frac{R}{R_0}) \end{align}

The free embedded-engineering calculator app, NinjaCalc, features a calculator for working out the thermistor temperature (or any other variable) using the Beta equation.

### 3.5. Steinhart-Hart Equation

The Steinhart-Hart is a complex but highly accurate way of modelling the relationship between temperature and resistance of a NTC thermistor.

The Steinhart-Hart equation is:

\begin{align} \frac{1}{T} = A + Bln(R) + C(ln(R))^3 \end{align}

where:
$$T$$ is the temperature, in Kelvins
$$R$$ is the resistance at $$T$$, in Ohms
$$A, B, C$$ are the Steinhart-Hart coefficients which vary depending on the type of thermistor and the temperature range of interest

 The $$B$$ in the Steinhart-Hart equation above is not the same as the $$\beta$$ in the Beta Equation.

### 3.6. Linearising The NTC With Extra Resistors

By just adding a few extra resistors, the output of a NTC thermistor can be "linearised" enough that the equation $$y = ax + b$$ can be used within the microcontroller over a limited temperature range.

Linearisation is also used in purely analogue circuits in where there is no digital circuitry (that means no ADCs or processing logic), and the output of the NTC thermistor circuit goes directly to a voltage comparator (or similar) to control an output.

## 4. Digital Temperature Sensors

Digital temperature sensors are not as easy to interface with a microcontroller, but offer other advantages, such as the ability to be added onto an existing communication bus (and hence requiring to extra pins to the microcontroller), less sensitivity to noise (you are now transmitting a digital signal, not an analogue one), and the ability to chain many together (temperature sensors using the I2C or 1-Wire interface commonly allow for this).

Figure 5. The TMP102 digital temperature sensor.

Digital temperature sensors require contact with the medium that is to be measured.

 Although digital sensors are more immune to external noise, they also generate more noise than analogue ones (think about the sharp rise/fall times of a digital signal). It may be desirable to use an analogue temperature sensor in a highly sensitive environment.

### 4.1. History

The first every temperature sensor IC was the Texas Instruments LM3911 in 1970.

### 4.2. Sequence Detect

Because it is common to want to string many temperature sensors together to get temperature profiles of large objects (e.g. rooms, buildings, chimneys, pipes, …​) you can get temperature sensors which support sequence detect. This allows a microcontroller to determine the position of each sensor in a daisy chain, without requiring a manually entered look-up table (LUT). They normally also use the 1-wire interface, making them very easy to string together. The DS28EA00 "1-wire digital thermometer with sequence detect and PIO" from Dallas is one example. Below is a typical application circuit for this temperature sensor.

Figure 6. A typical application circuit for the Dallas DS28EA00 '1-wire digital thermometer with sequence detect and PIO' sensor.

## 5. Thermostats

Thermostats are simple on/off switched that are controlled by temperature. They are used in cheap, simple, bang-bang temperature control, and the huge benefit with these is that they don’t require a microcontroller or other logic device to control them. The KSD301 is a common code for a family of thermostats with varying temperature ratings.

## 6. Infrared Thermopiles

Infrared thermopiles can measure the temperature of an object without coming into contact with it. They measure the amount of incoming infrared radiation, which is related to the temperature of the object. You can by them in IC packages for directly mounting onto a PCB. The ICs normally come with interface electronics, so that you communicate and read the temperature back over a serial communications protocol such as I2C. One example is the TI TMP006.

## 7. Composite Sensors

Temperature sensors are so ubiquitous that they are often integrated into other sensor ICs to create composite sensors. They are also very useful in helping to calibrate the measurement of another sensor reading, as many real-world measurements dependent on the temperature.

One such example would be humidity sensors.

## Authors

### Geoffrey Hunter

Dude making stuff.