> Source: https://www.tinkered.ai/compare/dht22-vs-bme280 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/compare/dht22-vs-bme280. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# DHT22 vs BME280

The BME280 adds barometric pressure, talks I2C so it shares two pins with other sensors, and can be read every second, where the DHT22 needs a pin of its own and 2 s between reads (Bosch BME280 datasheet rev 1.24, p. 2; Aosong AM2302/DHT22 datasheet, p. 3). Humidity and temperature are specified close: ±2 %RH (±5 %RH max) and ±0.5 °C for the DHT22, ±3 %RH from 20 to 80 %RH and ±0.5 °C at 25 °C for the BME280 (DHT22 datasheet, p. 1; BME280 datasheet, pp. 2, 12). For battery projects the BME280 wins clearly, at 3.6 µA sampling once a second against the DHT22's 1 to 1.5 mA while measuring (BME280 datasheet, p. 2; DHT22 datasheet, p. 5).

## Side by side

|  | DHT22 | BME280 | Source |
| --- | --- | --- | --- |
| Measures | Humidity, temperature | Humidity, temperature, pressure (300 to 1100 hPa) | Aosong AM2302/DHT22 datasheet, p. 1; Bosch BME280 datasheet rev 1.24, p. 2 |
| Humidity | 0 to 100 %RH, ±2 %RH (±5 %RH max), 0.1 %RH resolution | 0 to 100 %RH, ±3 %RH (20 to 80 %RH at 25 °C), 1 s response | Aosong AM2302/DHT22 datasheet, p. 1; Bosch BME280 datasheet rev 1.24, pp. 2, 9 |
| Temperature | -40 to 80 °C, ±0.5 °C | -40 to +85 °C, ±0.5 °C at 25 °C | Aosong AM2302/DHT22 datasheet, p. 1; Bosch BME280 datasheet rev 1.24, p. 12 |
| Interface | Own single-wire timing protocol, one GPIO per sensor | I2C up to 3.4 MHz or SPI up to 10 MHz | Aosong AM2302/DHT22 datasheet, p. 2; Bosch BME280 datasheet rev 1.24, p. 2 |
| Fastest reading | 2 s minimum between reads | No 2 s limit; its current is quoted at 1 Hz with humidity in 1 s response | Aosong AM2302/DHT22 datasheet, p. 3; Bosch BME280 datasheet rev 1.24, p. 2 |
| Supply | 3.3 V to 5.5 V | Chip 1.71 V to 3.6 V; the GY-BME280-5V module takes 3.3 V or 5 V through its regulator, the 3.3 V version 3.3 V only | Aosong AM2302/DHT22 datasheet, pp. 1, 2; Bosch BME280 datasheet rev 1.24, p. 2 |
| Current | 1 to 1.5 mA measuring, 40 to 50 µA standby | 3.6 µA at 1 Hz (all three channels), 0.1 µA sleep | Aosong AM2302/DHT22 datasheet, p. 5; Bosch BME280 datasheet rev 1.24, p. 2 |
| Address | None: one sensor per pin | 0x76 (SDO low) or 0x77 (SDO high), two per bus | Aosong AM2302/DHT22 datasheet, p. 2; Bosch BME280 datasheet rev 1.24, p. 32 |

## Which one to pick

### Pick the DHT22 when

- A first humidity project with three wires and the DHT library, on any 3.3 V or 5 V board (Aosong AM2302/DHT22 datasheet, pp. 1, 2).
- When the I2C pins are already taken, or the sensor sits on a cable away from the board: it only needs one free GPIO.
- Humidity read straight in 0.1 %RH steps with ±2 %RH typical accuracy (p. 1), with no pressure channel to pay for.

### Pick the BME280 when

- Weather stations that want pressure for forecasting or altitude as well as humidity and temperature (Bosch BME280 datasheet, p. 2).
- Battery and solar nodes: 3.6 µA at 1 Hz and 0.1 µA in sleep (p. 2).
- Projects that already use an I2C display or other I2C sensors, or need readings faster than every 2 seconds.

## Swapping one for the other

- Rewire from one data pin to I2C: the BME280's SDA and SCL go to the board's I2C pins, and its DATA pull-up is no longer needed; the GY-BME280 module carries its own I2C pull-ups.
- Swap the library: Adafruit_BME280 with bme.begin(0x76) replaces DHT dht(PIN, DHT22). The read calls become bme.readTemperature(), bme.readHumidity() and bme.readPressure().
- Remove the 2 s delay the DHT22 needed (DHT22 datasheet, p. 3); the BME280 can be read in every loop.
- Mind the supply on bare boards: the DHT22 takes 3.3 V to 5.5 V, the BME280 chip only 1.71 V to 3.6 V (BME280 datasheet, p. 2), so 5 V is only safe on a breakout with a regulator.
- Tie CSB high for I2C: a low pulse on it switches the BME280 to SPI until power is cycled (p. 32).

## Questions

### Is the BME280 more accurate than the DHT22?

Not on paper for humidity: the DHT22 is specified at ±2 %RH typical, ±5 %RH max (Aosong AM2302/DHT22 datasheet, p. 1), the BME280 at ±3 %RH from 20 to 80 %RH at 25 °C (Bosch BME280 datasheet, p. 9). Temperature is ±0.5 °C on both. The BME280's advantages are pressure, I2C and far lower power.

### Can the BME280 replace a DHT22 in my sketch?

Yes, but the wiring and library change: the BME280 is an I2C device at 0x76 or 0x77 (BME280 datasheet, p. 32), while the DHT22 uses its own one-wire timing protocol (DHT22 datasheet, p. 2). Replace the DHT library calls with Adafruit_BME280's readTemperature() and readHumidity().

### Which uses less power?

The BME280: 3.6 µA sampling all channels once a second and 0.1 µA asleep (BME280 datasheet, p. 2), against 1 to 1.5 mA measuring and 40 to 50 µA standby for the DHT22 (DHT22 datasheet, p. 5).

### Why does my BME280 read warmer than my DHT22?

Bosch notes the BME280's temperature includes PCB heat and self-heating and is typically above ambient (BME280 datasheet, p. 12). Use forced mode or slow sampling and keep the board away from regulators and the microcontroller.

### Can I use both on an ESP32?

Yes. Power the DHT22 from 3.3 V so its DATA line stays at 3.3 V (it runs from 3.3 V to 5.5 V, DHT22 datasheet, p. 2), and wire the BME280 to the ESP32's I2C pins; its 1.2 V to 3.6 V interface supply matches 3.3 V logic (BME280 datasheet, p. 2).

## References

- [DHT22](https://www.tinkered.ai/components/dht22.md)
- [BME280](https://www.tinkered.ai/components/bme280.md)
- Aosong AM2302/DHT22 datasheet
- Bosch BME280 datasheet rev 1.24

## Try it

Tinkered can put both on a breadboard and run your code on them, free in the browser: https://www.tinkered.ai/compare/dht22-vs-bme280
