Aziz Bench

Sensor comparison: which one to choose

Pick what you want to measure, tick what your project needs and see which sensors fit, best first, with all of them side by side. 39 sensors for ESP32, Arduino and Raspberry Pi Pico, with every figure from the makers’ datasheets.

Best match
SHT4x
±0.2 °C · ±1.8 %RH · I²C · 1.08 to 3.6 V
Matching sensors
10 of 12
Requirements
1
Accuracy (temperature)
±0.2 °C
Requirements met by each sensor
SHT4x1/1SHT311/1AHT201/1BME2801/1HDC10801/1HTU21D1/1TMP1170/1DS18B200/1DHT221/1BME6801/1DHT111/1Si70211/1

Recommended for your project

The sensors that have everything you ticked, best first.

SensirionBest match

SHT4x

±0.2 °C · ±1.8 %RH · I²C · 1.08 to 3.6 V

Sensirion’s current generation: ±0.2 °C and ±1.8 %RH (SHT45: ±0.1 °C, ±1.0 %RH), 80 nA idle and a built-in heater.

Fits because: humidity ±1.8 %RH

Watch out: Runs from 1.08 to 3.6 V only, so no 5 V. The address (0x44, 0x45 or 0x46) depends on the part code, not on a pin.

Sensirion

SHT31

±0.2 °C · ±2 %RH · I²C · 2.15 to 5.5 V

Sensirion’s well-proven sensor: ±0.2 °C, ±2 %RH, two I²C addresses and a supply from 2.15 to 5.5 V.

Fits because: humidity ±2 %RH

Watch out: The SHT4x is newer, smaller and more accurate on humidity for the same job.

Aosong

AHT20

±0.3 °C · ±2 %RH · I²C · 2 to 5.5 V

A small, low-cost I²C sensor with ±0.3 °C and ±2 %RH: the usual upgrade from a DHT22.

Fits because: humidity ±2 %RH

Watch out: Fixed address 0x38, so one per bus. In ESPHome, use the aht10 component with variant AHT20.

What do you want to measure?
Requirements
Compare two sensors
FeatureDHT22BME280
Measurestemperature · humiditytemperature · humidity · pressure
Temperature accuracy±0.5 °C±1 °C
Humidity accuracy±2 %RH±3 %RH
Temperature range−40 to 80 °C−40 to 85 °C
InterfaceSingle wire (own protocol)I²C, SPI
I²C addressNot I²C0x76, 0x77 (set with a pin)
Supply3.3 to 6 V1.71 to 3.6 V
Current between readings50 µA0.1 µA
ESPHomedhtbme280_i2c / bme280_spi

Sensors that match (10)

  • SHT4xhumidity ±1.8 %RH
  • SHT31humidity ±2 %RH
  • AHT20humidity ±2 %RH
  • BME280humidity ±3 %RH
  • HDC1080humidity ±2 %RH
  • HTU21Dhumidity ±2 %RH
  • DHT22humidity ±2 %RH
  • BME680humidity ±3 %RH
  • DHT11humidity ±5 %RH
  • Si7021humidity ±2 %RH

One requirement short

  • TMP117lacks humidity
  • DS18B20lacks humidity

Good to know

Mount humidity sensors in free air, away from the microcontroller and the regulator: a sensor 2 °C warmer than the room reads several %RH too low.

All sensors in this category side by side

FeatureSHT4xSHT31AHT20BME280HDC1080Si7021HTU21DTMP117DS18B20DHT22BME680DHT11
Measurestemperature · humiditytemperature · humiditytemperature · humiditytemperature · humidity · pressuretemperature · humiditytemperature · humiditytemperature · humiditytemperaturetemperaturetemperature · humiditytemperature · humidity · pressure · gas (VOC)temperature · humidity
Temperature accuracy±0.2 °C±0.2 °C±0.3 °C±1 °C±0.2 °C±0.3 °C±0.3 °C±0.1 °C±0.5 °C±0.5 °C±1 °C±2 °C
Humidity accuracy±1.8 %RH±2 %RH±2 %RH±3 %RH±2 %RH±2 %RH±2 %RHNo humidityNo humidity±2 %RH±3 %RH±5 %RH
Temperature range−40 to 125 °C−40 to 125 °C−40 to 85 °C−40 to 85 °C–−40 to 125 °C−40 to 125 °C−55 to 150 °C−55 to 125 °C−40 to 80 °C−40 to 85 °C0 to 50 °C
InterfaceI²CI²CI²CI²C, SPII²CI²CI²CI²C1-WireSingle wire (own protocol)I²C, SPISingle wire (own protocol)
I²C address0x44, 0x45, 0x46 (set by the part code)0x44, 0x45 (set with a pin)0x380x76, 0x77 (set with a pin)0x400x400x400x48, 0x49, 0x4A, 0x4B (set with a pin)Not I²CNot I²C0x76, 0x77 (set with a pin)Not I²C
Supply1.08 to 3.6 V2.15 to 5.5 V2 to 5.5 V1.71 to 3.6 V2.7 to 5.5 V1.9 to 3.6 V1.5 to 3.6 V1.7 to 5.5 V3 to 5.5 V3.3 to 6 V1.71 to 3.6 V3 to 5.5 V
Current between readings0.08 µA0.2 µA0.25 µA0.1 µA0.1 µA0.06 µA–0.15 µA0.75 µA50 µA0.15 µA100 µA
ESPHomesht4xsht3xdaht10bme280_i2c / bme280_spihdc1080htu21dhtu21dtmp117dallas_tempdhtbme680dht
StatusAvailableAvailableAvailableAvailableAvailableDiscontinuedAvailableAvailableAvailableAvailableAvailableAvailable

Typical figures from the makers’ datasheets and product pages. “–”: not in the sources we checked. Supply: the chip or module itself; breakout boards often add a regulator and level shifting.

Head-to-head comparisons

How to choose a sensor

Start from what you need to know, not from the sensor in your kit. A room thermometer is fine at ±0.5 °C; mould prevention or a greenhouse is worth a ±2 %RH humidity sensor; a weather station that compares pressure with forecasts needs good absolute accuracy, while an altimeter needs good relative accuracy.

Then check how it connects. I²C sensors share two wires with other devices as long as their addresses differ; the DHT11 and DHT22 use their own single-wire protocol, the DS18B20 uses 1-Wire, and most CO₂ and particle sensors use a UART. On ESP32 and Raspberry Pi Pico boards, prefer sensors that run from 3.3 V or whose data lines work at 3.3 V.

Temperature and humidity: placement matters more than the chip

Relative humidity depends on temperature: a sensor 2 °C warmer than the room reads several %RH too low, whatever its datasheet says. Put it away from the microcontroller, the regulator and the Wi-Fi antenna, ideally on a short cable or in a vented enclosure, and keep it out of direct sun.

The DHT11 and DHT22 are cheap and easy, but slow and less accurate. The AHT20, SHT31, SHT4x, HTU21D, Si7021 and HDC1080 are I²C sensors with ±0.2 to ±0.3 °C typical; of these, the SHT4x is the most accurate on humidity. The BME280 adds pressure at the cost of some accuracy, and the DS18B20 and TMP117 measure temperature only.

Real CO₂ or eCO₂

NDIR and photoacoustic sensors (MH-Z19C, SCD30, SCD40, SCD41) measure CO₂ itself, which tells you when a room needs air. Metal-oxide sensors (SGP30, SGP40, SGP41, ENS160, CCS811, BME680) react to volatile organic compounds: some estimate an “eCO₂” from them, but that isn’t a CO₂ measurement. They are good at spotting cooking, cleaning products or paint, and they are smaller and cheaper.

Ultrasonic, infrared or laser for distance

Ultrasonic modules such as the HC-SR04 have a wide beam and work on glass and dark surfaces, but soft materials absorb the echo. Laser time-of-flight sensors (VL53L0X, VL53L1X, VL53L4CD) and the TF-Luna LiDAR have a narrow beam and read small targets, but sunlight and dark surfaces cut their range. For water tanks, the waterproof JSN-SR04T is the usual choice.

Each I²C sensor links to its page in the I²C address list, with wiring, pull-ups and conflicts. For battery projects, add the sensor’s current to the rest of the board in the battery life calculator.

Sources: the makers’ datasheets and product pages (Sensirion, Bosch Sensortec, Texas Instruments, Analog Devices, Silicon Labs, TE Connectivity, Aosong, Infineon, STMicroelectronics, Benewake, Sharp, ROHM, ams OSRAM, Vishay, Winsen, ScioSense, Plantower, Nova Fitness) and the ESPHome documentation, checked in November 2026.

Frequently asked questions

Which temperature and humidity sensor is best for an ESP32?

For accuracy, a Sensirion SHT4x or SHT31 on I²C: ±0.2 °C and ±1.8 or ±2 %RH typical. The AHT20 costs less and comes close (±0.3 °C, ±2 %RH). Choose the BME280 if you also want pressure, and keep the DHT22 for simple projects. Whatever you pick, mount it away from the board’s warm parts.

DHT22 or BME280: which should I use?

The DHT22 is specified at ±0.5 °C and ±2 %RH typical, the BME280 at ±1 °C (±0.5 °C at 25 °C) and ±3 %RH. The BME280 adds pressure, works on I²C or SPI and draws 0.1 µA in sleep against about 50 µA, so it suits battery projects; the DHT22 is slow and uses its own single-wire protocol. For accurate humidity, an SHT4x beats both.

Why does my sensor read low humidity indoors?

Usually because it is warmer than the room. Relative humidity falls as temperature rises, so a sensor heated by the microcontroller, the regulator or the sun reads too dry. Move it away from the board, on a short cable or in a vented enclosure, and compare it with another sensor after a few minutes.

Do the SGP30, ENS160 or CCS811 measure CO₂?

No. They are metal-oxide gas sensors that react to volatile organic compounds and estimate an “eCO₂” from them. To know the real CO₂ level, for example to decide when to air a room, use an NDIR or photoacoustic sensor such as the SCD40, SCD41, SCD30 or MH-Z19C.

HC-SR04 or VL53L0X?

The HC-SR04 reaches 4 m with a wide beam and sees glass, but it needs 5 V and a divider on its echo pin for 3.3 V boards. The VL53L0X is a small laser sensor on I²C at 3.3 V with a narrow beam: about 1.2 m on white indoors, up to 2 m in the dark, and less in sunlight. For water tanks, use the waterproof JSN-SR04T.

Can I connect two sensors with the same I²C address?

Only if the sensor lets you change it: many have an address pin (BME280, SHT31, TMP117), the VL53 sensors can be renumbered in software, and on the SHT4x the address depends on the part code. Otherwise use a multiplexer such as the TCA9548A, or a second I²C bus on the ESP32.

Which of these sensors work with ESPHome?

Most have an official ESPHome component, named in the table. The VL53L1X, the VL53L4CD and the Sharp GP2Y0A21 don’t; the Sharp sensor can still be read with the adc component. This site’s ESPHome generator writes the configuration for the DHT11, DHT22, BME280, SHT3x and DS18B20.