BME280 Temperature, Humidity, Pressure Sensor
Overview
High precision temperature, humidity, and atmospheric pressure measurement sensor using BOSCH’s BME280 chip. Uses I2C or SPI interface.

Specifications
- Humidity Range: 0 ~ 100%
- Relative Humidity Output: 16bit
- Output Type: I²C, SPI
- Accuracy: ±3%
- Response Time: 1s
- Supply Voltage: 1.71V ~ 3.6V
- Operating Temperature: -40°C ~ 85°C
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
- FT232H, FT2232H, FT4232H
- MCP2221
Commands
[SET_SAMPLING]
Configures sensor settings such as Mode, Sampling Rate, Filter, etc.
Item | Type | Description |
---|---|---|
Mode | WRITE | Select the mode. (Sleep: standby mode, Forced: single measurement mode, Normal: continuous measurement mode) |
Temperature Sampling rate | WRITE | Select temperature measurement cycle (Sampling rate). (off, x1, x2, x4, x8, x16) |
Pressure Sampling rate | WRITE | Select pressure measurement cycle (Sampling rate). (off, x1, x2, x4, x8, x16) |
Humidity Sampling rate | WRITE | Select humidity measurement cycle (Sampling rate). (off, x1, x2, x4, x8, x16) |
Filter | WRITE | Select the mode of the IIR filter inside the chip. This filter is for removing short-term fluctuations in atmospheric pressure. (off,x2,x4,x8,x16) |
Standby Time | WRITE | Select the waiting time between measurements in continuous measurement mode.(0.5ms,10ms,20ms,62.5ms,125ms,250ms,500ms,1000ms) |
[READ_DATA]
Reads temperature, humidity, and atmospheric pressure.
Item | Type | Description |
---|---|---|
Temperature(℃) | READ | Measured temperature. |
Pressure(Pa) | READ | Measured atmospheric pressure. |
Relative Humidity(%) | READ | Measured relative humidity. |
[READ_ALTITUDE]
Calculates the altitude of the current location using sea level pressure.
Item | Type | Description |
---|---|---|
Sea Level Pressure(hPa) | WRITE | Enter the sea level pressure of the current location. |
Altitude(m) | READ | Calculated altitude. |
[SEA_LEVEL_FOR_ALTITUDE]
Calculates the sea level pressure of the current location using altitude.
Item | Type | Description |
---|---|---|
Altitude(m) | WRITE | Enter the altitude of the current location. |
Sea Level Pressure(hPa) | READ | Calculated sea level pressure. |
[TAKE_FORCED_MEAS]
Manually performs a single measurement. (Only available in Forced mode)
Item | Type | Description |
---|---|---|
Temperature(℃) | READ | Measured temperature. |
Pressure(Pa) | READ | Measured atmospheric pressure. |
Relative Humidity(%) | READ | Measured relative humidity. |
Example
Objective
Display temperature, atmospheric pressure, and relative humidity measured by BME280 on dashboard widgets.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
BME280 | 1 |
Wiring (I2C)
Connect each component to the corresponding connection as listed in each row below.
BME280 | GPIO |
---|---|
VIN | 3.3V |
GND | GND |
SDI | 2 (I2C1 SDA) |
SCK | 3 (I2C1 SCL) |
SDO * | GND |

Wiring (SPI)
Connect each component to the corresponding connection as listed in each row below.
BME280 | GPIO |
---|---|
VIN | 3.3V |
GND | GND |
CS | 8 (SPI0 CE0) |
SDO | 9 (SPI0 MISO) |
SDI | 10 (SPI0 MOSI) |
SCK | 11 (SPI0 SCLK) |

Project Link
BME280 SPI