Best temperature humidity sensor for Arduino and ESP32
Best temperature humidity sensor for Arduino and ESP32: DHT22 vs BME280 vs SHT31 vs AHT20 compared on accuracy, interface, voltage and fake-chip risk.
For most projects the best temperature humidity sensor for Arduino and ESP32 is an I2C chip: an SHT31 if humidity accuracy matters, a BME280 if you also want air pressure, and an AHT20 if you want the cheapest decent option. The DHT22 still works, but it is slower and less accurate than all three on paper, and the DHT11 is only worth buying for a first experiment. The DS18B20 is a different animal, since it measures temperature only, but nothing in this list beats it for a probe on a cable.
This guide compares the sensors makers actually buy as cheap modules, with figures taken from the manufacturers' datasheets. It then covers which one to pick for a weather station, a room monitor and a battery node, how placement ruins readings, and how to buy the right module without ending up with the wrong chip.
The sensors at a glance
Eight families cover almost everything on a marketplace listing. The accuracy figures are the ones each datasheet states for its main operating condition, usually 25 °C. "Typ." means the datasheet itself says typical, which is not a guarantee for every unit. Humidity accuracy only holds inside the stated humidity range, and every maker's figure assumes a clean, properly acclimated sensor.
| Sensor | Interface | Supply (chip) | Temperature accuracy | Humidity accuracy | Address | Sampling limit | Pressure |
|---|---|---|---|---|---|---|---|
| DHT11 (Aosong) | Single-wire, proprietary | 3 to 5.5 V | about ±2 °C | about ±5 %RH, 20 to 90 %RH | none | no more than once per second | no |
| DHT22 / AM2302 (Aosong) | Single-wire, proprietary | 3.3 to 6 V | below ±0.5 °C | ±2 %RH (max ±5) | none | collecting period over 2 s | no |
| AHT10 (ASAIR) | I2C | 1.8 to 3.6 V | ±0.3 °C typ. | ±2 %RH typ. | 0x38 | see datasheet | no |
| AHT20 (ASAIR) | I2C | 2.2 to 5.5 V | ±0.3 °C typ. | ±2 %RH typ. | 0x38 | over 1 s per cycle recommended | no |
| SHT30 / SHT31 (Sensirion) | I2C | 2.15 to 5.5 V | SHT31 ±0.2 °C typ. | SHT31 ±2 %RH typ. | 0x44 or 0x45 | up to 10 measurements per second, self-heating at the top rate | no |
| SHT40 (Sensirion) | I2C | 1.08 to 3.6 V | ±0.2 °C typ. | ±1.8 %RH typ. | 0x44 (other variants 0x45, 0x46) | see datasheet | no |
| BME280 (Bosch) | I2C or SPI | 1.71 to 3.6 V | ±0.5 °C at 25 °C | ±3 %RH, 20 to 80 %RH at 25 °C | 0x76 or 0x77 | modes up to many Hz; 1 Hz is normal | yes, ±1 hPa absolute |
| DS18B20 (Analog Devices) | 1-Wire | 3.0 to 5.5 V | ±0.5 °C from -10 to +85 °C | none | unique 64-bit ID per chip | 750 ms per conversion at 12 bits | no |
A few things in that table deserve a closer look.
DHT11 vs DHT22: the single-wire pair
Both are Aosong parts in a plastic grid housing. They use a proprietary single-wire protocol, not 1-Wire and not I2C: the microcontroller pulls the line low to ask, and the sensor answers with 40 bits. Common Arduino and ESP32 libraries handle the timing.
The DHT11 datasheet lists a 3 to 5.5 V supply, a sampling period of no less than one second, and coarse accuracy of roughly ±5 %RH and ±2 °C. Its resolution is whole numbers. It is fine for "is the room humid or dry", and not much more.
The DHT22 datasheet (the same part as the AM2302) gives ±2 %RH with a maximum of ±5 %RH, temperature accuracy under ±0.5 °C, 0.1 resolution on both, a 3.3 to 6 V supply and a collecting period of over two seconds. The 3.3 V lower limit matters on an ESP32: you are running it right at the minimum, so a sagging supply can give read errors. A bare sensor needs a pull-up on the data line, so check the datasheet's wiring diagram.
The DHT22 is no longer the obvious choice. It is slower than the I2C chips and needs timing-sensitive code on a dedicated pin. It does suit a long cable, since Aosong quotes a transmission distance of 20 m.
AHT10, AHT20 and AHT21: cheap I2C
ASAIR (Aosong's brand for these chips) makes a small I2C family that is among the cheapest humidity sensors sold as modules. The AHT10 datasheet gives a 1.8 to 3.6 V supply and typical accuracy of ±2 %RH and ±0.3 °C, with address 0x38. The AHT20 datasheet widens the supply to 2.2 to 5.5 V, keeps the same typical figures and the same 0x38 address, and recommends a data collection cycle of more than one second to keep self-heating low. The AHT21 is a later part in the same line; check its own datasheet for the supply range and figures before trusting a listing.
The catch is the fixed address. Every AHT chip answers at 0x38, so two on one bus will collide. Put the second one behind an I2C multiplexer, or choose a sensor with an address pin.
SHT3x and SHT4x: the accuracy pick
Sensirion's SHT3x datasheet specifies a 2.15 to 5.5 V supply, I2C at 0x44 by default or 0x45 with the address pin high, and for the SHT31 typical accuracy of ±2 %RH and ±0.2 °C. The SHT30 is the slightly looser sibling and the SHT35 the tighter one, so read the table for the exact grade. The chip supports a periodic mode of up to 10 measurements per second, and the datasheet warns that self-heating can occur at the highest rate.
The newer SHT4x family runs from 1.08 to 3.6 V, so it is a 3.3 V part. The SHT40 is typically ±1.8 %RH and ±0.2 °C. Variants use different addresses (0x44, 0x45 or 0x46), so the listing must say which one it carries.
Accuracy figures on a random marketplace module are claims, not measurements.
BME280 and BMP280: pressure included
The BME280 datasheet describes a combined humidity, pressure and temperature sensor with a 1.71 to 3.6 V supply and a separate interface supply of 1.2 to 3.6 V. It speaks I2C or SPI. The I2C address is 0x76 when the SDO pin is tied to ground and 0x77 when tied to the interface voltage. Datasheet figures are ±0.5 °C at 25 °C, ±3 %RH between 20 and 80 %RH at 25 °C, and ±1 hPa absolute pressure accuracy over 300 to 1100 hPa. The humidity figure is a bit looser than SHT3x, and the pressure reading is the reason to buy it.
The BMP280 is the same shape and the same family without the humidity channel. Its datasheet describes a pressure and temperature sensor with the same two addresses. A BMP280 is a perfectly good barometer, and a poor choice when you were promised humidity.
One BME280 caveat that catches people: the datasheet notes that the internal temperature value depends on the board, self-heating and ambient, and is typically above ambient. Do not put the sensor next to a voltage regulator or a Wi-Fi chip and expect the temperature to be right.
HTU21D and SHT21: older, still sold
These older I2C humidity sensors still turn up on cheap modules. They offer nothing an AHT20 or SHT31 does not, and I could not retrieve a manufacturer datasheet to cite figures, so take the SHT31 when prices are close.
DS18B20: temperature only, but properly
The DS18B20 is a 1-Wire thermometer from Analog Devices (formerly Maxim). Several share one data line, because each chip has a unique 64-bit ID. It runs from 3.0 to 5.5 V, specifies ±0.5 °C from -10 °C to +85 °C, measures -55 °C to +125 °C, and takes up to 750 ms for a 12-bit conversion. It is the standard waterproof probe on a cable. I checked these figures through mirrored datasheet text, not the Analog Devices PDF, so confirm them if exact limits matter.
Picking a sensor for your project
A weather station
Use a BME280 for the air, and keep it in a ventilated shield. You get temperature, humidity and pressure from one chip on one address, and pressure trends are the most useful forecasting data a hobby station can collect.
A room monitor
An SHT31 or an AHT20 is plenty. A room changes slowly, so read it every minute and the sampling limits never come up. The AHT20 is cheaper. For several sensors on one controller, the SHT31's two addresses and the DS18B20's unique IDs help, and the AHT20's single address does not.
A battery node
Look at supply current in sleep, not accuracy. The BME280 datasheet lists a supply current in the low microamps at 1 Hz in forced mode, and the datasheet gives a much lower sleep current, which is why it suits battery nodes that wake, take one reading and go back to sleep. Compare the sleep and measurement current rows in the SHT4x and AHT20 datasheets for your duty cycle. The DHT sensors need a start signal and a slow collecting period each time, and the DHT22 datasheet lists a measuring current in the milliamp range, so they rarely suit a battery node. Before any of that, remember that the module around the sensor matters: a cheap board with a regulator and a power LED can draw more than the sensor by itself. The build electronics projects cheaply guide notes that regulators and pull-up resistors on cheap boards often waste current in deep sleep.
Placement and self-heating
A good sensor in a bad spot gives bad numbers, and placement does more damage than the difference between any two chips in the table.
Keep the sensor away from heat sources: regulators, the ESP32 module, the LED, the battery charger. Mount it at the edge of the board or on a short lead, and cut a slot in the PCB between the sensor and the hot parts. ASAIR's own AHT20 datasheet recommends a gap or milled slit to reduce heat transfer. Self-heating also grows with measurement rate, so measure slowly when you can; Sensirion warns about it at the highest SHT3x rate.
Outdoors, shield the sensor from sun and rain but let air through. A closed box reads warm.
If you doubt a reading, compare with a sensor of a different chip family; they are rarely wrong in the same way.
Cheap modules and chip clones
Temperature and humidity sensors are among the parts where the label can lie, and the clone chips and cheap modules guide explains the general picture. The two cases that matter here:
BMP280 sold as BME280. The boards look alike. A BMP280 will read temperature and pressure and give you no humidity, or a library that reports zero. The test is simple. Read register 0xD0 over I2C: the BME280 datasheet says the chip ID is 0x60, and the BMP280 datasheet says 0x58 for mass-production parts. Many libraries do this check for you and refuse to start on the wrong ID. Run an I2C scanner first (you should see 0x76 or 0x77), then read the ID. Early BMP280 samples can report other values, so a result that is neither 0x60 nor 0x58 means check the markings and the datasheet.
Unnamed chips with the right-sounding name. Humidity sensors are the hard ones to verify, because the chip answers I2C either way and only a reference can tell you the readings are right. Check the chip marking in the listing photos, and ask for a close-up through your agent's photo service if you are buying a part where the chip matters. A rough bench test helps: put two or three sensors side by side for an hour. A unit five degrees off is bad.
Buying the right module variant
The chip is only half the product. The board decides whether it works on your controller, and listings often bundle versions under one title, as choosing the right variant explains.
- Bare chip supply range. The BME280 and SHT4x chips top out at 3.6 V, so a 5 V Arduino Uno cannot feed them directly. The AHT20 and SHT3x chips accept up to 5.5 V, per their datasheets.
- Regulator boards. Many modules add a 3.3 V regulator and a pair of pull-up resistors so you can connect them to 5 V. The listing might say "3-5V" or "5V compatible" and the photos usually show a small three-pin regulator near the power pins. A module without one is a 3.3 V board even if the pin header looks the same.
- Level shifters. Some boards add transistors or a level-shifter chip on the I2C lines. With a 5 V Arduino that matters, because the sensor's data pins are not rated for 5 V. With an ESP32 or other 3.3 V board you do not need it.
- Address selection. Check whether the address is set by a jumper or fixed. A BME280 module with one fixed address is fine until you want two. Two modules on one bus also put their pull-up resistors in parallel, which can load the line.
- Pin order. SDA, SCL, VCC and GND appear in different orders on different boards. Read the silkscreen, not the listing picture.
Measure the supply voltage on a new module's sensor pin before connecting anything expensive.
What PartLark can and cannot tell you
PartLark matches each part to marketplace listings on functional fit, so a BMP280 is not a BME280. Matching is automatic and can be wrong, so check the chip and variant before ordering. The haul shows the goods subtotal only. Freight, agent fees, shipping, VAT, the €3 duty per item and, since 1 November 2026, the €2 handling fee per item are extra, and on sensors costing a few euros those fixed per-item charges are a real share. Plan the whole project in one order; what landed cost really includes shows the arithmetic.
FAQ
What is the best temperature and humidity sensor for ESP32?
An SHT31 or a BME280, both I2C and happy at 3.3 V. Pick the SHT31 for the best stated humidity accuracy and the BME280 when you also want pressure. The DHT22 works on an ESP32 but sits at the bottom of its 3.3 V supply range.
DHT22 vs BME280: which is more accurate?
On paper they are close: ±0.5 °C at 25 °C for the BME280 against under ±0.5 °C for the DHT22, and ±3 %RH against ±2 %RH (max ±5). The BME280 wins on I2C and pressure, and placement matters more than either chip.
Can I use an I2C sensor with a 5 V Arduino?
Yes, if the module has a regulator and the I2C lines are safe for 5 V, or if you add a level shifter. A bare BME280 chip must not be powered from 5 V. Look for a "3-5V" module with a regulator, and check the photos for it.
How do I know my BME280 is not a BMP280?
Read the chip ID register 0xD0 over I2C. A BME280 returns 0x60 and a production BMP280 returns 0x58. Or look at the humidity reading: a BMP280 has no humidity channel at all.
Next steps
Browse the catalogue for the sensor you want, compare the matched listings and variants, and add them to your haul. How it works explains matching, and why use PartLark covers what the site does and does not claim. Some Superbuy links on PartLark are affiliate links, and the catalogue is the same whichever way you buy.