Skip to content

Temperature Sensors

Published On:
Nov 8, 2012
Last Updated:
Jan 18, 2022

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.

A schematic icon for a temperature sensor.

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.

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 VoutV_{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.

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.

TIP: 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.

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.

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.

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.

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.

accuracy (at T)=resistance tolerance (at T)α (at T)\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 ±2\pm 2% and α25=±4.39\alpha_{25} = \pm 4.39%. Therefore:

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

Self Heating

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

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

where:
II is the current going through the thermistor, in Amps
RR is the resistance of the thermistor, at the present temperature, in Ohms
PNTCP_{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.

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:

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

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

At best, the accuracy of the Beta equation approaches ±1\pm 1% between 0100C0-100^{\circ}C, and not more than ±5\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:

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

Or, written another way:

β=T1T2T2T1ln(R1R2)\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 R0R_0 and T0T_0 instead of R2R_2 and T2T_2, we get the following equation:

1T=1T0+1βln(RR0)\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.

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:

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

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

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+by = 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.

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).

The TMP102 digital temperature sensor.

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

History

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

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.

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

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.

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.

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.