BME280 Pressure,Temperature & Humidity Sensor

Contents

BME280 Sensor Description

Graphic of the BME280 sensor chip from the product Datasheet

The BME280 sensor is manufactured by Bosch Sensortec. It measures barometric pressure, ambient temperature and relative humidity. It is still readily available at time of writing (May 2025) and is widely available on relatively inexpensive breakout boards from a number of different vendors.

Functionally it is a BMP280 sensor with the addition of the relative humidity sensing component. This article won't be rehashing the BMP280 in any detail. Instead we will be concentrating on the BME280's relative humidity sensing component.

Relative humidity is measured with a capacitive type sensor. This is common choice for this type of sensor.

The supply voltage for this sensor is 1.71V to 3.6V. One of the BME280 breakout boards we purchased for the development of the MicroPython driver for the micro:bit has an onboard 3.3V LDO voltage regulator (662K) and a logic level shifting chip. This makes the BME280 on this board suitable for 3.3V and 5V microcontrollers.

The peak current draw during a conversion is typically around 714 µA. At one sample per second in forced mode (and lowest power settings) the average current used is only 2.8 µA. In Standby the current draw is typically <0.5 µA. These are basically the same as for the BMP280.

Sensor Resolution and Precision

Precision and resolution are two different concepts often confused. Precision refers to the consistency or repeatability of measurements. Resolution is the number of bits required to hold the digital value after the ADC (Analog to Digital Converter) has done its work.

Pressure, temperature and humidity precision (reproducibility) are independently configurable by specifying over-sampling parameters.

As with the BMP280 sensor, the BME280 has an IIR filter. This filter reduces pressure uncompensated value bandwidth that removes or greatly reduces the affect of sudden air movement such as a door being rapidly shut, close by movement of a group of people or even a light breeze. In most cases the user will most likely select to use the IIR filter unless a very low power mode is required.

The determining factors for temperature and pressure resolutions are slightly different between BMP280 and BME280 sensors.

With respect to the BME280; if the IIR filter is in use then the resolution of temperature and pressure measurements will both be 20-bit.

If the filter isn't in use then separately, temperature and pressure measurement resolution depend on each of the respective over-sampling settings, osrs-t  for temperature and osrs-p for pressure. Resolutions will vary between 16-bit to 19-bit.

Relative humidity resolution is fixed at 16-bit.

Accuracy (3σ) is given in the Datasheet as:

  • (Absolute) Temperature (@25°C) : ±0.5°C
  • (Absolute) Pressure (300 - 1100 hPa, 0 - 65°C) : ±1.0 hPa
  • (Relative) Pressure (700 - 900 hPa, 25 - 40°C) : ±0.12 hPa
  • (Absolute) Humidity (20 - 80 %RH, 25°C) : ±3 RH%
Sensor Packaging

The BME280 IC is available in a single package type; an 8-pin (pads), LGA (Land Grid Array) package with metal lid. Its measurements are 2.5mm x 2.5mm x 1.0mm. This is roughly a 20% increased footprint compared to the BMP280 but remembering that it also houses the additional humidity sensor element.

BME280 Pinout

The BME280 (not unexpectedly) has the same pinout and serial bus interfaces as the BMP280.

I2C Interface

The BME280 has the same I2C interface as the BMP280.

There is a choice of two addresses: 0x76 and 0x77.

Is it a BME280 or BMP280?

There are many online accounts of people purchasing BME280 breakout boards only to find that they won't work when hooked up to their favourite microcontroller. The BME280 driver's constructor returns an error such as: Failed to find BME280! Chip ID 0x58.

The reason for this message is simple. The user has been supplied with a breakout board containing a BMP280, not the BME280 ordered. The BME280 chip ID is 0x60.

The usual indication that an online seller is offering a BMP280 instead of the BME280 is the price being asked. A genuine BME280 breakout board is usually at least twice the price of the equivalent BMP280 board.

Micrograph of BME280
Micrograph of BMP280

Micrographs of [Left] BME280 and [Right] BMP280

However, while quite similar, there are several ways to tell whether the sensor being offered is a BMP280 or BME280. The most obvious is the package shape and position of the vent hole.

The table below summarizes the obvious differences between the BME280 and BMP280.

Descriptor BME280 BMP280
Footprint Square; 2.5mm x 2.5mm Rectangular; 2.0mm x 2.5mm
Vent hole left-hand side of package right-hand side of package
Markings First character of 2nd line: U First character of 2nd line: K
ID register value 0x60 0x58

BME280 Registers

The BME280 is downward register compatible with the BMP280. However there are several minor inconsistencies. These are listed in Table 17 of the product Datasheet.

There are some additional registers to cater for the humidity sensor of the BME280:

  • 2 x humidity Measurement registers
  • 1 x humidity Measurement Control register
  • 8 x registers with humidity calibration constants

Temperature, Pressure & Humidity Measurements

Bosch refer to the 'raw' conversion values read from the Measurement registers as uncompensated.

This section will briefly examine options available to the user to set how sampling occurs, the precision of the results returned and the conversion of the uncompensated values to real units.

Setting precision

Temperature, pressure and humidity precision (reproducibility) is independently controlled by the user specifying over-sampling parameters which are written to the Measurement Control registers [ctrl_meas] and [ctrl_hum].

Additionally, the BME280 has a bandwidth filter known as the IIR filter. This filter has five separate levels (coefficients) which increasingly reduce the sample bandwidth.

This sensor is very sensitive to minor pressure variations such as caused by a door closing, groups of nearby people moving past or even a slight breeze. The IIR filter is designed to significantly reduce or even eliminate such noise source interference.

Forced Mode

The simplest method of taking a measurement is the one-shot user initiated mode. A measurement is forced by writing 0b01 to the mode[1:0] bits of the Control Measurement [ctrl_meas] register.

Temperature, pressure and humidity uncompensated values are then read from the separate respective Measurement registers after the conversions have completed.

Bosch refers to this one-shot measurement type as Forced mode. In Forced mode the user initiates a read. After the conversion has completed the sensor drops into a very low current sleep state till another read is initiated.

Normal Mode

Normal mode continuously cycles an active measurement followed by an inactive standby period. This standby time determines the frequency of the continuous read cycle and is user configurable.

Normal mode is started by writing 0b11 to the mode[1:0] bits of the Control Measurement [ctrl_meas] register.

Converting uncompensated values

This is probably the hardest step of all as it involves some serious maths.

The first step is for the microcontroller to read in the calibration constants. This will usually be done in the driver's constructor.

These constants are unique for each BME280 chip and are determined and written to EEPROM at the time of manufacture. Care needs to be taken as they are a mixture of signed, unsigned 16-bit and 8-bit integers.

Bosch provide an API and recommend that this is used to do the three uncompensated conversions. The API is coded in C, thus not an easy option when the language of choice is MicroPython.

However, Bosch do provide sample C code with all the mathematical equations shown in their product Datasheet. It involves some serious floating point maths which doesn't suit MicroPython with its native single precision floats.

However, Bosch also provide the equations in integer maths form that uses bit shifting operations to do most of the heavy lifting. MicroPython excels in this case and retains good precision. See Appendix A; Section 8.2 of the Datasheet for the equations.

BME280 Soft Reset

The BME280 can be soft reset by writing a given command to the Soft Reset register. This reinitialises the IC and sets all register values to their power-on defaults. [Same as the BMP280]

BME280 ID

Genuine Bosch BME280 chips have the ID value 0x60 written to read-only memory at point of manufacture. This value can be read from the ID value register.

BME280 MicroPython Driver for micro:bit

A BME280 MicroPython driver specifically for the BBC micro:bit has been developed as part of this series on MicroPython for the microbit. The driver webpage also provides a detailed description of the driver's methods with sample code.

The driver implements a fair slice of the BME280 capabilities as described in the product Datasheet. However for ease of use and to save scarce flash memory on the micro:bit only forced mode is available. In most cases this is not a huge limitation.