Comparison Guide: Temperature and Humidity Sensors for ESP32, RPi Pico and Similar Boards

Looking for a temperature or humidity sensor for your electronics projects? There is a wide variety of temperature and humidity sensors compatible with ESP32, RPi Pico, Arduino (and other microcontroller boards). In this article, we’ll compare some of the most popular sensors and see which ones are better options for different use cases.

Comparison Guide: Temperature and Humidity Sensors for ESP32, RPi Pico and Similar Boards

We’ll compare the sensors when it comes to accuracy, resolution, communication protocol, temperature range, ease of use, library support, and more.

In our tutorials, we’ve been using mostly BME20, SHT41, DHT22, and DS18B20 because these are cheap, easy to use, and great for teaching and explaining IoT, microcontrollers, and programming concepts. However, for some projects, those might not be the best choice. That’s why we’ve put together this comparison guide with many temperature sensor options that you can use in your projects.

Temperature (and Humidity) Sensor Options

In this article, we cover Sensirion SHT, Bosch BME/BMP, Texas Instruments TMP, DHT sensors, and Aosong AHT series. We also include environmental sensors, digital and analog temperature sensors, thermocouples, and more. See the complete list below:

Temperature Sensor Comparison Guide Specifications

Aosong sensors

  • AHT series (temperature and humidity): AHT20, AHT10, AHT21
  • DHT series (temperature and humidity): DHT11, DHT22 (AM2302), AM2320

Sensirion I2C sensors

  • SHT series (temperature and humidity): SHT30, SHT31, SHT35, SHT40, SHT41, and SHT45
  • SCD series (CO2 sensor with temperature and humidity): SCD40, SCD41

Bosch sensors

  • BME280 Temperature, Humidity, and Pressure
  • BME680 Temperature, Humidity, Pressure, and Gas
  • BME688 Temperature, Humidity, Pressure, and Gas
  • BMP280 Temperature and Pressure
  • BMP388 Temperature and Pressure

Texas Instruments sensors

  • TMP117 Temperature
  • TPM102 Temperature
  • HDC1080 Temperature and Humidity

TE Connectivity (Measurement Specialties)

  • HTU21D Temperature and Humidity

Silicon Labs

  • Si7021 Temperature and Humidity

Analog Devices / Maxim Integrated

  • DS18B20
  • LM35
  • TMP36
  • MAX6675 + K-type thermocouple
  • MAX31855 + K-type thermocouple
  • MAX31856 + K-type thermocouple
  • MAX31865 + PT100 / PT1000

Microchip Technology

  • MCP9808 Temperature

Melexis

  • MLX90614 non-contact infrared temperature sensor

Temperature/Humidity Sensors Comparison: Key Specifications

For a quick comparison of the sensors, we’ve put together the following table that shows the most important information when it comes to selecting a temperature sensor: communication protocol, supply voltage, temperature range, accuracy, typical price, and more.

Note: the table scrolls horizontally.

SensorMeasuresTemp accuracyTemp rangeRH accuracyRH rangeResolution (T / RH)InterfaceSupplyMeasurement timePriceDatasheet
DHT11T + RH±2°C0–50°C±5%20–80%1°C / 1%Proprietary single-wire 3–5.5V≤1 Hz$1–3Datasheet
DHT22 / AM2302T + RH±0.5°C-40–80°C±2%0–100%0.1°C / 0.1%Proprietary single-wire3.3–6V≥2 s$3–10Datasheet
AM2320T + RH±0.5°C-40–80°C±3%0–99.9%0.1°C / 0.1%I2C or single-wire3.1–5.5V≥2 s$3–8Datasheet
AHT20 (also AHT10/AHT21)T + RH±0.3°C-40–85°C±2% (20–80%)0–100%~0.01°C / ~0.024%I2C2.0–5.5 V~80 ms$1–5Datasheet
HTU21D / GY-21T + RH±0.3°C-40–125°C±2% (20–80%)0–100%0.01°C / 0.04%I2C1.5–3.6V (modules often 3–5V)~15–50 ms$2–15Datasheet
Si7021T + RH±0.4°C-10–85°C±3%0–80%0.01°C / 0.04%I2C1.9–3.6V~10–25 ms$3–9Datasheet
HDC1080T + RH±0.2°C-40–125°C±2%0–100%14-bit / 14-bitI2C2.7–5.5V~6.5 ms each$4–10Datasheet
SHT30T + RH±0.3°C-40–125°C±3%0–100%16-bit (~0.01°C/ 0.01%)I2C2.15–5.5V~4–15 ms, up to 10 Hz$2–6Datasheet
SHT31T + RH±0.2 °C-40–125 °C±2 %0–100 %16-bitI2C2.15–5.5V~4–15 ms, up to 10 Hz$3–15Datasheet
SHT35T + RH±0.1 °C-40–125 °C±1.5 %0–100 %16-bitI2C2.15–5.5V~4–15 ms, up to 10 Hz$10–25Datasheet
SHT40 / SHT41T + RH±0.2 °C-40–125 °C±1.8 %0–100 %16-bitI2C1.08–3.6V chip (modules 3–5V)~1–9 ms$5–10Datasheet
SHT45T + RH±0.1°C-40–125°C±1.0%0–100%16-bitI2C1.08–3.6V chip (modules 3–5V)~1–9 ms$10–16Datasheet
BME280T + RH + pressure±0.5°C-40–85°C±3%0–100%0.01°C / 0.008% (pressure 0.16Pa)I2C or SPI1.71–3.6V chip (modules 3.3V or 3–5V)~10 ms forced mode$2–20Datasheet
BME680 / BME688T + RH + pressure + gas (VOC)±1 °C-40–85 °C±3 %0–100 %0.01°C / 0.008% (pressure 0.18hPa)I2C or SPI1.71–3.6V~150 ms with gas$10–25Datasheet (BME680)
SCD40 / SCD41CO2 + T + RH±0.8°C-10–60°C±6%0–95%0.01°C / 0.01% (CO2 1 ppm)I2C2.4–5.5V5 s periodic, or single-shot$18–35Datasheet
DS18B20 (bare or waterproof probe)T±0.5°C (-10–85°C)-55–125°Cnonenone9–12-bitDallas 1-Wire3–5.5V~94–750 ms (750 ms at 12-bit)$1–3 bare, $2–8 probeDatasheet
BMP280T + pressure±1°C (0–65°C)-40–85°Cnonenone0.01°C (pressure 0.18 hPa)I2C or SPI1.71–3.6V chip (modules 3.3V or 3–5V)~5–40 ms$1–5Datasheet
TMP117T±0.1°C (-20–50 °C)-55–150°Cnonenone0.0078°C (16-bit)I2C1.7–5.5V~15.5 ms$8–16Datasheet
MCP9808T±0.25°C-40–125°Cnonenone0.5–0.0625°C (configurable)I2C2.7–5.5V~30–250 ms$4–8Product page
TMP102T±0.5°C (0–65°C)-40–125°Cnonenone0.0625°CI2C1.4–3.6V~26 ms$3–8Datasheet
LM35T±0.5°C at 25°C (±1 °C full range);-55–150°CnonenoneADC-limited (10 mV/°C)Analog4–30VContinuous$1–3Datasheet
TMP36T±1°C at 25°C (±2°C full range);-40–125°CnonenoneADC-limited (10 mV/°C, 500 mV offset)Analog2.7–5.5VContinuous$1–3Datasheet
MAX6675 + K-typeT~±2–3°C (probe-limited)0–1024 °Cnonenone0.25°CSPI3.0–5.5V~0.2 s$2–6 board + $3–12 probeDatasheet
MAX31855 / MAX31856 + K-typeT±2°C (probe-limited)-200–1350°Cnonenone0.25°C (31855) / 0.0078°C (31856)SPI3.3V~70–100 ms$4–20 board + $3–12 probeMAX31855, MAX31856
PT100 / PT1000 + MAX31865TClass A: ±(0.15 + 0.002·t)°C-200–850°Cnonenone15-bit (~0.03°C)SPI3.3V (some boards 3–5V)~52–63 ms$8–25 board + $5–30 probeDatasheet
MLX90614 (non-contact IR)T (object and ambient)±0.5°C near room tempObject -70–380°C, ambient -40–125°Cnonenone0.02°CI2C / SMBus3.3V or 5V~0.5–1 s$8–25Datasheet

Temperature and Humidity Sensors Library support

Another important point to take into account when choosing your temperature sensor is library support. You want a sensor with good library support. It will make it easier to write code for your project and debug.

For each sensor. the following table shows the library names for Arduino/PlatformIO, MicroPython, and CircuitPython.

SensorArduino / PlatformIOMicroPythonCircuitPython
DHT11 / DHT22Adafruit DHT, DHTesp, DHTNEW, SimpleDHT
(ESP32 Arduino Guide)
dht (built-in)
(ESP32 MicroPython Guide)
adafruit_dht
DS18B20OneWire + DallasTemperature
(ESP32 Arduino Guide)
onewire+ ds18x20 (built-in)
(ESP32 MicroPython Guide)

adafruit_ds18x20
BME280Adafruit_BME280, SparkFun, Bosch driver
(ESP32 Arduino Guide)
BME280 (robert-hh, or adafruit_bme280)
(ESP32 MicroPython Guide)
adafruit_bme280
SHT30 / SHT31 / SHT35Adafruit_SHT31, Sensirion official, RobTillaart SHT31micropython-sht31 (kfricke), micropython-sht30 (rsc1975)adafruit_sht31d
LM35 / TMP36 / NTC (analog)analogRead (no library); Steinhart–Hart for NTCmachine.ADC (built-in)analogio, adafruit_thermistor (NTC)
BMP280Adafruit_BMP280, SparkFunmicropython-bmp280 (dafvid)adafruit_bmp280
AHT20 (and AHT10/AHT21)Adafruit_AHTX0, dvarrel AHT20, SparkFunmicropython_ahtx0 (targetblank)adafruit_ahtx0
BME680 / BME688Adafruit_BME680, Bosch BME68x, Bosch BSEC2 (IAQ)
(ESP32 Arduino)
BME680-Micropython (robert-hh)
(ESP32 MicroPython)

adafruit_bme680
SHT40 / SHT41 / SHT45Adafruit_SHT4x, Sensirion official
(ESP32 Arduino)
micropython-sht4x (jposada202020)adafruit_sht4x
MLX90614Adafruit_MLX90614, SparkFunmicropython-mlx90614 (mcauser)adafruit_mlx90614
HTU21DAdafruit_HTU21DF, SparkFun HTU21Dmicropython-htu21df (jposada202020, archived)adafruit_htu21d
MAX6675 / MAX31855 (K-type)Adafruit MAX31855, Adafruit/RobTillaart MAX6675
(ESP32 Arduino)
max31855.py,
max6675.py
adafruit_max31855
(MAX31855 only)
Si7021Adafruit_Si7021, SparkFunmicropython-si7021 (chrisbalmer)adafruit_si7021
SCD40 / SCD41Sensirion official, Adafruit_SCD4x, SparkFunMicroPython_SCD4X (peter-l5)adafruit_scd4x
PT100 / PT1000 + MAX31865 (also MAX31856)Adafruit_MAX31865, Adafruit_MAX31856max31865.py (Adafruit port), max31856 (alinbaltaru)adafruit_max31865,
adafruit_max31856
MCP9808Adafruit_MCP9808micropython-mcp9808 (kfricke)adafruit_mcp9808
TMP117Adafruit_TMP117, SparkFun TMP117micropython-tmp117 (jposada202020)adafruit_tmp117
HDC1080ClosedCube HDC1080, RobTillaart HDC1080micropython-hdc1080 (mcauser)—
TMP102SparkFun TMP102micropython-tmp102 (khoulihan)—
AM2320Adafruit_AM2320, RobTillaart AM232Xmicropython-am2320 (mcauser)adafruit_am2320

Best Sensor by Category

So, taking into account all of this information, how do you choose your sensor? It depends.

Do you need a sensor to use for teaching and don’t care about its precision or accuracy (you just want something cheap), or do you need something accurate to build a sensor node with triggers and thresholds? Do you care about power consumption, or is that not an issue for your project?

In the following table, we tried to pick the best sensor choice by category: overall value, budget, accuracy, power consumption, etc.

I want…Best pickWhy
Best overall (temp + humidity)SHT41Good accuracy, low-power consumption, built-in heater.
Best overall with pressure (weather station)BME280Temperature, humidity and pressure in one cheap chip. Good community support.
Best budget (temp + humidity)AHT20 (~$1–3)Cheap and better than DHT11 and DHT22.
Best budget (temp only)DS18B20 (~$1–2)Digital temperature sensor at a low price.
Best value (accuracy per $)SHT31Great accuracy at a low price.
Most accurate temperatureTMP117 (±0.1°C)Best accuracy near room temperature.
Most accurate humiditySHT45 (±1.0%)Sensirion sensors are among the best in terms of RH accuracy even in humid environments with condensation.
Waterproof / submersible (temperature)DS18B20 stainless-steel probeCheap, sealed, and you can use many sensors on the same wire.
Weather-resistant temp + humidity (outdoor)SHT31 mesh-protected probeSplash and weather resistant.
Most library support / compatibilityBME280Supported by almost everything: Arduino, MicroPython, CircuitPython, ESPHome and Tasmota.
Lowest power / batterySHT4xLow power consumption. Great for ESP32 deep sleep projects.
Humid or condensing environmentsSHT4xThe built-in heater clears condensation.
High temperaturesK-type + MAX31856Thermocouples reach 1350°C.
Cheapest high-temperature optionMAX6675 + K-typeVery low cost, but positive temperatures only.
Many sensors on one pinDS18B20Each DS18B20 has a unique ID on the shared bus.
Non-contactMLX90614Measures surfaces without touching them.
CO2 + temp/RH (air quality)SCD41Measures real CO2 concentration (not an estimate).
VOC / indoor air qualityBME680 / BME688VOC gas sensing and temperature, humidity and pressure.
Home Assistant / ESPHome out of the boxSHT4x / SHT31 + DS18B20All have first-class ESPHome components

Wrapping Up

There are a wide variety of temperature and humidity sensors for microcontrollers like the ESP32, Arduino, Raspberry Pi Pico, etc. We hope those comparison tables are helpful to help you sort the best sensor for your specify project or application. The best sensor will really depend on the application.

As we’ve mentioned previously, we use mostly the BME280 sensors in our tutorials because it measures temperature, humidity, and pressure, uses I2C communication protocol and it’s easy to use. So, it’s great for teaching IoT concepts.

But recently, we started experimenting with Sensirion’s SHT4x sensors, more specifically with the SHT41. It’s also easy to use and it’s the best option in terms of accuracy/price ratio for temperature/humidity sensor nodes. Seems a better option when compared with the BME280 if you don’t need pressure readings.

We have several guides for more than 20 sensor modules with the ESP32, ESP8266, and Raspberry Pi Pico, you can check the complete lists below:

What project are you currently building? Which sensor are you planning to use? What’s your feedback on some of those sensors? Share your thoughts by writing a comment below.



Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!

What to Read Next…


Enjoyed this project? Stay updated by subscribing our newsletter!

1 thought on “Comparison Guide: Temperature and Humidity Sensors for ESP32, RPi Pico and Similar Boards”

Leave a Comment

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.