DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkControlling a stepper motor with an Arduino and A4988 driver
DHT22 vs BME280 — Practical Comparison
I've run both sensors in parallel for six months in my workshop to compare accuracy and reliability. Here are real numbers.
The DHT22 drifts about ±1°C and ±3% RH against my reference (a calibrated Sensirion SHT31). It also has a 2-second minimum sample interval and occasionally returns NaN readings — roughly one in 200 reads in my experience. The BME280 is consistently within ±0.5°C and ±2% RH of the reference, runs at up to 157Hz sampling, has an I2C/SPI interface, and also gives barometric pressure. It costs $2-4 vs $2-3 for a DHT22 module.
Conclusion: there is no reason to use a DHT22 in a new design. The BME280 is cheaper, more accurate, faster, more reliable, and gives more data. The only exception is if you need to run a very long cable run to a remote sensor — the one-wire-like protocol of the DHT22 copes better with high cable capacitance than I2C.