Sensors

Temperature Sensors

Temperature sensors are electronic devices used to measure temperature and convert it into an electrical signal. They are used in electronics, industrial equipment, appliances, automotive systems, HVAC equipment, power supplies, battery systems and embedded applications.

What Is a Temperature Sensor?

A temperature sensor detects changes in temperature and produces a corresponding electrical output.

Depending on the sensor technology, the output may be:

  • A change in resistance
  • A voltage
  • A current
  • A digital data signal

The sensor can then be connected to a measuring circuit, controller, microcontroller or monitoring system.

How Temperature Sensors Work

Different temperature sensors use different physical properties to measure temperature.

Temperature
     │
     ▼
Temperature Sensor
     │
     ▼
Electrical Signal
     │
     ▼
Controller / Measurement Circuit
     │
     ▼
Temperature Reading

For example, a thermistor changes resistance as its temperature changes, while a semiconductor temperature sensor may produce a voltage that is related to temperature.

Main Types of Temperature Sensors

The most common temperature-sensing technologies include:

  • NTC thermistors
  • PTC thermistors
  • RTDs
  • Thermocouples
  • Semiconductor temperature sensors
  • Digital temperature sensors

NTC Thermistor

An NTC thermistor has a negative temperature coefficient. Its resistance decreases as temperature increases.

Temperature ↑
     │
     ▼
Resistance ↓

NTC thermistors are widely used for temperature measurement and temperature compensation.

They are also commonly used for limiting inrush current in power supplies, although that is a different application from temperature measurement.

PTC Thermistor

A PTC thermistor has a positive temperature coefficient. Its resistance generally increases as temperature increases over its specified operating region.

Temperature ↑
     │
     ▼
Resistance ↑

PTC devices are used in temperature sensing, protection and current limiting applications.

NTC vs PTC

Feature NTC PTC
Temperature coefficient Negative Positive
Temperature increases Resistance decreases Resistance increases
Common use Temperature sensing Protection and sensing
Typical circuit Voltage divider Voltage divider or protection circuit

RTD Temperature Sensor

RTD stands for Resistance Temperature Detector.

An RTD measures temperature by exploiting the predictable change in resistance of a sensing element as temperature changes.

Platinum RTDs are particularly common in precision temperature measurement.

PT100

A PT100 is a platinum RTD whose nominal resistance is:

100 Ω at 0°C

Its resistance changes in a predictable manner with temperature.

PT100 sensors are widely used in industrial temperature measurement.

PT1000

A PT1000 is another platinum RTD. Its nominal resistance is:

1000 Ω at 0°C

The higher resistance can make wiring resistance less significant in some measurement applications.

RTD Wiring

RTDs can use different wiring configurations.

Common configurations include:

  • 2-wire
  • 3-wire
  • 4-wire

The purpose of the additional wires in 3-wire and 4-wire configurations is to reduce or compensate for the effect of lead resistance.

2-Wire RTD

A two-wire RTD is the simplest connection.

Measurement Circuit
      │
      ├──────── RTD ────────┤
      │                     │
      └─────────────────────┘

The resistance of the connecting wires becomes part of the measured resistance.

This can introduce errors, particularly when the sensor is far from the measurement circuit.

3-Wire RTD

A three-wire RTD configuration can compensate for lead resistance when used with an appropriate measurement circuit.

This arrangement is widely used in industrial temperature measurement.

4-Wire RTD

A four-wire RTD connection provides highly accurate resistance measurement by separating the current-carrying and voltage-sensing paths.

This configuration can significantly reduce the effect of lead resistance.

Thermocouples

A thermocouple produces a voltage related to temperature based on the thermoelectric effect.

It consists of two different conductive materials joined together.

Metal A
   │
   ├──── Junction
   │
Metal B
   │
   ▼
Thermoelectric Voltage

Thermocouples are available in several types, each using different materials and having different temperature ranges and characteristics.

Common Thermocouple Types

Common thermocouple types include:

  • Type K
  • Type J
  • Type T
  • Type E
  • Type N
  • Type R
  • Type S
  • Type B

Each type has its own material combination, temperature range and electrical characteristics.

Type K Thermocouple

Type K is one of the most widely used thermocouple types.

It is commonly used for general-purpose temperature measurement across a wide temperature range.

Type K probes are available in many physical forms, including probes, thermocouple wire and industrial assemblies.

Thermocouple Signal

The voltage generated by a thermocouple is relatively small.

Therefore the measurement circuit normally requires careful signal conditioning and amplification.

Thermocouple measurement also requires consideration of the reference junction.

Cold-Junction Compensation

A thermocouple measures a temperature difference rather than simply producing a voltage corresponding to one absolute temperature.

Electronic thermocouple measurement systems therefore normally use cold-junction compensation to determine the temperature of the reference junction.

Semiconductor Temperature Sensors

Semiconductor temperature sensors use the electrical characteristics of semiconductor devices to measure temperature.

They are commonly available as:

  • Analog temperature sensors
  • Digital temperature sensors
  • Temperature sensor ICs

Analog Temperature Sensors

An analog temperature sensor produces a voltage or current that varies with temperature.

The output can be connected to an ADC or analog measurement circuit.

Temperature
     │
     ▼
Analog Sensor
     │
     ▼
Voltage
     │
     ▼
ADC
     │
     ▼
Microcontroller

Digital Temperature Sensors

Digital temperature sensors contain signal-conditioning and conversion electronics and communicate the measured temperature digitally.

Common interfaces include:

  • I2C
  • SPI
  • 1-Wire

DS18B20

The DS18B20 is a popular digital temperature sensor that communicates using the 1-Wire protocol.

It can provide temperature measurements to a microcontroller using a single data connection plus the required power and ground connections.

Multiple devices can also share the same 1-Wire bus when properly configured.

LM35

The LM35 is a well-known analog temperature sensor.

Its output voltage varies approximately linearly with temperature, making it convenient for connection to an analog-to-digital converter.

The exact electrical characteristics and accuracy depend on the device version and operating conditions.

Thermistor Temperature Measurement

A thermistor is often connected as part of a voltage divider.

VCC
 │
 R
 │
 ├────── VOUT
 │
NTC
 │
GND

As the temperature changes, the thermistor resistance changes and the divider output voltage changes.

The microcontroller can measure this voltage using an ADC.

Voltage Divider

For a basic voltage divider:

VOUT = VCC × R2 / (R1 + R2)

If one resistor is a thermistor, the output voltage becomes temperature dependent.

The microcontroller can then convert the measured voltage into a temperature value using a mathematical model or calibration data.

NTC Resistance and Temperature

NTC thermistors have a nonlinear resistance-versus-temperature characteristic.

A commonly used approximation is the Beta equation:

1/T = 1/T0 + (1/B) ln(R/R0)

where temperatures are expressed in kelvin and the thermistor characteristics are represented by the appropriate reference resistance and Beta value.

For high-accuracy applications, manufacturer resistance-temperature tables or calibrated equations are preferable.

Temperature Sensor Accuracy

Sensor accuracy depends on more than the nominal sensor specification.

Important factors include:

  • Sensor tolerance
  • Calibration
  • ADC accuracy
  • Reference voltage
  • Self-heating
  • Lead resistance
  • Environmental conditions
  • Signal noise

Sensor Self-Heating

A temperature sensor can heat itself if measurement current is too high.

This is particularly important for resistive sensors such as thermistors and RTDs.

The measurement current should therefore be selected carefully.

Temperature Sensor Response Time

Response time describes how quickly a sensor reacts to a change in temperature.

It depends on:

  • Sensor construction
  • Sensor size
  • Encapsulation
  • Thermal mass
  • Air or liquid movement
  • Mounting method

A small exposed sensor normally responds faster than a large sensor with heavy protective encapsulation.

Temperature Sensor Placement

Sensor placement is critical for accurate measurement.

The sensor should be positioned where its temperature represents the temperature that needs to be measured.

For example, a sensor intended to monitor a power transistor should have good thermal contact with the transistor or its heatsink.

Temperature Sensors in Amplifiers

Temperature sensors are commonly used in power amplifiers to monitor heatsink temperature.

The measured temperature can be used for:

  • Thermal protection
  • Fan control
  • Over-temperature shutdown
  • Monitoring

A sensor may be mounted close to the output transistors or attached to the heatsink.

Temperature Sensors in Power Supplies

Power supplies can use temperature sensors to monitor:

  • Power MOSFETs
  • Transformers
  • Heatsinks
  • Rectifiers
  • Inductors

The control circuit can reduce the load, increase cooling or shut down the system when excessive temperature is detected.

Temperature Sensors in Batteries

Battery systems can use temperature sensors to monitor cell or pack temperature.

Temperature information can be used by the battery-management system to control charging, discharging and protection functions.

Temperature Sensor Wiring

The wiring depends on the sensor technology.

Sensor Typical Connection
NTC Voltage divider
PTC Resistance measurement or divider
PT100 2-wire, 3-wire or 4-wire
Thermocouple Thermocouple input circuit
Analog sensor IC Analog voltage output
Digital sensor I2C, SPI or 1-Wire depending on device

Temperature Sensor Filtering

Temperature normally changes relatively slowly compared with electrical noise.

A small amount of filtering can therefore improve measurement stability.

Possible filtering methods include:

  • RC filtering
  • Moving averages
  • Digital low-pass filtering
  • Oversampling

Filtering should not be excessive because it can make the temperature reading respond too slowly to real temperature changes.

Temperature Sensor Calibration

Calibration compares the sensor measurement against a known temperature reference.

Calibration can compensate for:

  • Sensor tolerance
  • Measurement-circuit errors
  • ADC errors
  • Systematic offsets

For high-accuracy systems, calibration should be performed using an appropriate reference instrument.

Testing a Thermistor

A multimeter can be used to measure the resistance of a thermistor.

  1. Disconnect the thermistor from the circuit.
  2. Measure its resistance.
  3. Measure the ambient temperature.
  4. Compare the resistance with the manufacturer's resistance-temperature table.
  5. Warm or cool the sensor carefully.
  6. Observe whether the resistance changes in the expected direction.

An NTC should normally decrease in resistance as its temperature rises.

Testing an RTD

An RTD can be tested by measuring its resistance.

For a PT100, the resistance should be close to its expected value at the measured temperature.

For accurate testing, use an appropriate resistance measurement method and account for lead resistance.

Testing a Thermocouple

A thermocouple produces a relatively small voltage.

Testing therefore requires suitable instrumentation.

The polarity and thermocouple type must also be identified correctly.

A thermocouple should not be evaluated solely by measuring its resistance with a normal multimeter.

Testing a Digital Temperature Sensor

For a digital sensor, first check the power supply and communication interface.

Depending on the device, verify:

  • Supply voltage
  • Ground
  • Data line
  • Clock line where applicable
  • Pull-up resistors where required
  • Device address
  • Communication protocol

Temperature Sensor Faults

Symptom Possible Cause
Reading too high Sensor fault, wiring error or calibration problem
Reading too low Sensor fault, wiring error or calibration problem
Reading does not change Open sensor, software fault or wiring problem
Reading jumps randomly Noise, poor connection or unstable supply
Digital sensor not detected Power, wiring, address or communication problem
Slow response Large thermal mass, poor mounting or excessive filtering

Open Temperature Sensor

An open thermistor or RTD can cause a measurement circuit to produce an extreme reading depending on the circuit configuration.

Check the sensor resistance directly with a multimeter after disconnecting it from the circuit.

Shorted Temperature Sensor

A shorted sensor can produce the opposite extreme reading.

Check for:

  • Shorted sensor element
  • Damaged cable
  • Water or contamination
  • Shorted PCB traces
  • Connector problems

Temperature Sensor Noise

Electrical noise can affect low-level temperature measurements.

Possible solutions include:

  • Shorter sensor wiring
  • Shielded cables where appropriate
  • Proper grounding
  • RC filtering
  • Digital filtering
  • Stable reference voltage

Temperature Sensor Replacement

When replacing a temperature sensor, match its electrical and mechanical characteristics.

Check:

  • Sensor type
  • Resistance or output characteristic
  • Temperature range
  • Accuracy
  • Response time
  • Physical dimensions
  • Connector
  • Cable length
  • Mounting method

How to Select a Temperature Sensor

  1. Determine the required temperature range.
  2. Determine the required accuracy.
  3. Choose the sensor technology.
  4. Determine the required response time.
  5. Choose the appropriate electrical interface.
  6. Consider sensor size.
  7. Consider mounting requirements.
  8. Consider cable length.
  9. Consider environmental conditions.
  10. Check calibration requirements.
  11. Check replacement availability.

Choosing Between Temperature Sensor Types

Sensor Main Advantage Typical Application
NTC Low cost and simple Appliances and electronics
PTC Useful resistance increase with temperature Protection and sensing
RTD Good accuracy and stability Industrial measurement
Thermocouple Wide temperature capability Industrial and high-temperature measurement
Analog sensor IC Simple voltage output Embedded electronics
Digital sensor Direct digital measurement Microcontroller systems

Temperature Sensors in Microcontroller Projects

Microcontrollers can interface with many different temperature sensors.

Temperature Sensor
        │
        ▼
Signal Conditioning
        │
        ▼
Microcontroller
        │
        ├── Display
        ├── Fan
        ├── Alarm
        └── Control System

The microcontroller can use the temperature information to display a reading or control another part of the system.

Temperature Sensor with ESP32

The ESP32 can interface with analog, digital and external temperature sensors.

Examples include:

  • NTC thermistors through the ADC
  • DS18B20 through 1-Wire
  • I2C temperature sensors
  • SPI temperature sensors

The appropriate interface depends on the selected sensor.

Temperature Sensor Applications

  • Power amplifiers
  • Switching power supplies
  • Battery chargers
  • Battery-management systems
  • Refrigerators
  • Air conditioners
  • Ovens
  • Water heaters
  • Automotive systems
  • Industrial machines
  • HVAC systems
  • Computers
  • Servers
  • Motor controllers
  • Electronic instruments

Advantages of Temperature Sensors

  • Enable automatic temperature monitoring
  • Provide thermal protection
  • Allow temperature-based control
  • Available in many technologies
  • Available for very wide temperature ranges
  • Can be inexpensive
  • Can interface directly with microcontrollers

Common Temperature-Sensor Design Mistakes

  • Choosing the wrong sensor type
  • Ignoring the sensor's temperature range
  • Ignoring sensor self-heating
  • Using an incorrect thermistor Beta value
  • Ignoring RTD lead resistance
  • Using the wrong thermocouple type
  • Ignoring cold-junction compensation
  • Using an unsuitable ADC reference
  • Mounting the sensor poorly
  • Ignoring electrical noise

Key Points

  • Temperature sensors convert temperature into an electrical signal.
  • NTC thermistors decrease in resistance as temperature increases.
  • PTC thermistors increase in resistance as temperature increases over their specified operating region.
  • RTDs measure temperature through a predictable resistance change.
  • PT100 and PT1000 are common platinum RTDs.
  • Thermocouples generate a small voltage through the thermoelectric effect.
  • Thermocouple measurements normally require cold-junction compensation.
  • Analog temperature sensors provide voltage or current outputs.
  • Digital temperature sensors communicate using interfaces such as I2C, SPI or 1-Wire.
  • Sensor placement strongly affects measurement accuracy.
  • Self-heating can introduce errors in resistive sensors.
  • Always check the sensor's range, accuracy, interface and mounting requirements before replacement.

Continue Learning About Temperature Sensors

The next pages can cover thermistors, NTC and PTC characteristics, RTDs, PT100, PT1000, thermocouples, semiconductor sensors, digital temperature sensors, wiring, testing, applications, troubleshooting, replacement and selection.