Skip to content
SensorsPressure & Altitude

BMP280 Barometric Pressure & Temperature Sensor

Precise barometric pressure and temperature sensing over I2C or SPI — ideal for weather stations.

Pressure range
300 hPa to 1100 hPa
Temperature accuracy
±1°C typical

Wiring & code for

The BMP280 is a low-power digital sensor that reads barometric pressure and temperature over I2C or SPI. Pressure readings can be converted to altitude, making it popular for weather stations and altitude-tracking drones. As the successor to the BMP180, it offers lower power consumption, faster measurement conversion, and the flexibility of either I2C or SPI wiring, while remaining one of the cheapest and most widely supported pressure sensors in the hobbyist ecosystem.

Specifications

Sensor type
Bosch BMP280 barometric pressure and temperature sensor
Operating voltage
1.71V–3.6V DC (breakout boards regulate from 3.3-5V input)
Operating current
~2.7 µA at 1 sample/second in standard operating mode
Pressure range
300 hPa to 1100 hPa
Pressure resolution
0.16 Pa (relative resolution equivalent to roughly ~1cm of altitude change)
Temperature accuracy
±1°C typical
Interface
I2C (up to 3.4MHz) or SPI (up to 10MHz), selectable via wiring/solder jumper on most breakout boards
I2C address
0x76 or 0x77, depending on the SDO pin state

Pinout

PinNameDescription
1VIN / VCCPower, 3.3–5V DC depending on breakout regulator
2GNDGround
3SCL / SCKI2C clock or SPI clock, depending on interface mode
4SDA / SDII2C data or SPI data-in, depending on interface mode
5CSBChip select — ties HIGH for I2C mode on most breakouts, or used as SPI chip select when in SPI mode
6SDOSets the I2C address (0x76 when LOW, 0x77 when HIGH); doubles as SPI data-out in SPI mode

Swipe sideways to see every column →

Most breakout boards default to I2C mode with CSB tied HIGH; the SDO pin's state determines which of the two possible I2C addresses (0x76 or 0x77) the sensor uses, which is handy when running two BMP280-family sensors on the same bus. As with any pressure-based altitude sensor, calibrate against a known local sea-level pressure reading for meaningful absolute altitude results.

Variants

BMP280 breakout
~$1-3
BME280
~$2-5
MS5611
~$3-6

The BMP280 is an excellent low-cost default for most weather and altitude projects. If humidity data would also be useful, the BME280 is usually a similarly-priced drop-in upgrade; if the project needs the very best altitude precision (like a flight controller), the MS5611 offers finer resolution at a modest cost increase.

Board Integration

Library

Adafruit BMP280 Library by Adafruit

Arduino IDE → Tools → Manage Libraries → search "Adafruit BMP280"

Wiring

Component pinESP32 pinNote
VIN / VCC3.3V
GNDGND
SCL / SCKGPIO22
SDA / SDIGPIO21
CSB3.3VTie HIGH to select I2C mode
SDOGND or 3.3VSets I2C address: LOW = 0x76, HIGH = 0x77 -- match this to the address used in code

Swipe sideways to see every column →

C++

ESP32 default I2C pins are 21 (SDA) / 22 (SCL) but any GPIO pair works with Wire.begin(sda, scl). Match bmp.begin()'s address argument to how SDO is wired.

View full ESP32 guide