Buying guide · Beginner · 3 min read
How to Choose a Temperature Sensor for Arduino and ESP32
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
Pick a temperature sensor by range, environment and interface. For room temperature and humidity, a DHT22 or BME280 is easiest. For water, soil or several points on one wire, use the waterproof DS18B20. Above 125 °C, such as ovens or kilns, use a K-type thermocouple with a MAX6675 or MAX31855. To measure a surface without touching it, use an MLX90614 infrared sensor.
Key specs at a glance
- DHT22
- −40 to 80 °C, ±0.5 °C, plus humidity
- DS18B20
- −55 to 125 °C, ±0.5 °C, 1-Wire, waterproof probes
- LM35 / TMP36
- Analog, 10 mV per °C
- NTC thermistor
- Cheap, analog, needs a divider and a formula
- K-type thermocouple
- Up to about 1000 °C with a MAX6675 or MAX31855
- MLX90614
- Non-contact IR, object −70 to 380 °C
Comparison
| Sensor | Range | Accuracy | Interface | Best for |
|---|---|---|---|---|
| DHT11 | 0 to 50 °C | ±2 °C | Single-wire | Cheapest classroom demos |
| DHT22 / AM2302 | −40 to 80 °C | ±0.5 °C | Single-wire | Room temperature and humidity |
| BME280 | −40 to 85 °C | ±1 °C | I2C / SPI | Weather stations with pressure |
| DS18B20 | −55 to 125 °C | ±0.5 °C | 1-Wire | Water, soil, freezers, many probes |
| LM35 | −55 to 150 °C | ±0.5 °C at 25 °C | Analog | Simple analog readings at 5 V |
| TMP36 | −40 to 125 °C | ±2 °C | Analog | 3.3 V boards |
| NTC 10k thermistor | −40 to 125 °C | Depends on calibration | Analog divider | 3D printers, low cost |
| Thermocouple + MAX6675 | 0 to 1024 °C | ±2 to 3 °C | SPI | Ovens, kilns, reflow |
| MLX90614 | −70 to 380 °C (object) | ±0.5 °C near room temperature | I2C | Non-contact surfaces |
- DHT11
- Range:
- 0 to 50 °C
- Accuracy:
- ±2 °C
- Interface:
- Single-wire
- Best for:
- Cheapest classroom demos
- DHT22 / AM2302
- Range:
- −40 to 80 °C
- Accuracy:
- ±0.5 °C
- Interface:
- Single-wire
- Best for:
- Room temperature and humidity
- BME280
- Range:
- −40 to 85 °C
- Accuracy:
- ±1 °C
- Interface:
- I2C / SPI
- Best for:
- Weather stations with pressure
- DS18B20
- Range:
- −55 to 125 °C
- Accuracy:
- ±0.5 °C
- Interface:
- 1-Wire
- Best for:
- Water, soil, freezers, many probes
- LM35
- Range:
- −55 to 150 °C
- Accuracy:
- ±0.5 °C at 25 °C
- Interface:
- Analog
- Best for:
- Simple analog readings at 5 V
- TMP36
- Range:
- −40 to 125 °C
- Accuracy:
- ±2 °C
- Interface:
- Analog
- Best for:
- 3.3 V boards
- NTC 10k thermistor
- Range:
- −40 to 125 °C
- Accuracy:
- Depends on calibration
- Interface:
- Analog divider
- Best for:
- 3D printers, low cost
- Thermocouple + MAX6675
- Range:
- 0 to 1024 °C
- Accuracy:
- ±2 to 3 °C
- Interface:
- SPI
- Best for:
- Ovens, kilns, reflow
- MLX90614
- Range:
- −70 to 380 °C (object)
- Accuracy:
- ±0.5 °C near room temperature
- Interface:
- I2C
- Best for:
- Non-contact surfaces
Questions that decide it
- 1Does it get wet? Choose a stainless-steel DS18B20 probe.
- 2Do you also need humidity? Choose a DHT22 or DHT11, or a BME280.
- 3Over 125 °C? Choose a thermocouple and amplifier.
- 4Cannot touch the object? Choose an MLX90614 IR sensor, and remember shiny metal reads low.
- 5Many points? DS18B20s share one pin.
- 63.3 V board? Avoid the LM35, which needs at least 4 V; use a TMP36 or a digital sensor.
Getting accurate readings
Keep sensors away from regulators, the microcontroller and sunlight, all of which add heat. Digital sensors avoid ADC noise; with analog sensors, average several readings and use a stable reference (see ADC basics). Check two sensors side by side in a glass of ice water (0 °C) to spot an outlier, and apply a simple offset in code if needed.
Try it: ADC resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Running an LM35 from 3.3 V.
- Mounting the sensor next to a hot regulator.
- Using a DHT11 where ±2 °C is not good enough.
- Trusting MLX90614 readings on shiny metal.
- Feeding a thermocouple straight into an analog pin.
Frequently asked questions
What is the most accurate temperature sensor for Arduino?
Among common modules, the DS18B20 and DHT22 offer about ±0.5 °C; the SHT3x and similar parts can do better.
Which temperature sensor is waterproof?
The DS18B20 in a stainless-steel probe with a sealed cable.
How do I measure high temperatures with Arduino?
Use a K-type thermocouple with a MAX6675 or MAX31855 amplifier, which reads up to about 1000 °C over SPI.
Can I measure body temperature with these sensors?
An MLX90614 can show a skin reading for learning, but hobby modules are not medical thermometers.
LM35 or TMP36?
LM35 for 5 V boards; TMP36 for 3.3 V boards, as it works down to 2.7 V.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 167 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- Analog Devices DS18B20, MAX6675 and MAX31855 datasheets
- Texas Instruments LM35 datasheet
- Analog Devices TMP36 datasheet
- Melexis MLX90614 datasheet
- Aosong AM2302 (DHT22) datasheet
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.


