Reference
BME280
Temperature, humidity, pressure.
- Connects over
- I²C
- Address
- 0x76 (or 0x77)
- Made by
- Bosch Sensortec
- Datasheet
- bosch-sensortec.com
Use it
hardware {
device bme280: BME280
}
every 1s {
let value: float = bme280.temperature()
log("bme280", "temperature={value}")
}
On its own, the declaration puts the BME280 on the first I²C bus (SDA 21, SCL 22 on the ESP32) at 0x76. To choose the pins or the address, declare the bus and attach the device: device bme280: BME280 on i2c0 at 0x77 with i2c i2c0(sda: 21, scl: 22).
Methods
-
bme280.temperature() -> float
Temperature in °C
-
bme280.humidity() -> float
Relative humidity %
-
bme280.pressure() -> float
Pressure in hPa
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
GND | Ground |
SDA | Pull-up to VCC (often on breakout board) |
SCL | Pull-up to VCC |
CSB | Tie to VCC for I²C (low = SPI mode) |
SDO | Address select: GND=0x76, VCC=0x77 |
Specifications
- Voltage
- 1.71V – 3.6V (most breakouts have a regulator for 5V)
- Current
- 3.6 μA at 1 Hz
- Temp
- −40°C to +85°C ±1.0°C
- Humidity
- 0–100% RH ±3%
- Pressure
- 300 – 1100 hPa ±1.0 hPa (≈ ±1 m altitude)
- Interface speed
- I²C up to 3.4 MHz or SPI up to 10 MHz
Tips
- BME280 = BMP280 + humidity. Don't buy a BMP280 thinking it has humidity.
- First reading after power-up is junk — discard it.
- Default oversampling is fine for weather; bump pressure oversampling for altimeter use.
Alternatives worth knowing:
- BME680: Adds VOC gas sensing on top — costs more, draws more current.
- BMP280: No humidity sensor; cheaper and slightly smaller package.