Pressure & Altitude
Interfacing BME280 Pressure & Altitude with Raspberry Pi
What is the BME280?
BME280 practical reference
The BME280 is Bosch's combined humidity, pressure, and temperature sensor, built on the same die family as the BMP280 with a humidity element added on top. It talks over I2C (up to 3.4MHz) or SPI (up to 10MHz), and a single read gives you all three environmental values with factory-calibrated compensation coefficients baked into onboard registers — the sensor itself does the raw-to-real-world math via the calibration data, and your library just applies it.
It is the standard choice for weather stations, altitude estimation (via barometric pressure), greenhouse monitoring, and indoor air-comfort projects. The catch that trips people up is address selection and voltage: most breakout boards default to I2C address 0x76 or 0x77 depending on how the SDO pin is tied, so two identically-wired boards on one bus will collide unless you change one address. Also, the bare BME280 chip is 3.3V logic only — always confirm your breakout has an onboard regulator before wiring it to a 5V board.
Key specifications
- Interface: I2C (up to 3.4MHz) or SPI (up to 10MHz), selectable
- I2C address: 0x76 (SDO to GND) or 0x77 (SDO to VCC)
- Operating voltage: 1.71–3.6V (breakout boards commonly add a 5V-tolerant regulator)
- Humidity range: 0–100% RH, ±3% accuracy
- Pressure range: 300–1100 hPa, ±1 hPa absolute accuracy
- Temperature range: −40°C to 85°C, ±1°C accuracy
- Current consumption: 3.6µA @ 1Hz (humidity+temp), 0.6µA in sleep mode
- Response time: ~1s (humidity 63% step response)
Pinout and connection notes
For I2C mode (the common case), tie CSB to VCC and use SDO only to pick the address. For SPI mode, all 6 pins are active and CSB becomes the active-low chip select.
- VCC: Power — 3.3V (check breakout for 5V-tolerant regulator)
- GND: Ground
- SCL: I2C clock (or SPI SCK)
- SDA: I2C data (or SPI MOSI)
- CSB: SPI chip select — tie HIGH (to VCC) to force I2C mode
- SDO: I2C address select (GND = 0x76, VCC = 0x77) or SPI MISO
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up BME280 with Raspberry Pi
Library
Adafruit-Blinka + adafruit-circuitpython-bme280 by Adafruit
pip3 install adafruit-circuitpython-bme280
Wiring
| Component pin | Raspberry Pi pin | Note |
|---|---|---|
| VCC | 3.3V (physical pin 1) | |
| GND | GND (physical pin 6) | |
| SCL | GPIO3 / SCL (physical pin 5) | |
| SDA | GPIO2 / SDA (physical pin 3) | |
| CSB | 3.3V (forces I2C mode) |
Swipe sideways to see every column →
Enable I2C first via raspi-config → Interface Options → I2C. Confirm the address with i2cdetect -y 1 (0x76 or 0x77).
Related Components
A3144
Digital Hall-effect switch for contactless magnetic detection
BMP180
Barometric pressure and temperature sensor with excellent library support — a weather station staple.
BMP280
Precise barometric pressure and temperature sensing over I2C or SPI — ideal for weather stations.
MS5611
High-precision altimeter sensor used in drones and GPS units.
Related Guides & Projects
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2
Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.
Raspberry Pi Pico W Web Server in MicroPython: Control an LED and Read a Sensor
Connect the Pico W to WiFi, serve a responsive control page, switch an LED and display the onboard temperature or an external sensor, with timeouts and reconnect handling.
Raspberry Pi Pico Oscilloscope with MicroPython
Convert a Raspberry Pi Pico into a basic 500 kSPS oscilloscope using its 12-bit ADC and MicroPython. Displays waveforms on an SSD1306 OLED or streams samples over USB serial to a Python plotter on your PC.
BME280 vs BMP280: Differences, Accuracy and Which One to Buy
One sensor measures humidity, the other does not, and many modules sold as BME280 are secretly the other one. Datasheet-based differences, how to read the chip ID, wiring, Arduino and ESP32 code, and a clear buying verdict.