Sensors¶
Side-by-side comparison¶
| Sensor | Measures | Range | Accuracy | Bus | I²C address | Voltage |
|---|---|---|---|---|---|---|
| DHT11 | Temp + RH | 0–50 °C, 20–90 %RH | ±2 °C, ±5 % | custom 1-wire | — | 3.3–5 V |
| DHT22 / AM2302 | Temp + RH | -40 to 80 °C, 0–100 %RH | ±0.5 °C, ±2 % | custom 1-wire | — | 3.3–5 V |
| HC-SR04 | Distance | 2–400 cm | ±3 mm | TRIG/ECHO digital | — | 5 V |
| MPU6050 | 3-axis accel + gyro | ±2/4/8/16 g, ±250–2000 °/s | 16-bit | I²C | 0x68 / 0x69 | 3.3 V (5 V on module) |
| BME280 | Temp + RH + pressure | -40 to 85 °C, 0–100 %RH, 300–1100 hPa | ±1 °C, ±3 %, ±1 hPa | I²C / SPI | 0x77 / 0x76 | 3.3 V (5 V on Adafruit module) |
| BMP280 | Temp + pressure | -40 to 85 °C, 300–1100 hPa | ±1 °C, ±1 hPa | I²C / SPI | 0x77 / 0x76 | 3.3 V (5 V on Adafruit module) |
| BH1750 | Ambient light (lux) | 1–65,535 lx | 1 lx | I²C | 0x23 / 0x5C | 3.3–5 V |
| DS18B20 | Temp (single channel) | -55 to +125 °C | ±0.5 °C (-10–85 °C) | Dallas 1-Wire | unique 64-bit ID | 3–5.5 V |
Common questions¶
DHT11 vs DHT22 — which to pick?¶
DHT22 for any real measurement work — 4× better temp accuracy, 2.5× better humidity, full sub-zero range. DHT11 only if you're learning the protocol or doing rough hobby projects where ±2 °C is fine. The library and wiring are identical.
BMP280 vs BME280 — what's the difference?¶
BME280 adds a humidity sensor; everything else is identical (same Bosch family, same I²C/SPI bus, same Adafruit_BME280 code with humidity reads). Pick BMP280 only if you don't need humidity — saves ~30%.
Which sensor for weather station?¶
BME280 — single chip covers temperature, humidity, and barometric pressure. I²C means 2 wires. Use with a separate BH1750 for sunlight intensity if needed.
Why does my HC-SR04 give weird readings?¶
Three common causes: (1) reading too fast — the sensor needs ~50 ms between trigger pulses; (2) 5 V ECHO into a 3.3 V MCU (use voltage divider); (3) angled surfaces or soft objects absorbing the ultrasonic pulse — readings under 2 cm are unreliable.
Best temperature sensor for liquids / outdoor probes?¶
DS18B20 waterproof probe. Stainless-steel tube, weatherproof, 1-Wire bus supports multiple sensors on a single GPIO with unique 64-bit IDs.
MPU6050 IMU — what does "DMP" do?¶
The on-chip Digital Motion Processor fuses accelerometer + gyro readings into stable orientation (quaternions) without using the MCU. Skip it for raw a/g; turn it on for gimbal/orientation use cases.
Last updated: 2026-05-13 · Source on GitHub