Combined humidity and pressure sensor

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F9700c44efd79bd072a7c64e6c80de5c08d606eb19ca18072213a54555182314c.jpg)

BME280 – Data sheet

Document revision

Document release date

Document number

Sales Part Number (SPN)

1.24 February 2024 BST-BME280-DS001-24 0 273 141 185

Notes

Data and descriptions in this document are subject to change without notice. Product photos and pictures are for illustration purposes only and may differ from the real product appearance

## BME280

## Digital humidity, pressure and temperature sensor

## Key features

• Package

• Digital interface

2.5 mm x 2.5 mm x 0.93 mm metal lid LGA

• Supply voltage

I²C (up to 3.4 MHz) and SPI (3 and 4 wire, up to 10 MHz)

VDD main supply voltage range: 1.71 V to 3.6 V

VDDIO interface voltage range: 1.2 V to 3.6 V

• Current consumption

1.8 µA @ 1 Hz humidity and temperature

2.8 µA @ 1 Hz pressure and temperature

3.6 µA @ 1 Hz humidity, pressure and temperature

0.1 µA in sleep mode

• Operating range

-40…+85 °C, 0…100 % rel. humidity, 300…1100 hPa

• Humidity sensor and pressure sensor can be independently enabled / disabled

• Register and performance compatible to Bosch Sensortec BMP280 digital pressure sensor

• RoHS compliant, halogen-free, MSL1

## Key parameters for humidity sensor

• Response time (�63%) 1 s

• Accuracy tolerance ±3 % relative humidity

• Hysteresis ±1% relative humidity

## Key parameters for pressure sensor

• RMS Noise 0.2 Pa, equiv. to 1.7 cm

• Offset temperature coefficient ±1.5 Pa/K, equiv. to ±12.6 cm at 1 °C temperature change

## Typical application

• Context awareness, e.g. skin detection, room change detection

• Fitness monitoring / well-being

• Warning regarding dryness or high temperatures

• Measurement of volume and air flow

• Home automation control

• control heating, venting, air conditioning (HVAC)

• Internet of things

• GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning, slope detection)

• Indoor navigation (change of floor detection, elevator detection)

• Outdoor navigation, leisure and sports applications

• Weather forecast

• Vertical velocity indication (rise/sink speed)

## Target devices

• Handsets such as mobile phones, tablet PCs, GPS devices

• Navigation systems

• Gaming, e.g flying toys

• Camera (DSC, video)

• Home weather stations

• Flying toys

• Watches

## General Description

The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. The sensor module is housed in an extremely compact metal-lid LGA package with a footprint of only 2.5 × 2.5 mm² with a height of 0.93 mm. Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules or watches. The BME280 is register and performance compatible to the Bosch Sensortec BMP280 digita pressure sensor (see chapter 5.2 for details).

The BME280 achieves high performance in all applications requiring humidity and pressure measurement. These emerging applications of home automation control, in-door navigation, fitness as well as GPS refinement require a high accuracy and a low TCO at the same time.

The humidity sensor provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range.

The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution and drastically lower noise than the Bosch Sensortec BMP180.

The integrated temperature sensor has been optimized for lowest noise and highest resolution. Its output is used for temperature compensation of the pressure and humidity sensors and can also be used for estimation of the ambient temperature.

The sensor provides both SPI and I²C interfaces and can be supplied using 1.71 to 3.6 V for the sensor supply VDD and 1.2 to 3.6 V for the interface supply VDDIO. Measurements can be triggered by the host or performed in regular intervals. When the sensor is disabled, current consumption drops to 0.1 µA.

BME280 can be operated in three power modes (see chapter 3.3):

• sleep mode

• normal mode

• forced mode

In order to tailor data rate, noise, response time and current consumption to the needs of the user, a variety of oversampling modes, filter modes and data rates can be selected.

Please contact your regional Bosch Sensortec partner for more information about software packages.

## Index of Contents

1. Specification ....8
1.1 General electrical specification....8
1.2 Humidity parameter specification....9
1.3 Pressure sensor specification....10
1.4 Temperature sensor specification....11

2. Absolute maximum ratings....13

3. Functional description....14
3.1 Block diagram....14
3.2 Power management....14
3.3 Sensor modes....14
3.3.1 Sensor mode transitions....15
3.3.2 Sleep mode....15
3.3.3 Forced mode....15
3.3.4 Normal mode....16
3.4 Measurement flow....17
3.4.1 Humidity measurement....17
3.4.2 Pressure measurement....17
3.4.3 Temperature measurement....17
3.4.4 IIR filter....18
3.5 Recommended modes of operation....19
3.5.1 Weather monitoring....19
3.5.2 Humidity sensing....19
3.5.3 Indoor navigation....20
3.5.4 Gaming....20
3.6 Noise....21

4. Data readout....23
4.1 Data register shadowing....23

4.2 Output compensation....23
4.2.1 Computational requirements....23
4.2.2 Trimming parameter readout....24
4.2.3 Compensation formulas....25

5. Global memory map and register description....26
5.1 General remarks....26
5.2 Register compatibility to BMP280....26
5.3 Memory map....26
5.4 Register description....27
5.4.1 Register 0xD0 "id"....27
5.4.2 Register 0xE0 "reset"....27
5.4.3 Register 0xF2 "ctrl\_hum"....27
5.4.4 Register 0xF3 "status"....28
5.4.5 Register 0xF4 "ctrl\_meas"....28
5.4.6 Register 0xF5 "config"....30
5.4.7 Register 0xF7...0xF9 "press" (\_msb, \_lsb, \_xlsx)....30
5.4.8 Register 0xFA...0xFC "temp" (\_msb, \_lsb, \_xlsx)....31
5.4.9 Register 0xFD...0xFE "hum" (\_msb, \_lsb)....31

6. Digital interfaces....32
6.1 Interface selection....32
6.2 I²C Interface....32
6.2.1 I²C write....33
6.2.2 I²C read....33
6.3 SPI interface....34
6.3.1 SPI write....34
6.3.2 SPI read....35
6.4 Interface parameter specification....35
6.4.1 General interface parameters....35
6.4.2 I²C timings....35
6.4.3 SPI timings....36

7. Pin-out and connection diagram .... 38
7.1 Pin-out .... 38
7.2 Connection diagram I²C.... 39
7.3 Connection diagram 4-wire SPI.... 40
7.4 Connection diagram 3-wire SPI.... 41
7.5 Package dimensions .... 42
7.6 Landing pattern recommendation.... 43
7.7 Marking.... 44
7.7.1 Mass production devices.... 44
7.7.2 Engineering samples.... 44
7.8 Soldering guidelines and reconditioning recommendations.... 45
7.9 Reconditioning Procedure.... 46
7.10 Tape and reel specification.... 46
7.10.1 Dimensions.... 46
7.10.2 Orientation within the reel.... 47
7.11 Mounting and assembly recommendations.... 48
7.12 Environmental safety.... 48
7.12.1 RoHS.... 48
7.12.2 Halogen content.... 48
7.12.3 Internal package structure.... 48

8. Appendix A: Alternative compensation formulas.... 49
8.1 Compensation formulas in double precision floating point.... 49
8.2 Pressure compensation in 32 bit fixed point.... 50

9. Appendix B: Measurement time and current calculation.... 51
9.1 Measurement time.... 51
9.2 Measurement rate in forced mode.... 51
9.3 Measurement rate in normal mode.... 51
9.4 Response time using IIR filter.... 52

9.5 Current consumption .... 52
10.Self test.... 53
10.1 Self-test flow.... 53
10.2 Function return codes.... 54
10.3 Usage.... 55
10.3.1 File and function pointer integration.... 55
10.3.2 Function call.... 55
10.3.3 Test time and interface requirements.... 55
10.4 Function explanation.... 56
10.4.1 Communication test.... 56
10.4.2 Bond wire test.... 56
10.4.3 Measurement plausibility test.... 56
10.5 Sample read, write and delay function.... 57
11.Legal disclaimer.... 58
11.1 Engineering samples.... 58
11.2 Product use.... 58
11.3 Application examples and hints.... 58
12.Document history and modification.... 59

## 1. Specification

If not stated otherwise,

• All values are valid over the full voltage range

• All minimum/maximum values are given for the full accuracy temperature range

• Minimum/maximum values of drifts, offsets and temperature coefficients are ±3σ values over lifetime

• Typical values of drifts, offsets and temperature coefficients are ±1σ values over lifetime

• Typical values of currents and state machine timings are determined at 25 °C

• Minimum/maximum values of currents are determined using corner lots over complete temperature range

Minimum/maximum values of state machine timings are determined using corner lots over 0…+65 °C temperature range

The specification tables are split into humidity, pressure, and temperature part of BME280.

## 1.1 General electrical specification

Table 1: Electrical parameter specification

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td>Supply Voltage Internal Domains</td><td> $V_{DD}$ </td><td>ripple max. 50 mVpp</td><td>1.71</td><td>1.8</td><td>3.6</td><td>V</td></tr><tr><td>Supply Voltage I/O Domain</td><td> $V_{DDIO}$ </td><td></td><td>1.2</td><td>1.8</td><td>3.6</td><td>V</td></tr><tr><td>Sleep current</td><td> $I_{DDSL}$ </td><td></td><td></td><td>0.1</td><td>0.3</td><td>μA</td></tr><tr><td>Standby current (inactive period of normal mode)</td><td> $I_{DDSB}$ </td><td></td><td></td><td>0.2</td><td>0.5</td><td>μA</td></tr><tr><td>Current during humidity measurement</td><td> $I_{DDH}$ </td><td>Max value at 85 °C</td><td></td><td>340</td><td></td><td>μA</td></tr><tr><td>Current during pressure measurement</td><td> $I_{DDP}$ </td><td>Max value at -40 °C</td><td></td><td>714</td><td></td><td>μA</td></tr><tr><td>Current during temperature measurement</td><td> $I_{DDT}$ </td><td>Max value at 85 °C</td><td></td><td>350</td><td></td><td>μA</td></tr><tr><td>Start-up time</td><td> $t_{startup}$ </td><td>Time to first communication after both  $V_{DD} > 1.58$  V and  $V_{DDIO} > 0.65$  V</td><td></td><td></td><td>2</td><td>ms</td></tr><tr><td>Power supply rejection ratio (DC)</td><td>PSRR</td><td>full  $V_{DD}$  range</td><td></td><td></td><td>±0.01 ±5</td><td>%RH/V Pa/V</td></tr><tr><td>Standby time accuracy</td><td> $\Delta t_{standby}$ </td><td></td><td></td><td>±5</td><td>±25</td><td>%</td></tr></table>

## 1.2 Humidity parameter specification

Table 2: Humidity parameter specification

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td rowspan="2"> $Operating\ range^1$ </td><td rowspan="2"> $R_H$ </td><td rowspan="2">For temperatures&lt; 0 °C and &gt;60 °Csee Figure 1</td><td>-40</td><td>25</td><td>85</td><td>°C</td></tr><tr><td>0</td><td></td><td>100</td><td>%RH</td></tr><tr><td>Supply current</td><td> $I_{DD,H}$ </td><td>1 Hz forced mode,humidity andtemperature</td><td></td><td>1.8</td><td>2.8</td><td>μA</td></tr><tr><td>Absolute accuracytolerance</td><td> $A_H$ </td><td>20...80 %RH,25 °C, includinghysteresis</td><td></td><td>±3</td><td></td><td>%RH</td></tr><tr><td> $Hysteresis^2$ </td><td> $H_H$ </td><td>10→90→10 %RH,25 °C</td><td></td><td>±1</td><td></td><td>%RH</td></tr><tr><td> $Nonlinearity^3$ </td><td> $NL_H$ </td><td>10→90 %RH, 25 °C</td><td></td><td>1</td><td></td><td>%RH</td></tr><tr><td>Response time tocomplete 63% of step4</td><td> $τ_{63\%}$ </td><td>90→0 or 0→90 %RH,25°C</td><td></td><td>1</td><td></td><td>s</td></tr><tr><td>Resolution</td><td> $R_H$ </td><td></td><td></td><td>0.008</td><td></td><td>%RH</td></tr><tr><td>Noise in humidity (RMS)</td><td> $N_H$ </td><td>Highest oversampling,see chapter 3.6</td><td></td><td>0.02</td><td></td><td>%RH</td></tr><tr><td>Long term stability</td><td> $ΔH_{stab}$ </td><td>10...90 %RH, 25 °C</td><td></td><td>0.5</td><td></td><td>%RH/year</td></tr></table>

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F50b1e7b66251bb90ada4220735bdcd97102caa83aa2f7125a7216be7d9c7c6e5.jpg)  
Figure 1: humidity sensor operating range

## 1.3 Pressure sensor specification

Table 3: Pressure parameter specification

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td rowspan="2">Operating temperature range</td><td rowspan="2"> $T_A$ </td><td>operational</td><td>-40</td><td>25</td><td>+85</td><td rowspan="2">°C</td></tr><tr><td>full accuracy</td><td>0</td><td></td><td>+65</td></tr><tr><td>Operating pressure range</td><td>P</td><td>full accuracy</td><td>300</td><td></td><td>1100</td><td>hPa</td></tr><tr><td>Supply current</td><td> $I_{DD,LP}$ </td><td>1 Hz forced mode, pressure and temperature, lowest power</td><td></td><td>2.8</td><td>4.2</td><td>μA</td></tr><tr><td rowspan="2">Temperature coefficient of  $offset^5$ </td><td rowspan="2"> $TCOP$ </td><td rowspan="2">25...65 °C, 900 hPa</td><td></td><td>±1.5</td><td></td><td>Pa/K</td></tr><tr><td></td><td>±12.6</td><td></td><td>cm/K</td></tr><tr><td rowspan="3">Absolute accuracy pressure</td><td> $A_{ext}^{P}$ </td><td>300..1100 hPa-20...0 °C</td><td></td><td>±1.7</td><td></td><td>hPa</td></tr><tr><td> $A_{P,full}$ </td><td>300...1100 hPa0...65 °C</td><td></td><td>±1.0</td><td></td><td>hPa</td></tr><tr><td> $A^P$ </td><td>1100...1250 hPa25...40 °C</td><td></td><td>±1.5</td><td></td><td>hPa</td></tr><tr><td>Relative accuracy pressure $V_{DD}=3.3V$ </td><td> $A_{rel}$ </td><td>700...900hPa25...40 °C</td><td></td><td>±0.12</td><td></td><td>hPa</td></tr><tr><td>Resolution of pressure output data</td><td> $R_P$ </td><td>Highest oversampling</td><td></td><td>0.18</td><td></td><td>Pa</td></tr><tr><td rowspan="4">Noise in pressure</td><td rowspan="2"> $N_{P,fullBW}$ </td><td rowspan="2">Full bandwidth,highest oversamplingSee chapter 3.6</td><td></td><td>1.3</td><td></td><td>Pa</td></tr><tr><td></td><td>11</td><td></td><td>cm</td></tr><tr><td rowspan="2"> $N_{P,filtered}$ </td><td rowspan="2">Reduced bandwidth,highest oversamplingSee chapter 3.6</td><td></td><td>0.2</td><td></td><td>Pa</td></tr><tr><td></td><td>1.7</td><td></td><td>cm</td></tr><tr><td>Solder drift</td><td></td><td>Minimum solder height50μm</td><td>-0.5</td><td></td><td>+2.0</td><td>hPa</td></tr><tr><td>Long term stability $^6$ </td><td> $ΔP_{stab}$ </td><td>per year</td><td></td><td>±1.0</td><td></td><td>hPa</td></tr><tr><td>Possible sampling rate</td><td> $f_{sample\_P}$ </td><td>Lowest oversampling,see chapter 9.2</td><td>157</td><td>182</td><td></td><td>Hz</td></tr></table>

## 1.4 Temperature sensor specification

Table 4: Temperature parameter specification

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td rowspan="2">Operating range</td><td rowspan="2">T</td><td>Operational</td><td>-40</td><td>25</td><td>85</td><td>°C</td></tr><tr><td>Full accuracy</td><td>0</td><td></td><td>65</td><td>°C</td></tr><tr><td>Supply current</td><td> $I_{DD,T}$ </td><td>1 Hz forced mode, temperature measurement only</td><td></td><td>1.0</td><td></td><td>μA</td></tr><tr><td></td><td> $A_{T,25}$ </td><td>25 °C</td><td></td><td>±0.5</td><td></td><td>°C</td></tr><tr><td rowspan="3">Absolute accuracy temperature7</td><td> $A_{T,full}$ </td><td>0...65 °C</td><td></td><td>±0.5</td><td></td><td>°C</td></tr><tr><td> $A_{T,ext}^{8}$ </td><td>-20 .... 0 °C</td><td></td><td>±1.25</td><td></td><td>°C</td></tr><tr><td> $A_{T,ext}^{9}$ </td><td>-40 ... -20 °C</td><td></td><td>±1.5</td><td></td><td>°C</td></tr><tr><td>Output resolution</td><td> $R_T$ </td><td>API output resolution</td><td colspan="3">0.01</td><td>°C</td></tr><tr><td>RMS noise</td><td> $N_T$ </td><td>Lowest oversampling</td><td></td><td>0.005</td><td></td><td>°C</td></tr></table>

## 2. Absolute maximum ratings

The absolute maximum ratings are determined over complete temperature range using corner lots. The values are provided in Table 5.

Table 5: Absolute maximum ratings

<table><tr><td>Parameter</td><td>Condition</td><td>Min</td><td>Max</td><td>Unit</td></tr><tr><td>Voltage at any supply pin</td><td> $V_{DD}$  and  $V_{DDIO}$  pin</td><td>-0.3</td><td>4.25</td><td>V</td></tr><tr><td>Voltage at any interface pin</td><td></td><td>-0.3</td><td> $V_{DDIO} + 0.3$ </td><td>V</td></tr><tr><td>Storage temperature</td><td>≤ 65% RH</td><td>-45</td><td>+85</td><td>°C</td></tr><tr><td>Pressure</td><td></td><td>0</td><td>20 000</td><td>hPa</td></tr><tr><td rowspan="3">ESD</td><td>HBM, at any pin</td><td></td><td>±2</td><td>kV</td></tr><tr><td>CDM</td><td></td><td>±500</td><td>V</td></tr><tr><td>Machine model</td><td></td><td>±200</td><td>V</td></tr></table>

## 3. Functional description

## 3.1 Block diagram

Figure 2 shows a simplified block diagram of the BME280:

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Feba7a9b6ce8b3826c35139de6b3fa8b4c8510b3d4bb44d44dba8e3df01bf7a05.jpg)  
Figure 2: Block diagram of BME280

## 3.2 Power management

The BME280 has two distinct power supply pins

• VDD is the main power supply for all internal analog and digital functional blocks

• VDDIO is a separate power supply pin used for the supply of the digital interface

A power-on reset (POR) generator is built in; it resets the logic part and the register values after both VDD and VDDIO reach their minimum levels. There are no limitations on slope and sequence of raising the VDD and VDDIO levels. After powering up, the sensor settles in sleep mode (described in chapter 3.3.2).

It is prohibited to keep any interface pin (SDI, SDO, SCK or CSB) at a logical high level when VDDIO is switched off. Such a configuration can permanently damage the device due an excessive current flow through the ESD protection diodes.

If VDDIO is supplied, but VDD is not, the interface pins are kept at a high-Z level. The bus can therefore already be used freely before the BME280 VDD supply is established.

Resetting the sensor is possible by cycling VDD level or by writing a soft reset command. Cycling the VDDIO level will not cause a reset.

## 3.3 Sensor modes

The BME280 offers three sensor modes: sleep mode, forced mode and normal mode. These can be selected using the mode[1:0] setting (see chapter 5.4.5). The available modes are:

• Sleep mode: no operation, all registers accessible, lowest power, selected after startup

• Forced mode: perform one measurement, store results and return to sleep mode

• Normal mode: perpetual cycling of measurements and inactive periods.

The modes will be explained in detail in chapters 3.3.2 (sleep mode), 3.3.3 (forced mode) and 3.3.4 (normal mode).

## 3.3.1 Sensor mode transitions

The supported mode transitions are shown in Figure 3. If the device is currently performing a measurement, execution of mode switching commands is delayed until the end of the currently running measurement period. Further mode change commands or other write commands to the register ctrl\_hum are ignored until the mode change command has been executed. Mode transitions other than the ones shown below are tested for stability but do not represent recommended use of the device.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F0e04aa411d8b62af5aed6350399d65070a419918b29fbda0e5863df8cf4fc293.jpg)  
Figure 3: Sensor mode transition diagram

## 3.3.2 Sleep mode

Sleep mode is entered by default after power on reset. In sleep mode, no measurements are performed and power consumption (IDDSM) is at a minimum. All registers are accessible; Chip-ID and compensation coefficients can be read. There are no special restrictions on interface timings.

## 3.3.3 Forced mode

In forced mode, a single measurement is performed in accordance to the selected measurement and filter options. When the measurement is finished, the sensor returns to sleep mode and the measurement results can be obtained from the data registers. For a next measurement, forced mode needs to be selected again. This is similar to BMP180 operation. Using forced mode is recommended for applications which require low sampling rate or host-based synchronization. The timing diagram is shown below.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Fd644f961d0c3826e431379fcdc1703000f54a5f42ff7235f08d53d41872d80c9.jpg)  
Figure 4: Forced mode timing diagram

## 3.3.4 Normal mode

Normal mode comprises an automated perpetual cycling between an (active) measurement period and an (inactive) standby period.

The measurements are performed in accordance to the selected measurement and filter options. The standby time is determined by the setting t\_sb[2:0] and can be set to between 0.5 and 1000 ms according to Table 27.

The total cycle time depends on the sum of the active time (see chapter 9) and standby time tstandby. The current in the standby period (IDDSB) is slightly higher than in sleep mode. After setting the measurement and filter options and enabling normal mode, the last measurement results can always be obtained at the data registers without the need of further write accesses.

Using normal mode is recommended when using the IIR filter. This is useful for applications in which short-term disturbances (e.g. blowing into the sensor) should be filtered. The timing diagram is shown below:

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F1b1490a9b8f023b1f6ab63d446fce0b3b07ae2341ed05c06fc94d8ce84098341.jpg)  
Figure 5: Normal mode timing diagram

## 3.4 Measurement flow

The BME280 measurement period consists of a temperature, pressure and humidity measurement with selectable oversampling. After the measurement period, the pressure and temperature data can be passed through an optional IIR filter, which removes short-term fluctuations in pressure (e.g. caused by slamming a door). For humidity, such a filter is not needed and has not been implemented. The flow is depicted in the diagram below.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F2d7831e52b64521eacc20a6a1f4d3b7458d73727d6f4cbc4d595e6423498ac42.jpg)  
Figure 6: BME280 measurement cycle

The individual blocks of the diagram above will be detailed in the following subchapters.

## 3.4.1 Humidity measurement

The humidity measurement can be enabled or skipped. When enabled, several oversampling options exist. The humidity measurement is controlled by the osrs\_h[2:0] setting, which is detailed in chapter 5.4.3. For the humidity measurement, oversampling is possible to reduce the noise. The resolution of the humidity measurement is fixed at 16 bit ADC output.

## 3.4.2 Pressure measurement

Pressure measurement can be enabled or skipped. When enabled, several oversampling options exist. The pressure measurement is controlled by the osrs\_p[2:0] setting which is detailed in chapte 5.4.5. For the pressure measurement, oversampling is possible to reduce the noise. The resolution of the pressure data depends on the IIR filter (see chapter 3.4.4) and the oversampling setting (see chapter 5.4.5):

• When the IIR filter is enabled, the pressure resolution is 20 bit.

• When the IIR filter is disabled, the pressure resolution is 16 + (osrs\_p – 1) bit, e.g. 18 bit when osrs\_p is set to ‘3’.

## 3.4.3 Temperature measurement

Temperature measurement can be enabled or skipped. Skipping the measurement could be useful to measure pressure extremely rapidly. When enabled, several oversampling options exist. The temperature measurement is controlled by the osrs\_t[2:0] setting which is detailed in chapter 5.4.5. For the temperature measurement, oversampling is possible to reduce the noise. The resolution of the temperature data depends on the IIR filter (see chapter 3.4.4) and the oversampling setting (see chapter 5.4.5):

• When the IIR filter is enabled, the temperature resolution is 20 bit.

• When the IIR filter is disabled, the temperature resolution is 16 + (osrs\_t – 1) bit, e.g. 18 bit when osrs\_t is set to ‘3’.

## 3.4.4 IIR filter

The humidity value inside the sensor does not fluctuate rapidly and does not require low pass filtering. However, the environmental pressure is subject to many short-term changes, caused e.g. by slamming of a door or window, or wind blowing into the sensor. To suppress these disturbances in the output data without causing additional interface traffic and processor work load, the BME280 features an internal IIR filter. It effectively reduces the bandwidth of the temperature and pressure output signals10 and increases the resolution of the pressure and temperature output data to 20 bit. The output of a next measurement step is filtered using the following formula:

$$
d a t a \_ f i l t e r e d = \frac {d a t a \_ f i l t e r e d \_ o l d \cdot (f i l t e r \_ c o e f f i c i e n t - 1) + d a t a \_ A D C}{f i l t e r \_ c o e f f i c i e n t}
$$

Data\_filtered\_old is the data coming from the current filter memory, and data\_ADC is the data coming from current ADC acquisition. Data\_filtered is the new value of filter memory and the value that will be sent to the output registers.

The IIR filter can be configured to different filter coefficients, which slows down the response to the sensor inputs. Note that the response time with enabled IIR filter depends on the number of samples generated, which means that the data output rate must be known to calculate the actual response time. For register configuration, please refer to Table 28. A sample response time calculation is shown in chapter 9.4.

Table 6: filter settings

<table><tr><td>Filter coefficient</td><td>Samples to reach ≥75 % of step response</td></tr><tr><td>Filter off</td><td>1</td></tr><tr><td>2</td><td>2</td></tr><tr><td>4</td><td>5</td></tr><tr><td>8</td><td>11</td></tr><tr><td>16</td><td>22</td></tr></table>

In order to find a suitable setting for filter, please consult chapter 3.5.

When writing to the register filter, the filter is reset. The next ADC values will the pass through the filter unchanged and become the initial memory values for the filter. If temperature or pressure measurements are skipped, the corresponding filter memory will be kept unchanged even though the output registers are set to 0x80000. When the previously skipped measurement is re-enabled, the output will be filtered using the filter memory from the last time when the measurement was not skipped. If this is not desired, please write to the filter register in order to re-initialize the filter.

The step response (e.g. response to in sudden change in height) of the different filter settings is displayed in Figure 7.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Ff869f9294255a4701ed80d24279bcf2ae18a63f15b12200dd10a682196027228.jpg)  
Figure 7: Step response at different IIR filter settings

## 3.5 Recommended modes of operation

The different oversampling options, filter settings and sensor modes result in a large number of possible settings. In this chapter, a number of settings recommended for various scenarios are presented.

## 3.5.1 Weather monitoring

Description: Only a very low data rate is needed. Power consumption is minimal. Noise of pressure values is of no concern. Humidity, pressure and temperature are monitored.

Table 7: Settings and performance for weather monitoring

<table><tr><td colspan="2">Suggested settings for weather monitoring</td></tr><tr><td>Sensor mode</td><td>forced mode, 1 sample / minute</td></tr><tr><td>Oversampling settings</td><td>pressure ×1, temperature ×1, humidity ×1</td></tr><tr><td>IIR filter settings</td><td>filter off</td></tr><tr><td colspan="2">Performance for suggested settings</td></tr><tr><td>Current consumption</td><td>0.16 μA</td></tr><tr><td>RMS Noise</td><td>3.3 Pa / 30 cm, 0.07 %RH</td></tr><tr><td>Data output rate</td><td>1/60 Hz</td></tr></table>

## 3.5.2 Humidity sensing

Description: A low data rate is needed. Power consumption is minimal. Forced mode is used to minimize power consumption and to synchronize readout, but using normal mode would also be possible.

Table 8: Settings and performance for humidity sensing

<table><tr><td colspan="2">Suggested settings for weather monitoring</td></tr><tr><td>Sensor mode</td><td>forced mode, 1 sample / second</td></tr><tr><td>Oversampling settings</td><td>pressure ×0, temperature ×1, humidity ×1</td></tr><tr><td>IIR filter settings</td><td>filter off</td></tr><tr><td colspan="2">Performance for suggested settings</td></tr><tr><td>Current consumption</td><td>2.9 μA</td></tr><tr><td>RMS Noise</td><td>0.07 %RH</td></tr><tr><td>Data output rate</td><td>1 Hz</td></tr></table>

## 3.5.3 Indoor navigation

Lowest possible altitude noise is needed. A very low bandwidth is preferred. Increased power consumption is tolerated. Humidity is measured to help detect room changes. This setting is suggested for the Android settings ‘SENSOR\_DELAY\_NORMAL’ and ‘SENSOR\_DELAY\_UI’.

Table 9: Settings and performance for indoor navigation

<table><tr><td colspan="2">Suggested settings for indoor navigation</td></tr><tr><td>Sensor mode</td><td>normal mode,  $t_{standby}$ = 0.5 ms</td></tr><tr><td>Oversampling settings</td><td>pressure ×16, temperature ×2, humidity ×1</td></tr><tr><td>IIR filter settings</td><td>filter coefficient 16</td></tr><tr><td colspan="2">Performance for suggested settings</td></tr><tr><td>Current consumption</td><td>633 μA</td></tr><tr><td>RMS Noise</td><td>0.2 Pa / 1.7 cm</td></tr><tr><td>Data output rate</td><td>25Hz</td></tr><tr><td>Filter bandwidth</td><td>0.53 Hz</td></tr><tr><td>Response time (75%)</td><td>0.9 s</td></tr></table>

## 3.5.4 Gaming

Low altitude noise is needed. The required bandwidth is \~2 Hz in order to respond quickly to altitude changes (e.g. be able to dodge a flying monster in a game). Increased power consumption is tolerated. Humidity sensor is disabled. This setting is suggested for the Android settings ‘SENSOR\_DELAY\_GAMING’ and ‘SENSOR\_DELAY\_FASTEST’.

Table 10: Settings and performance for gaming

<table><tr><td colspan="2">Suggested settings for gaming</td></tr><tr><td>Sensor mode</td><td>normal mode,  $t_{standby}$ = 0.5 ms</td></tr><tr><td>Oversampling settings</td><td>pressure ×4, temperature ×1, humidity ×0</td></tr><tr><td>IIR filter settings</td><td>filter coefficient 16</td></tr><tr><td colspan="2">Performance for suggested settings</td></tr><tr><td>Current consumption</td><td>581 μA</td></tr><tr><td>RMS Noise</td><td>0.3 Pa / 2.5 cm</td></tr><tr><td>Data output rate</td><td>83 Hz</td></tr><tr><td>Filter bandwidth</td><td>1.75 Hz</td></tr><tr><td>Response time (75%)</td><td>0.3 s</td></tr></table>

## 3.6 Noise

The noise depends on the oversampling and, for pressure and temperature, on the filter setting used. The stated values were determined in a controlled environment and are based on the average standard deviation of 32 consecutive measurement points taken at highest sampling speed. This is needed in order to exclude long term drifts from the noise measurement. The noise depends both on humidity/pressure oversampling and temperature oversampling, since the temperature value is used for humidity/pressure temperature compensation. The oversampling combinations use below results in an optimal power to noise ratio.

Table 11: Noise and current for humidity

<table><tr><td>Humidity / temperature oversampling setting</td><td>Typical RMS noise in humidity [%RH] at 25 °C</td><td>Typ. current [μA] at 1 Hz forced mode, 25 °C, humidity and temperature measurement, incl. IDDSM</td></tr><tr><td>×1 / ×1</td><td>0.07</td><td>1.8</td></tr><tr><td>×2 / ×1</td><td>0.05</td><td>2.5</td></tr><tr><td>×4 / ×1</td><td>0.04</td><td>3.8</td></tr><tr><td>×8 / ×1</td><td>0.03</td><td>6.5</td></tr><tr><td>×16 / ×1</td><td>0.02</td><td>11.7</td></tr></table>

Table 12: Noise and current for pressure

<table><tr><td colspan="6">Typical RMS noise in pressure [Pa] at 25 °C</td><td rowspan="3">Typ. current [μA] at 1 Hz forced mode, 25 °C, pressure and temperature measurement, incl. IDDSM</td></tr><tr><td rowspan="2">Pressure / temperature oversampling setting</td><td colspan="5">IIR filter coefficient</td></tr><tr><td>off</td><td>2</td><td>4</td><td>8</td><td>16</td></tr><tr><td>×1 / ×1</td><td>3.3</td><td>1.9</td><td>1.2</td><td>0.9</td><td>0.4</td><td>2.8</td></tr><tr><td>×2 / ×1</td><td>2.6</td><td>1.5</td><td>1.0</td><td>0.6</td><td>0.4</td><td>4.2</td></tr><tr><td>×4 / ×1</td><td>2.1</td><td>1.2</td><td>0.8</td><td>0.5</td><td>0.3</td><td>7.1</td></tr><tr><td>×8 / ×1</td><td>1.6</td><td>1.0</td><td>0.6</td><td>0.4</td><td>0.2</td><td>12.8</td></tr><tr><td>×16 / ×2</td><td>1.3</td><td>0.8</td><td>0.5</td><td>0.4</td><td>0.2</td><td>24.9</td></tr></table>

Table 13: Temperature dependence of pressure noise

<table><tr><td colspan="2">RMS noise at different temperatures</td></tr><tr><td>Temperature</td><td>Typical change in noise compared to 25 °C</td></tr><tr><td>-10 °C</td><td>+25 %</td></tr><tr><td>25 °C</td><td>±0 %</td></tr><tr><td>75 °C</td><td>-5 %</td></tr></table>

Table 14: Noise in temperature

<table><tr><td>Temperature oversampling setting</td><td>Typical RMS noise in temperature [°C] at 25 °C</td></tr><tr><td>×1</td><td>0.005</td></tr><tr><td>×2</td><td>0.004</td></tr><tr><td>×4</td><td>0.003</td></tr><tr><td>×8</td><td>0.003</td></tr><tr><td>×16</td><td>0.002</td></tr></table>

## 4. Data readout

To read out data after a conversion, it is strongly recommended to use a burst read and not address every register individually. This will prevent a possible mix-up of bytes belonging to different measurements and reduce interface traffic. Note that in I²C mode, even when pressure was not measured, reading the unused registers is faster than reading temperature and humidity data separately.

Data readout is done by starting a burst read from 0xF7 to 0xFC (temperature and pressure) or from 0xF7 to 0xFE (temperature, pressure and humidity). The data are read out in an unsigned 20-bit format both for pressure and for temperature and in an unsigned 16-bit format for humidity. It is strongly recommended to use the BME280 API, available from Bosch Sensortec, for readout and compensation. For details on memory map and interfaces, please consult chapters 5 and 6 respectively.

After the uncompensated values for pressure, temperature and humidity ‘ut’, ‘up’ and ‘uh’ have been read, the actual humidity, pressure and temperature needs to be calculated using the compensation parameters stored in the device. The procedure is elaborated in chapter 4.2.

## 4.1 Data register shadowing

In normal mode, the timing of measurements is not necessarily synchronized to the readout by the user. This means that new measurement results may become available while the user is reading the results from the previous measurement. In this case, shadowing is performed in order to guarantee data consistency. Shadowing will only work if all data registers are read in a single burst read. Therefore, the user must use burst reads if he does not synchronize data readout with the measurement cycle. Using several independent read commands may result in inconsistent data. If a new measurement is finished and the data registers are still being read, the new measurement results are transferred into shadow data registers. The content of shadow registers is transferred into data registers as soon as the user ends the burst read, even if not all data registers were read. The end of the burst read is marked by the rising edge of CSB pin in SPI case or by the recognition of a stop condition in I2C case. After the end of the burst read, all user data registers are updated at once.

## 4.2 Output compensation

The BME280 output consists of the ADC output values. However, each sensing element behaves differently. Therefore, the actual pressure and temperature must be calculated using a set of calibration parameters. In this chapter, the method to read out the trimming values will be given. The recommended calculation uses fixed point arithmetic and is given in chapter 4.2.3. In high-level languages like Matlab™ or LabVIEW™, fixed-point code may not be well supported. In this case the floating-point code in appendix 8.1 can be used as an alternative. For 8-bit micro controllers, the variable size may be limited. In this case a simplified 32 bit integer code with reduced accuracy is given in appendix 8.2.

## 4.2.1 Computational requirements

In the table below an overview is given for the number of clock cycles needed for compensation on a 32 bit Cortex-M3 micro controller with GCC optimization level -O2. This controller does not feature a floating point unit, thus all floating-point calculations are emulated. Floating point is only recommended for PC application, where an FPU is present and these calculations are performed drastically faster.

Table 15: Computational requirements for compensation formulas

<table><tr><td rowspan="2">Compensation of</td><td colspan="3">Number of clocks (ARM Cortex-M3)</td></tr><tr><td>32 bit integer</td><td>64 bit integer</td><td>Double precision</td></tr><tr><td>Humidity</td><td>~83</td><td>-</td><td> $\sim 2900^{11}$ </td></tr><tr><td>Temperature</td><td>~46</td><td>-</td><td> $\sim 2400^{11}$ </td></tr><tr><td>Pressure</td><td> $\sim 112^{12}$ </td><td>~1400</td><td> $\sim 5400^{11}$ </td></tr></table>

## 4.2.2 Trimming parameter readout

The trimming parameters are programmed into the devices’ non-volatile memory (NVM) during production and cannot be altered by the customer. Each compensation word is a 16-bit signed or unsigned integer value stored in two’s complement. As the memory is organized into 8-bit words, two words must always be combined in order to represent the compensation word. The 8-bit registers are named calib00…calib41 and are stored at memory addresses 0x88…0xA1 and 0xE1…0xE7. The corresponding compensation words are named dig\_T# for temperature compensation related values, dig\_P# for pressure related values and dig\_H# for humidity related values. The mapping is seen in Table 16.

Table 16: Compensation parameter storage, naming and data type

<table><tr><td>Register Address</td><td>Register content</td><td>Data type</td></tr><tr><td>0x88 / 0x89</td><td>dig_T1 [7:0] / [15:8]</td><td>unsigned short</td></tr><tr><td>0x8A / 0x8B</td><td>dig_T2 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x8C / 0x8D</td><td>dig_T3 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x8E / 0x8F</td><td>dig_P1 [7:0] / [15:8]</td><td>unsigned short</td></tr><tr><td>0x90 / 0x91</td><td>dig_P2 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x92 / 0x93</td><td>dig_P3 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x94 / 0x95</td><td>dig_P4 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x96 / 0x97</td><td>dig_P5 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x98 / 0x99</td><td>dig_P6 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x9A / 0x9B</td><td>dig_P7 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x9C / 0x9D</td><td>dig_P8 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0x9E / 0x9F</td><td>dig_P9 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0xA1</td><td>dig_H1 [7:0]</td><td>unsigned char</td></tr><tr><td>0xE1 / 0xE2</td><td>dig_H2 [7:0] / [15:8]</td><td>signed short</td></tr><tr><td>0xE3</td><td>dig_H3 [7:0]</td><td>unsigned char</td></tr><tr><td>0xE4 / 0xE5[3:0]</td><td>dig_H4 [11:4] / [3:0]</td><td>signed short</td></tr><tr><td>0xE5[7:4] / 0xE6</td><td>dig_H5 [3:0] / [11:4]</td><td>signed short</td></tr></table>

## 4.2.3 Compensation formulas

Please note that it is strongly advised to use the API available from Bosch Sensortec to perform readout and compensation. If this is not wanted, the code below can be applied at the user’s risk. Both pressure and temperature values are expected to be received in 20 bit format, positive, stored in a 32 bit signed integer. Humidity is expected to be received in 16 bit format, positive, stored in a 32 bit signed integer.

The variable t\_fine (signed 32 bit) carries a fine resolution temperature value over to the pressure and humidity compensation formula and could be implemented as a global variable.

The data type “BME280\_S32\_t” should define a 32 bit signed integer variable type and can usually be defined as “long signed int”.

The data type “BME280\_U32\_t” should define a 32 bit unsigned integer variable type and can usually be defined as “long unsigned int”.

For best possible calculation accuracy in pressure, 64 bit integer support is needed. If this is not possible on your platform, please see appendix 8.2 for a 32 bit alternative.

The data type “BME280\_S64\_t” should define a 64 bit signed integer variable type, which on most supporting platforms can be defined as “long long signed int”. The revision of the code is rev.1.1.

```c
// Returns temperature in DegC, resolution is 0.01 DegC. Output value of "5123" equals 51.23
DegC.
// t_fine carries fine temperature as global value
BME280_S32_t t_fine;
BME280_S32_t BME280_compensate_T_int32(BME280_S32_t adc_T)
{
    BME280_S32_t var1, var2, T;
    var1 = ((((adc_T>>3) - ((BME280_S32_t)dig_T1<<1))) * ((BME280_S32_t)dig_T2)) >> 11;
    var2 = ((((adc_T>>4) - ((BME280_S32_t)dig_T1)) * ((adc_T>>4) - ((BME280_S32_t)dig_T1)))
>> 12) *
    ((BME280_S32_t)dig_T3)) >> 14;
    t_fine = var1 + var2;
    T = (t_fine * 5 + 128) >> 8;
    return T;
}

// Returns pressure in Pa as unsigned 32 bit integer in Q24.8 format (24 integer bits and 8 fractional bits).
// Output value of "24674867" represents 24674867/256 = 96386.2 Pa = 963.862 hPa
BME280_U32_t BME280_compensate_P_int64(BME280_S32_t adc_P)
{
    BME280_S64_t var1, var2, p;
    var1 = ((BME280_S64_t)t_fine) - 128000;
    var2 = var1 * var1 * (BME280_S64_t)dig_P6;
    var2 = var2 + ((var1*(BME280_S64_t)dig_P5)<<17);
    var2 = var2 + (((BME280_S64_t)dig_P4)<<35);
    var1 = ((var1 * var1 * (BME280_S64_t)dig_P3)>>8) + ((var1 * (BME280_S64_t)dig_P2)<<12);
    var1 = (((BME280_S64_t)1)<<47)+var1))*(BME280_S64_t)dig_P1)>>33;
    if (var1 == 0)
    {
    return 0; // avoid exception caused by division by zero
    }
    p = 1048576-adc_P;
    p = (((p<<31)-var2)*3125)/var1;
    var1 = (((BME280_S64_t)dig_P9) * (p>>13) * (p>>13)) >> 25;
    var2 = (((BME280_S64_t)dig_P8) * p) >> 19;
    p = ((p + var1 + var2) >> 8) + (((BME280_S64_t)dig_P7)<<4);
    return (BME280_U32_t)p;
}

// Returns humidity in %RH as unsigned 32 bit integer in Q22.10 format (22 integer and 10 fractional bits).
// Output value of "47445" represents 47445/1024 = 46.333 %RH
BME280_U32_t bme280_compensate_H_int32(BME280_S32_t adc_H)
{
    BME280_S32_t v_x1_u32r;

    v_x1_u32r = (t_fine - ((BME280_S32_t)76800));
```

```c
v_x1_u32r = (((((adc_H << 14) - (((BME280_S32_t)dig_H4) << 20) - (((BME280_S32_t)dig_H5) * v_x1_u32r)) + ((BME280_S32_t)16384)) >> 15) * (((((((v_x1_u32r * ((BME280_S32_t)dig_H6)) >> 10) * (((v_x1_u32r * ((BME280_S32_t)dig_H3)) >> 11) + ((BME280_S32_t)32768))) >> 10) + ((BME280_S32_t)2097152)) * ((BME280_S32_t)dig_H2) + 8192) >> 14));  
v_x1_u32r = (v_x1_u32r - (((((v_x1_u32r >> 15) * (v_x1_u32r >> 15)) >> 7) * ((BME280_S32_t)dig_H1)) >> 4));  
v_x1_u32r = (v_x1_u32r < 0 ? 0 : v_x1_u32r);  
v_x1_u32r = (v_x1_u32r > 419430400 ? 419430400 : v_x1_u32r);  
return (BME280_U32_t)(v_x1_u32r>>12);
```

## 5. Global memory map and register description

## 5.1 General remarks

The entire communication with the device is performed by reading from and writing to registers. Registers have a width of 8 bits. There are several registers which are reserved; they should not be written to and no specific value is guaranteed when they are read. For details on the interface, consult chapter 6.

## 5.2 Register compatibility to BMP280

The BME280 is downward register compatible to the BMP280, which means that the pressure and temperature control and readout is identical to BMP280. However, the following exceptions have to be considered:

Table 17: Register incompatibilities between BMP280 and BME280

<table><tr><td>Register</td><td>Bits</td><td>Content</td><td>BMP280</td><td>BME280</td></tr><tr><td>0xD0 “id”</td><td>7:0</td><td>chip_id</td><td>Read value is 0x56 / 0x57 (samples) 0x58 (mass production)</td><td>Read value is 0x60</td></tr><tr><td>0xF5 “config”</td><td>7:5</td><td>t_sb</td><td>‘110’: 2000 ms ‘111’: 4000 ms</td><td>‘110’: 10 ms ‘111’: 20 ms</td></tr><tr><td>0xF7...0xF9 “press”</td><td>19:0</td><td>press</td><td>Resolution (16...20 bit) depends only on osrs_p</td><td>Without filter, resolution depends on osrs_p; when using filter, resolution is always 20 bit</td></tr><tr><td>0xFA...0xFC “temp”</td><td>19:0</td><td>temp</td><td>Resolution (16...20 bit) only depends on osrs_t</td><td>Without filter, resolution depends on osrs_t; when using filter, resolution is always 20 bit</td></tr></table>

## 5.3 Memory map

The memory map is given in Table 18 below. Reserved registers are not shown.

Table 18: Memory map

<table><tr><td>Register Name</td><td>Address</td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td>Reset state</td></tr><tr><td>hum_lsb</td><td>0xFE</td><td colspan="8">hum_lsb&lt;7:0&gt;</td><td>0x00</td></tr><tr><td>hum_msb</td><td>0xFD</td><td colspan="8">hum_msb&lt;7:0&gt;</td><td>0x80</td></tr><tr><td>temp_xlsb</td><td>0xFC</td><td colspan="4">temp_xlsb&lt;7:4&gt;</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0x00</td></tr><tr><td>temp_lsb</td><td>0xFB</td><td colspan="8">temp_lsb&lt;7:0&gt;</td><td>0x00</td></tr><tr><td>temp_msb</td><td>0xFA</td><td colspan="8">temp_msb&lt;7:0&gt;</td><td>0x80</td></tr><tr><td>press_xlsb</td><td>0xF9</td><td colspan="4">press_xlsb&lt;7:4&gt;</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0x00</td></tr><tr><td>press_lsb</td><td>0xF8</td><td colspan="8">press_lsb&lt;7:0&gt;</td><td>0x00</td></tr><tr><td>press_msb</td><td>0xF7</td><td colspan="8">press_msb&lt;7:0&gt;</td><td>0x80</td></tr><tr><td>config</td><td>0xF5</td><td colspan="3">t_sb[2:0]</td><td colspan="3">filter[2:0]</td><td></td><td>spi3w_en[0]</td><td>0x00</td></tr><tr><td>ctrl_meas</td><td>0xF4</td><td colspan="3">osrs_t[2:0]</td><td colspan="3">osrs_p[2:0]</td><td colspan="2">mode[1:0]</td><td>0x00</td></tr><tr><td>status</td><td>0xF3</td><td colspan="4"></td><td>measuring[0]</td><td colspan="2"></td><td>im_update[0]</td><td>0x00</td></tr><tr><td>ctrl_hum</td><td>0xF2</td><td colspan="5"></td><td colspan="3">osrs_h[2:0]</td><td>0x00</td></tr><tr><td>calib26..calib41</td><td>0xE1...0xF0</td><td colspan="8">calibration data</td><td>individual</td></tr><tr><td>reset</td><td>0xE0</td><td colspan="8">reset[7:0]</td><td>0x00</td></tr><tr><td>id</td><td>0xD0</td><td colspan="8">chip_id[7:0]</td><td>0x60</td></tr><tr><td>calib00..calib25</td><td>0x88...0xA1</td><td colspan="8">calibration data</td><td>individual</td></tr></table>

<table><tr><td>Registers:</td><td>Reserved registers</td><td>Calibration data</td><td>Control registers</td><td>Data registers</td><td>Status registers</td><td>Chip ID</td><td>Reset</td></tr><tr><td>Type:</td><td>do not change</td><td>read only</td><td>read / write</td><td>read only</td><td>read only</td><td>read only</td><td>write only</td></tr></table>

## 5.4 Register description

## 5.4.1 Register 0xD0 “id”

The “id” register contains the chip identification number chip\_id[7:0], which is 0x60. This number can be read as soon as the device finished the power-on-reset.

## 5.4.2 Register 0xE0 “reset”

The “reset” register contains the soft reset word reset[7:0]. If the value 0xB6 is written to the register, the device is reset using the complete power-on-reset procedure. Writing other values than 0xB6 has no effect. The readout value is always 0x00.

## 5.4.3 Register 0xF2 “ctrl\_hum”

The “ctrl\_hum” register sets the humidity data acquisition options of the device. Changes to this register only become effective after a write operation to “ctrl\_meas”.

Table 19: Register 0xF2 “ctrl\_hum”

<table><tr><td>Register 0xF2 “ctrl_hum”</td><td>Name</td><td>Description</td></tr><tr><td>Bit 2, 1, 0</td><td>osrs_h[2:0]</td><td>Controls oversampling of humidity data. See Table 20 for settings and chapter 3.4.1 for details.</td></tr></table>

Table 20: register settings osrs\_h

<table><tr><td>osrs_h[2:0]</td><td>Humidity oversampling</td></tr><tr><td>000</td><td>Skipped (output set to 0x8000)</td></tr><tr><td>001</td><td>oversampling ×1</td></tr><tr><td>010</td><td>oversampling ×2</td></tr><tr><td>011</td><td>oversampling ×4</td></tr><tr><td>100</td><td>oversampling ×8</td></tr><tr><td>101, others</td><td>oversampling ×16</td></tr></table>

## 5.4.4 Register 0xF3 “status”

The “status” register contains two bits which indicate the status of the device.

Table 21: Register 0xF3 “status”

<table><tr><td>Register 0xF3 “status”</td><td>Name</td><td>Description</td></tr><tr><td>Bit 3</td><td>measuring[0]</td><td>Automatically set to ‘1’ whenever a conversion is running and back to ‘0’ when the results have been transferred to the data registers.</td></tr><tr><td>Bit 0</td><td>im_update[0]</td><td>Automatically set to ‘1’ when the NVM data are being copied to image registers and back to ‘0’ when the copying is done. The data are copied at power-on-reset and before every conversion.</td></tr></table>

## 5.4.5 Register 0xF4 “ctrl\_meas”

The “ctrl\_meas” register sets the pressure and temperature data acquisition options of the device. The register needs to be written after changing “ctrl\_hum” for the changes to become effective.

Table 22: Register 0xF4 “ctrl\_meas”

<table><tr><td>Register 0xF4 “ctrl_meas”</td><td>Name</td><td>Description</td></tr><tr><td>Bit 7, 6, 5</td><td>osrs_t[2:0]</td><td>Controls oversampling of temperature data. See Table 24 for settings and chapter 3.4.3 for details.</td></tr><tr><td>Bit 4, 3, 2</td><td>osrs_p[2:0]</td><td>Controls oversampling of pressure data. See Table 23 for settings and chapter 3.4.2 for details.</td></tr><tr><td>Bit 1, 0</td><td>mode[1:0]</td><td>Controls the sensor mode of the device. See Table 25 for settings and chapter 3.3 for details.</td></tr></table>

Table 23: register settings osrs\_p

<table><tr><td>osrs_p[2:0]</td><td>Pressure oversampling</td></tr><tr><td>000</td><td>Skipped (output set to 0x80000)</td></tr><tr><td>001</td><td>oversampling ×1</td></tr><tr><td>010</td><td>oversampling ×2</td></tr><tr><td>011</td><td>oversampling ×4</td></tr><tr><td>100</td><td>oversampling ×8</td></tr><tr><td>101, others</td><td>oversampling ×16</td></tr></table>

Table 24: register settings osrs\_t

<table><tr><td>osrs_t[2:0]</td><td>Temperature oversampling</td></tr><tr><td>000</td><td>Skipped (output set to 0x80000)</td></tr><tr><td>001</td><td>oversampling ×1</td></tr><tr><td>010</td><td>oversampling ×2</td></tr><tr><td>011</td><td>oversampling ×4</td></tr><tr><td>100</td><td>oversampling ×8</td></tr><tr><td>101, others</td><td>oversampling ×16</td></tr></table>

Table 25: register settings mode

<table><tr><td>mode[1:0]</td><td>Mode</td></tr><tr><td>00</td><td>Sleep mode</td></tr><tr><td>01 and 10</td><td>Forced mode</td></tr><tr><td>11</td><td>Normal mode</td></tr></table>

## 5.4.6 Register 0xF5 “config”

The “config” register sets the rate, filter and interface options of the device. Writes to the “config” register in normal mode may be ignored. In sleep mode writes are not ignored.

Table 26: Register 0xF5 “config”

<table><tr><td>Register 0xF5 “config”</td><td>Name</td><td>Description</td></tr><tr><td>Bit 7, 6, 5</td><td>t_sb[2:0]</td><td>Controls inactive duration  $t_{standby}$  in normal mode. See Table 27 for settings and chapter 3.3.4 for details.</td></tr><tr><td>Bit 4, 3, 2</td><td>filter[2:0]</td><td>Controls the time constant of the IIR filter. See Table 27 for settings and chapter 3.4.4 for details.</td></tr><tr><td>Bit 0</td><td>spi3w_en[0]</td><td>Enables 3-wire SPI interface when set to ‘1’. See chapter 6.3 for details.</td></tr></table>

Table 27: t\_sb settings

<table><tr><td>t_sb[2:0]</td><td> $t_{standby}$  [ms]</td></tr><tr><td>000</td><td>0.5</td></tr><tr><td>001</td><td>62.5</td></tr><tr><td>010</td><td>125</td></tr><tr><td>011</td><td>250</td></tr><tr><td>100</td><td>500</td></tr><tr><td>101</td><td>1000</td></tr><tr><td>110</td><td>10</td></tr><tr><td>111</td><td>20</td></tr></table>

Table 28: filter settings

<table><tr><td>filter[2:0]</td><td>Filter coefficient</td></tr><tr><td>000</td><td>Filter off</td></tr><tr><td>001</td><td>2</td></tr><tr><td>010</td><td>4</td></tr><tr><td>011</td><td>8</td></tr><tr><td>100, others</td><td>16</td></tr></table>

## 5.4.7 Register 0xF7…0xF9 “press” (\_msb, \_lsb, \_xlsb)

The “press” register contains the raw pressure measurement output data up[19:0]. For details on how to read out the pressure and temperature information from the device, please consult chapter 4.

Table 29: Register 0xF7 … 0xF9 “press”

<table><tr><td>Register 0xF7...0xF9 “press”</td><td>Name</td><td>Description</td></tr><tr><td>0xF7</td><td>press_msb[7:0]</td><td>Contains the MSB part up[19:12] of the raw pressure measurement output data.</td></tr><tr><td>0xF8</td><td>press_lsb[7:0]</td><td>Contains the LSB part up[11:4] of the raw pressure measurement output data.</td></tr><tr><td>0xF9 (bit 7, 6, 5, 4)</td><td>press_xlsb[3:0]</td><td>Contains the XLSB part up[3:0] of the raw pressure measurement output data. Contents depend on temperature resolution.</td></tr></table>

## 5.4.8 Register 0xFA…0xFC “temp” (\_msb, \_lsb, \_xlsb)

The “temp” register contains the raw temperature measurement output data ut[19:0]. For details on how to read out the pressure and temperature information from the device, please consult chapter 4.

Table 30: Register 0xFA … 0xFC “temp”

<table><tr><td>Register 0xFA...0xFC
&quot;temp&quot;</td><td>Name</td><td>Description</td></tr><tr><td>0xFA</td><td>temp_msb[7:0]</td><td>Contains the MSB part ut[19:12] of the raw temperature measurement output data.</td></tr><tr><td>0xFB</td><td>temp_lsb[7:0]</td><td>Contains the LSB part ut[11:4] of the raw temperature measurement output data.</td></tr><tr><td>0xFC (bit 7, 6, 5, 4)</td><td>temp_xlsb[3:0]</td><td>Contains the XLSB part ut[3:0] of the raw temperature measurement output data. Contents depend on pressure resolution.</td></tr></table>

## 5.4.9 Register 0xFD…0xFE “hum” (\_msb, \_lsb)

The “temp” register contains the raw temperature measurement output data ut[19:0]. For details on how to read out the pressure and temperature information from the device, please consult chapter 4.

Table 31: Register 0xFD … 0xFE “hum”

<table><tr><td>Register 0xFD...0xFE “hum”</td><td>Name</td><td>Description</td></tr><tr><td>0xFD</td><td>hum_msb[7:0]</td><td>Contains the MSB part uh[15:8] of the raw humidity measurement output data.</td></tr><tr><td>0xFE</td><td>temp_lsb[7:0]</td><td>Contains the LSB part uh[7:0] of the raw humidity measurement output data.</td></tr></table>

## 6. Digital interfaces

The BME280 supports the I²C and SPI digital interfaces; it acts as a slave for both protocols. The I²C interface supports the Standard, Fast and High Speed modes. The SPI interface supports both SPI mode $^ { \circ } 0 0 ^ { \circ } \left( \mathsf { C P O L } = \mathsf { C P H A } = ^ { \circ } 0 ^ { \circ } \right)$ and mode ‘11’ $\left( { \mathsf { C P O L } } = { \mathsf { C P H A } } = { } ^ { * } 1 ^ { \mathfrak { 3 } } \right)$ in 4-wire and 3-wire configuration.

The following transactions are supported:

• Single byte write

• multiple byte write (using pairs of register addresses and register data)

• single byte read

• multiple byte read (using a single register address which is auto-incremented)

## 6.1 Interface selection

Interface selection is done automatically based on CSB (chip select) status. If CSB is connected to VDDIO, the I²C interface is active. If CSB is pulled down, the SPI interface is activated. After CSB has been pulled down once (regardless of whether any clock cycle occurred), the I²C interface is disabled until the next power-on-reset. This is done in order to avoid inadvertently decoding SPI traffic to another slave as I²C data. Since the device startup is deferred until both $\mathsf { V } _ { \mathsf { D D } }$ and $V _ { \mathsf { D D I O } }$ are established, there is no risk of incorrect protocol detection because of the power-up sequence used. However, if I²C is to be used and CSB is not directly connected to $V _ { \mathsf { D D I O } }$ but is instead connected to a programmable pin, it must be ensured that this pin already outputs the VDDIO level during power-onreset of the device. If this is not the case, the device will be locked in SPI mode and not respond to I²C commands.

## 6.2 I²C Interface

The I²C slave interface is compatible with Philips I²C Specification version 2.1. For detailed timings, please review Table 33. All modes (standard, fast, high speed) are supported. SDA and SCL are not pure open-drain. Both pads contain ESD protection diodes to VDDIO and GND. As the devices does not perform clock stretching, the SCL structure is a high-Z input without drain capability.

![](./images/32f15bdef70df3e343c2e611913130d9502ebccaba6f916e91bf27e5af56ed55.jpg)  
Figure 8: SDI/SCK ESD drawing

The 7-bit device address is 111011x. The 6 MSB bits are fixed. The last bit is changeable by SDO value and can be changed during operation. Connecting SDO to GND results in slave address 1110110 (0x76); connection it to VDDIO results in slave address 1110111 (0x77), which is the same as

BMP280’s I²C address. The SDO pin cannot be left floating; if left floating, the I²C address will be undefined.

The I²C interface uses the following pins:

• SCK: serial clock (SCL)

• SDI: data (SDA)

• SDO: Slave address LSB (GND = ‘0’, VDDIO = ‘1’)

CSB must be connected to VDDIO to select I²C interface. SDI is bi-directional with open drain to GND: it must be externally connected to VDDIO via a pull up resistor. Refer to chapter 7 for connection instructions.

The following abbreviations will be used in the I²C protocol figures:

S Start

P Stop

• ACKS Acknowledge by slave

• ACKM Acknowledge by master

NACKM Not acknowledge by master

## 6.2.1 I²C write

Writing is done by sending the slave address in write mode (RW = ‘0’), resulting in slave address 111011X0 (‘X’ is determined by state of SDO pin. Then the master sends pairs of register addresses and register data. The transaction is ended by a stop condition. This is depicted in Figure 9.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Fb3171fe332945dc570a22f46f7398171a92526cdd0b4cdb53330dd189aea3b81.jpg)  
Figure 9: I²C multiple byte write (not auto-incremented)

## 6.2.2 I²C read

To be able to read registers, first the register address must be sent in write mode (slave address 111011X0). Then either a stop or a repeated start condition must be generated. After this the slave is addressed in read mode (RW = ‘1’) at address 111011X1, after which the slave sends out data from auto-incremented register addresses until a NOACKM and stop condition occurs. This is depicted in Figure 10, where register 0xF6 and 0xF7 are read.

<table><tr><td colspan="9"></td><td colspan="8">Control byte</td></tr><tr><td>Start</td><td colspan="7">Slave Address</td><td>RW</td><td>ACKS</td><td colspan="7">Register address (F6h)</td></tr><tr><td>S</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>1</td><td>X</td><td>0</td><td></td><td>1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>1</td></tr></table>

<table><tr><td rowspan="2">Start</td><td rowspan="2" colspan="7">Slave Address</td><td rowspan="2">RW</td><td rowspan="2">ACKS</td><td colspan="7">Data byte</td><td></td><td colspan="8">Data byte</td><td colspan="2"></td><td></td></tr><tr><td colspan="7">Register data - address F6h</td><td>ACKM</td><td colspan="8">Register data - address F7h</td><td>NOACKM</td><td>Stop</td><td></td></tr><tr><td>S</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>1</td><td>X</td><td>1</td><td></td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td></td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td></td><td>P</td></tr></table>

Figure 10: I²C multiple byte read

## 6.3 SPI interface

The SPI interface is compatible with SPI mode ‘00’ (CPOL = CPHA = ‘0’) and mode ‘11’ (CPOL = CPHA = ‘1’). The automatic selection between mode ‘00’ and ‘11’ is determined by the value of SCK after the CSB falling edge.

The SPI interface has two modes: 4-wire and 3-wire. The protocol is the same for both. The 3-wire mode is selected by setting ‘1’ to the register spi3w\_en. The pad SDI is used as a data pad in 3-wire mode.

The SPI interface uses the following pins:

• CSB: chip select, active low

• SCK: serial clock

• SDI: serial data input; data input/output in 3-wire mode

• SDO: serial data output; hi-Z in 3-wire mode

Refer to chapter 7 for connection instructions.

CSB is active low and has an integrated pull-up resistor. Data on SDI is latched by the device at SCK rising edge and SDO is changed at SCK falling edge. Communication starts when CSB goes to low and stops when CSB goes to high; during these transitions on CSB, SCK must be stable. The SPI protocol is shown in Figure 11. For timing details, please review Table 34.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Fe2171baa4ea52d35235be8848ccfc5b20e84efd52bad502934df97b90c59a6b5.jpg)  
Figure 11: SPI protocol (shown for mode ‘11’ in 4-wire configuration)

In SPI mode, only 7 bits of the register addresses are used; the MSB of register address is not used and replaced by a read/write bit $( \mathsf { R W } = { } ^ { \circ } 0 ^ { \circ }$ for write and RW = ‘1’ for read).

Example: address 0xF7 is accessed by using SPI register address 0x77. For write access, the byte 0x77 is transferred, for read access, the byte 0xF7 is transferred.

## 6.3.1 SPI write

Writing is done by lowering CSB and sending pairs control bytes and register data. The control bytes consist of the SPI register address (= full register address without bit 7) and the write command (bit7 = RW = ‘0’). Several pairs can be written without raising CSB. The transaction is ended by a raising CSB. The SPI write protocol is depicted in Figure 12.

<table><tr><td></td><td colspan="8">Control byte</td><td colspan="9">Data byte</td><td colspan="7">Control byte</td><td colspan="8">Data byte</td><td></td></tr><tr><td>Start</td><td>RW</td><td colspan="7">Register address (F4h)</td><td colspan="9">Data register - address F4h</td><td>RW</td><td colspan="7">Register address (F5h)</td><td colspan="7">Data register - adress F5h</td><td>Stop</td></tr><tr><td>CSB=0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td>0</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td>CSB=1</td></tr></table>

Figure 12: SPI multiple byte write (not auto-incremented)

## 6.3.2 SPI read

Reading is done by lowering CSB and first sending one control byte. The control bytes consist of the SPI register address (= full register address without bit 7) and the read command (bit 7 = RW = ‘1’). After writing the control byte, data is sent out of the SDO pin (SDI in 3-wire mode); the register address is automatically incremented. The SPI read protocol is depicted in Figure 13.

<table><tr><td></td><td colspan="8">Control byte</td><td colspan="8">Data byte</td><td colspan="8">Data byte</td><td></td></tr><tr><td>Start</td><td>RW</td><td colspan="7">Register address (F6h)</td><td colspan="8">Data register - address F6h</td><td colspan="8">Data register - address F7h</td><td>Stop</td></tr><tr><td>CSB=0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>0</td><td>1</td><td>1</td><td>0</td><td>bit15</td><td>bit14</td><td>bit13</td><td>bit12</td><td>bit11</td><td>bit10</td><td>bit9</td><td>bit8</td><td>bit7</td><td>bit6</td><td>bit5</td><td>bit4</td><td>bit3</td><td>bit2</td><td>bit1</td><td>bit0</td><td>CSB=1</td></tr></table>

Figure 13: SPI multiple byte read

## 6.4 Interface parameter specification

## 6.4.1 General interface parameters

The general interface parameters are given in Table 32 below.

Table 32: interface parameters

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td>Input low level</td><td> $V_{il\_si}$ </td><td> $V_{DDIO}=1.2 V to 3.6 V$ </td><td></td><td></td><td>20</td><td>% $V_{DDI}$ o</td></tr><tr><td>Input high level</td><td> $V_{ih\_si}$ </td><td> $V_{DDIO}=1.2 V to 3.6 V$ </td><td>80</td><td></td><td></td><td>% $V_{DDI}$ o</td></tr><tr><td>Output low level  $I^{2}C$ </td><td> $V_{ol\_SDI}$ </td><td> $V_{DDIO}=1.62 V, I_{ol}=3 mA$ </td><td></td><td></td><td>20</td><td>% $V_{DDI}$ o</td></tr><tr><td>Output low level  $I^{2}C$ </td><td> $V_{ol\_SDI\_1.2}$ </td><td> $V_{DDIO}=1.20 V, I_{ol}=3 mA$ </td><td></td><td></td><td>23</td><td>% $V_{DDI}$ o</td></tr><tr><td>Output low level SPI</td><td> $V_{ol\_SDO}$ </td><td> $V_{DDIO}=1.62 V, I_{ol}=1 mA$ </td><td></td><td></td><td>20</td><td>% $V_{DDI}$ o</td></tr><tr><td>Output low level SPI</td><td> $V_{ol\_SDO\_1.2}$ </td><td> $V_{DDIO}=1.20 V, I_{ol}=1 mA$ </td><td></td><td></td><td>23</td><td>% $V_{DDI}$ o</td></tr><tr><td>Output high level</td><td> $V_{oh}$ </td><td> $V_{DDIO}=1.62 V, I_{oh}=1 mA(SDO, SDI)$ </td><td>80</td><td></td><td></td><td>% $V_{DDI}$ o</td></tr><tr><td>Output high level</td><td> $V_{oh\_1.2}$ </td><td> $V_{DDIO}=1.20 V, I_{oh}=1 mA(SDO, SDI)$ </td><td>60</td><td></td><td></td><td>% $V_{DDI}$ o</td></tr><tr><td>Pull-up resistor</td><td> $R_{pull}$ </td><td>Internal CSB pull-up resistance to  $V_{DDIO}$ </td><td>70</td><td>120</td><td>190</td><td>kΩ</td></tr><tr><td> $I^{2}C bus load capacitor$ </td><td> $C_b$ </td><td>On SDI and SCK</td><td></td><td></td><td>400</td><td>pF</td></tr></table>

## 6.4.2 I²C timings

For I²C timings, the following abbreviations are used:

• “S&F mode” = standard and fast mode

• “HS mode” = high speed mode

• Cb = bus capacitance on SDA line

All other naming refers to I²C specification 2.1 (January 2000).

The I²C timing diagram is in Figure 14. The corresponding values are given in Table 33.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F995fe66861fb6b0f07556ff0d7df4dba5317c5db16cf8a30665ba48383753f4b.jpg)  
Figure 14: I²C timing diagram

Table 33: I²C timings

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td>SDI setup time</td><td> $t_{SU;DAT}$ </td><td>S&amp;F ModeHS mode</td><td>16030</td><td></td><td></td><td>nsns</td></tr><tr><td>SDI hold time</td><td> $t_{HD;DAT}$ </td><td>S&amp;F Mode,  $C_b\leq 100$  pFS&amp;F Mode,  $C_b\leq 400$  pFHS mode,  $C_b\leq 100$  pFHS mode,  $C_b\leq 400$  pF</td><td>80901824</td><td></td><td>115150</td><td>nsnsns</td></tr><tr><td>SCK low pulse</td><td> $t_{LOW}$ </td><td>HS mode,  $C_b\leq 100$  pF $V_{DDIO}=1.62 V$ </td><td>160</td><td></td><td></td><td>ns</td></tr><tr><td>SCK low pulse</td><td> $t_{LOW}$ </td><td>HS mode,  $C_b\leq 100$  pF $V_{DDIO}=1.2 V$ </td><td>210</td><td></td><td></td><td>ns</td></tr></table>

The above-mentioned I2C specific timings correspond to the following internal added delays:  
Input delay between SDI and SCK inputs: SDI is more delayed than SCK by typically 100 ns in Standard and Fast Modes and by typically 20 ns in High Speed Mode.

Output delay from SCK falling edge to SDI output propagation is typically 140 ns in Standard and Fast Modes and typically 70 ns in High Speed Mode.

## 6.4.3 SPI timings

The SPI timing diagram is in Figure 15, while the corresponding values are given in Table 34. All timings apply both to 4- and 3-wire SPI.

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F4ff20b3bd5a7a74970d9ebcc10d6a62e3a0c48788c55bcf6dbd9337aaa9cb4a0.jpg)  
Figure 15: SPI timing diagram

Table 34: SPI timings

<table><tr><td>Parameter</td><td>Symbol</td><td>Condition</td><td>Min</td><td>Typ</td><td>Max</td><td>Unit</td></tr><tr><td>SPI clock input frequency</td><td>F_spi</td><td></td><td>0</td><td></td><td>10</td><td>MHz</td></tr><tr><td>SCK low pulse</td><td>T_low_sck</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr><tr><td>SCK high pulse</td><td>T_high_sck</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr><tr><td>SDI setup time</td><td>T_setup_sdi</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr><tr><td>SDI hold time</td><td>T_hold_sdi</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr><tr><td>SDO output delay</td><td>T_delay_sdo</td><td>25 pF load,  $V_{DDIO}$ =1.6 V min</td><td></td><td></td><td>30</td><td>ns</td></tr><tr><td>SDO output delay</td><td>T_delay_sdo</td><td>25 pF load,  $V_{DDIO}$ =1.2 V min</td><td></td><td></td><td>40</td><td>ns</td></tr><tr><td>CSB setup time</td><td>T_setup_csb</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr><tr><td>CSB hold time</td><td>T_hold_csb</td><td></td><td>20</td><td></td><td></td><td>ns</td></tr></table>

## 7. Pin-out and connection diagram

## 7.1 Pin-out

![](./images/752fe0b46d223e6a199349432d491e3f2d1646af666f0cf71d4e5570d3a98263.jpg)  
Figure 16: Pin-out top and bottom view  
Note: The pin numbering of BME280 is performed in the untypical clockwise direction when seen in top view and counter-clockwise when seen in bottom view.

Table 35: Pin description

<table><tr><td rowspan="2">Pin</td><td rowspan="2">Name</td><td rowspan="2">I/O Type</td><td rowspan="2">Description</td><td colspan="3">Connect to</td></tr><tr><td>SPI 4W</td><td>SPI 3W</td><td> $I^2C$ </td></tr><tr><td>1</td><td>GND</td><td>Supply</td><td>Ground</td><td colspan="3">GND</td></tr><tr><td>2</td><td>CSB</td><td>In</td><td>Chip select</td><td>CSB</td><td>CSB</td><td> $V_{DDIO}$ </td></tr><tr><td>3</td><td>SDI</td><td>In/Out</td><td>Serial data input</td><td>SDI</td><td>SDI/SDO</td><td>SDA</td></tr><tr><td>4</td><td>SCK</td><td>In</td><td>Serial clock input</td><td>SCK</td><td>SCK</td><td>SCL</td></tr><tr><td>5</td><td>SDO</td><td>In/Out</td><td>Serial data output</td><td>SDO</td><td>DNC</td><td>GND for default address</td></tr><tr><td>6</td><td> $V_{DDIO}$ </td><td>Supply</td><td>Digital / Interface supply</td><td colspan="3"> $V_{DDIO}$ </td></tr><tr><td>7</td><td>GND</td><td>Supply</td><td>Ground</td><td colspan="3">GND</td></tr><tr><td>8</td><td> $V_{DD}$ </td><td>Supply</td><td>Analog supply</td><td colspan="3"> $V_{DD}$ </td></tr></table>

## 7.2 Connection diagram ${ \mathsf { I } } ^ { 2 } { \mathsf { C } }$

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Fbb25cd25be4746b8e8f9e28342dfd8ecc8f2d421a002166593d8a1ad24e663df.jpg)  
Figure 17: I²C connection diagram

Notes:

• The recommended value for $\mathsf C _ { 1 } , \mathsf C _ { 2 }$ is 100 nF

• The value for the pull-up resistors $\mathsf { R } _ { 1 } ,$ R2 should be based on the interface timing and the bus load; a normal value is $4 . 7$ kΩ

• A direct connection between CSB and VDDIO is required

## 7.3 Connection diagram 4-wire SPI

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2Fd76a53bd1ab4353dba2b8712a02c709d2ad0f55ae16769e024f802d0cea229a9.jpg)  
Figure 18: 4-wire SPI connection diagram

Note: The recommended value for $\mathsf C _ { 1 } , \mathsf C _ { 2 }$ is 100 nF

## 7.4 Connection diagram 3-wire SPI

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F17bcaa1a5f7c6538f3595fbfc841f039d965223adce9bb1bb01520a2707308c7.jpg)  
Figure 19: 3-wire SPI connection diagram

Note: The recommended value for C1, C2 is 100 nF

## 7.5 Package dimensions

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F10ffc2ebaa7291bd0c027a2440c20d4ddca9b17ca9fdf37b0f3d1db42adda803.jpg)

<table><tr><td colspan="2">PACKAGE TYPECAVITY MEMS</td><td>BODY X2.50</td><td>BODY Y2.50</td><td>BODY Z1.00(MAX)</td></tr><tr><td>LGA PITCH0.65</td><td colspan="2">LGA SIZE0.350×0.350</td><td>LGA COUNT8</td><td>BALL MATRIXN/A</td></tr></table>

Figure 20: Package dimensions for top, bottom and side view

## 7.6 Landing pattern recommendation

For the design of the landing pattern, the following dimensioning is recommended:

![](./images/73f12f000043c23a25b787ffc8697b8c8650ab2f8fe3ae42bc7be5237bfa461e.jpg)  
Figure 21: Recommended landing pattern (top view)

Note: red areas demark exposed PCB metal pads.

In case of a solder mask defined (SMD) PCB process, the land dimensions should be defined by solder mask openings. The underlying metal pads are larger than these openings.

In case of a non solder mask defined (NSMD) PCB process, the land dimensions should be defined in the metal layer. The mask openings are larger than these metal pads.

## 7.7 Marking

## 7.7.1 Mass production devices

Table 36: Marking of mass production parts

<table><tr><td>Marking</td><td>Symbol</td><td>Description</td></tr><tr><td rowspan="3">Vent hole 5 6 7 8CCC O TL Pin 1 marker</td><td>CCC</td><td>Lot counter: 3 alphanumeric digits, variable to generate mass production trace-code</td></tr><tr><td>T</td><td>Product number: 1 alphanumeric digit, fixed to identify product type, T = “U” “U” is associated with the product BME280 (part number 0 273 141 185)</td></tr><tr><td>L</td><td>Sub-contractor ID: 1 alphanumeric digit, variable to identify sub-contractor (L = “P”)</td></tr></table>

## 7.7.2 Engineering samples

Table 37: Marking of engineering samples

<table><tr><td>Marking</td><td>Symbol</td><td>Description</td></tr><tr><td rowspan="3"><img src="./images/0c9de42cd627a748dac6312ce7541fd9ceb1403d5cabd98e2e7267ecced15fc6.jpg"/></td><td>XX</td><td>Sample ID: 2 alphanumeric digits, variable to generate trace-code</td></tr><tr><td>N</td><td>Eng. Sample ID: 1 alphanumeric digit, fixed to identify engineering sample, N = “*” or “e” or “E”</td></tr><tr><td>CC</td><td>Counter ID: 2 alphanumeric digits, variable to generate trace-code</td></tr></table>

## 7.8 Soldering guidelines and reconditioning recommendations

The moisture sensitivity level of the BME280 sensors corresponds to JEDEC Level 1, see also:

• IPC/JEDEC J-STD-020C “Joint Industry Standard: Moisture/Reflow Sensitivity Classification for non-hermetic Solid State Surface Mount Devices”

• IPC/JEDEC J-STD-033A “Joint Industry Standard: Handling, Packing, Shipping and Use of Moisture/Reflow Sensitive Surface Mount Devices”.

The sensor fulfils the lead-free soldering requirements of the above-mentioned IPC/JEDEC standard, i.e. reflow soldering with a peak temperature up to $2 6 0 ^ { \circ } \mathsf { C }$ . The minimum height of the solder after reflow shall be at least 50µm. This is required for good mechanical decoupling between the sensor device and the printed circuit board (PCB).

<table><tr><td>Profile Feature</td><td></td><td>Pb-Free Assembly</td></tr><tr><td>Average Ramp-Up Rate (Tsmax to Tp)</td><td></td><td>3°C/second max.</td></tr><tr><td>Preheat- Temperature Min (Tsmin)- Temperature Max (Tsmax)- Time (tsmin to tsmax)</td><td></td><td>150 °C200 °C60-180 seconds</td></tr><tr><td>Time maintained above:- Temperature (TL)- Time (tL)</td><td></td><td>217 °C60-150 seconds</td></tr><tr><td>Peak/Classification Temperature (Tp)</td><td></td><td>260 °C</td></tr><tr><td>Time within 5 °C of actual Peak Temperature (tp)</td><td></td><td>20-40 seconds</td></tr><tr><td>Ramp-Down Rate</td><td></td><td>6 °C/second max.</td></tr><tr><td>Time 25 °C to Peak Temperature</td><td></td><td>8 minutes max.</td></tr></table>

Note 1: All temperatures refer to topside of the package, measured on the package body surface

![](./images/96a2a700274e1ee569962f8560aeb813d69d68f134d848c4b3d738e37b60ae9a.jpg)  
Figure 22: Soldering profile

## 7.9 Reconditioning Procedure

After exposing the device to operating conditions, which exceed the limits specified in section 1.2, e.g. after reflow, the humidity sensor may possess an additional offset. Therefore the following reconditioning procedure is mandatory to restore the calibration state:

1. Dry-Baking:

2. Re-Hydration:

120 °C at <5% rH for 2 h

70 °C at 75% rH for 6 h

or alternatively

1. Dry-Baking:

2. Re-Hydration:

120 °C at <5% rH for 2 h 25 °C at 75% rH for 24 h

or alternatively after solder reflow only

1. Do not perform Dry-Baking

2. Ambient Re-Hydration: \~25 °C at >40% rH for >5d

## 7.10 Tape and reel specification

## 7.10.1 Dimensions

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F6f1fe62da10e48eb75605987384f5d404bd5e96d99d18cd3a7a2074022917abe.jpg)  
Figure 23: Tape and Reel dimensions

Quantity per reel: 10 kpcs.

## 7.10.2 Orientation within the reel

![](https://www.embedr.app/api/datasheets/ds_4a074a6167dd949e3ba6/asset?path=images%2F47ba5300d2aa6d0eed17c0554102a2a762c800f3b1bae298bbad8a5f9ac6a3e2.jpg)  
Figure 24: Orientation within tape

## 7.11 Mounting and assembly recommendations

In order to achieve the specified performance for you design, the following recommendations and the “Handling, soldering & mounting instructions BME280” should be taken into consideration when mounting a pressure sensor on a printed-circuit board (PCB):

• The clearance above the metal lid shall be 0.1mm at minimum.

• For the device housing appropriate venting needs to be provided in case the ambient pressure shall be measured.

• Liquids shall not come into direct contact with the device.

During operation the sensor chip is sensitive to light, which can influence the accuracy of the measurement (photo-current of silicon). The position of the vent hole minimizes the light exposure of the sensor chip. Nevertheless, Bosch Sensortec recommends avoiding the exposure of BME280 to strong light sources.

Soldering may not be done using vapor phase processes since the sensor will be damaged by the liquids used in these processes.

## 7.12 Environmental safety

## 7.12.1 RoHS

The BME280 sensor meets the requirements of the EC restriction of hazardous substances (RoHS) directive, see also:

RoHS–Directive 2011/65/EU and its amendments, including the amendment 2015/863/EU on the restriction of the use of certain hazardous substances in electrical and electronic equipment.

## 7.12.2 Halogen content

The BME280 is halogen-free. For more details on the analysis results please contact your Bosch Sensortec representative.

## 7.12.3 Internal package structure

Within the scope of Bosch Sensortec’s ambition to improve its products and secure the mass product supply, Bosch Sensortec qualifies additional sources (e.g. 2nd source) for the package of the BME280.

While Bosch Sensortec took care that all of the technical packages parameters are described above are 100% identical for all sources, there can be differences in the chemical content and the interna structural between the different package sources.

However, as secured by the extensive product qualification process of Bosch Sensortec, this has no impact to the usage or to the quality of the BME280 product.

## 8. Appendix A: Alternative compensation formulas

## 8.1 Compensation formulas in double precision floating point

Please note that it is strongly advised to use the API available from Bosch Sensortec to perform readout and compensation. If this is not wanted, the code below can be applied at the user’s risk. Both pressure and temperature values are expected to be received in 20 bit format, positive, stored in a 32 bit signed integer. Humidity is expected to be received in 16 bit format, positive, stored in a 32 bit signed integer.

The variable t\_fine (signed 32 bit) carries a fine resolution temperature value over to the pressure compensation formula and could be implemented as a global variable.

The data type “BME280\_S32\_t” should define a 32 bit signed integer variable type and could usually be defined as “long signed int”. The revision of the code is rev. 1.1 (pressure and temperature) and rev. 1.0 (humidity).

Compensating the measurement value with double precision gives the best possible accuracy but is only recommended for PC applications.

```c
// Returns temperature in DegC, double precision. Output value of "51.23" equals 51.23 DegC.
// t_fine carries fine temperature as global value
BME280_S32_t t_fine;
double BME280_compensate_T_double(BME280_S32_t adc_T)
{
    double var1, var2, T;
    var1 = (((double)adc_T)/16384.0 - ((double)dig_T1)/1024.0) * ((double)dig_T2);
    var2 = (((double)adc_T)/131072.0 - ((double)dig_T1)/8192.0) *
    (((double)adc_T)/131072.0 - ((double) dig_T1)/8192.0)) * ((double)dig_T3);
    t_fine = (BME280_S32_t)(var1 + var2);
    T = (var1 + var2) / 5120.0;
    return T;
}
// Returns pressure in Pa as double. Output value of "96386.2" equals 96386.2 Pa = 963.862 hPa
double BME280_compensate_P_double(BME280_S32_t adc_P)
{
    double var1, var2, p;
    var1 = ((double)t_fine/2.0) - 64000.0;
    var2 = var1 * var1 * ((double)dig_P6) / 32768.0;
    var2 = var2 + var1 * ((double)dig_P5) * 2.0;
    var2 = (var2/4.0)+(((double)dig_P4) * 65536.0);
    var1 = (((double)dig_P3) * var1 * var1 / 524288.0 + ((double)dig_P2) * var1) / 524288.0;
    var1 = (1.0 + var1 / 32768.0)*(double)dig_P1);
    if (var1 == 0.0)
    {
    return 0; // avoid exception caused by division by zero
    }
    p = 1048576.0 - (double)adc_P;
    p = (p - (var2 / 4096.0)) * 6250.0 / var1;
    var1 = ((double)dig_P9) * p * p / 2147483648.0;
    var2 = p * ((double)dig_P8) / 32768.0;
    p = p + (var1 + var2 + ((double)dig_P7)) / 16.0;
    return p;
}
// Returns humidity in %rH as as double. Output value of "46.332" represents
46.332 %rH
double bme280_compensate_H_double(BME280_S32_t adc_H);
{
    double var_H;

    var_H = (((double)t_fine) - 76800.0);
    var_H = (adc_H - (((double)dig_H4) * 64.0 + ((double)dig_H5) / 16384.0 * var_H)) * (((double)dig_H2) / 65536.0 * (1.0 + ((double)dig_H6) / 67108864.0 * var_H *) (1.0 + ((double)dig_H3) / 67108864.0 * var_H));
    var_H = var_H * (1.0 - ((double)dig_H1) * var_H / 524288.0);

    if (var_H > 100.0)
    var_H = 100.0;
    else if (var_H < 0.0)
    var_H = 0.0;
return var_H;
}
```

## 8.2 Pressure compensation in 32 bit fixed point

Please note that it is strongly advised to use the API available from Bosch Sensortec to perform readout and compensation. If this is not wanted, the code below can be applied at the user’s risk. Both pressure and temperature values are expected to be received in 20 bit format, positive, stored in a 32 bit signed integer.

The variable t\_fine (signed 32 bit) carries a fine resolution temperature value over to the pressure compensation formula and could be implemented as a global variable.

The data type “BME280\_S32\_t” should define a 32 bit signed integer variable type and can usually be defined as “long signed int”.

The data type “BME280\_U32\_t” should define a 32 bit unsigned integer variable type and can usually be defined as “long unsigned int”.

Compensating the pressure value with 32 bit integer has an accuracy of typically 1 Pa (1-sigma). At high filter levels this adds a significant amount of noise to the output values and reduces their resolution.

```c
// Returns temperature in DegC, resolution is 0.01 DegC. Output value of "5123" equals 51.23
DegC.
// t_fine carries fine temperature as global value
BME280_S32_t t_fine;
BME280_S32_t BME280_compensate_T_int32(BME280_S32_t adc_T)
{
    BME280_S32_t var1, var2, T;
    var1 = ((((adc_T>>3) - ((BME280_S32_t)dig_T1<<1))) * ((BME280_S32_t)dig_T2)) >> 11;
    var2 = (((((adc_T>>4) - ((BME280_S32_t)dig_T1)) * ((adc_T>>4) - ((BME280_S32_t)dig_T1)))
>> 12) *
    ((BME280_S32_t)dig_T3)) >> 14;
    t_fine = var1 + var2;
    T = (t_fine * 5 + 128) >> 8;
    return T;
}

// Returns pressure in Pa as unsigned 32 bit integer. Output value of "96386" equals 96386 Pa = 963.86 hPa
BME280_U32_t BME280_compensate_P_int32(BME280_S32_t adc_P)
{
    BME280_S32_t var1, var2;
    BME280_U32_t p;
    var1 = (((BME280_S32_t)t_fine)>>1) - (BME280_S32_t)64000;
    var2 = (((var1>>2) * (var1>>2)) >> 11) * ((BME280_S32_t)dig_P6);
    var2 = var2 + ((var1*((BME280_S32_t)dig_P5))<<1);
    var2 = (var2>>2)+(((BME280_S32_t)dig_P4)<<16);
    var1 = (((dig_P3 * (((var1>>2) * (var1>>2)) >> 13)) >> 3) + (((BME280_S32_t)dig_P2) * var1)>>1))>>18;
    var1 = (((32768+var1))*((BME280_S32_t)dig_P1))>>15);
    if (var1 == 0)
    {
    return 0; // avoid exception caused by division by zero
    }
    p = (((BME280_U32_t)((BME280_S32_t)1048576)-adc_P)-(var2>>12)))*3125;
    if (p < 0x80000000)
    {
    p = (p << 1) / ((BME280_U32_t)var1);
    }
    else
    {
    p = (p / (BME280_U32_t)var1) * 2;
    }
    var1 = (((BME280_S32_t)dig_P9) * ((BME280_S32_t)((p>>3) * (p>>3))>>13))>>12;
    var2 = (((BME280_S32_t)(p>>2)) * ((BME280_S32_t)dig_P8))>>13;
    p = (BME280_U32_t)((BME280_S32_t)p + ((var1 + var2 + dig_P7) >> 4));
    return p;
}
```

## 9. Appendix B: Measurement time and current calculation

In this chapter, formulas are given to calculate measurement rate, filter bandwidth and current consumption in different settings.

## 9.1 Measurement time

The active measurement time depends on the selected values for humidity, temperature and pressure oversampling and can be calculated in milliseconds using the formulas below.

$$
\begin{array}{r} t _ {m e a s u r e, t y p} = 1 + [ 2 \cdot T _ {-} o v e r s a m p l i n g ] _ {o s r s _ {-} t \neq 0} + [ 2 \cdot P _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} p \neq 0} \\ + [ 2 \cdot H _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} h \neq 0} \end{array}
$$

$$
\begin{array}{c} t _ {m e a s u r e, m a x} = 1. 2 5 + [ 2. 3 \cdot T _ {-} o v e r s a m p l i n g ] _ {o s r s _ {-} t \neq 0} + [ 2. 3 \cdot P _ {-} o v e r s a m p l i n g + 0. 5 7 5 ] _ {o s r s _ {-} p \neq 0} \\ + [ 2. 3 \cdot H _ {-} o v e r s a m p l i n g + 0. 5 7 5 ] _ {o s r s _ {-} h \neq 0} \end{array}
$$

For example, using temperature oversampling ×1, pressure oversampling ×4 and no humidity measurement, the measurement time is:

$$
t _ {m e a s u r e, t y p} = 1 + [ 2 \cdot 1 ] + [ 2 \cdot 4 + 0. 5 ] + [ 0 ] = 1 1. 5 \mathrm{ms}
$$

$$
t _ {m e a s u r e, m a x} = 1. 2 5 + [ 2. 3 \cdot 1 ] + [ 2. 3 \cdot 4 + 0. 5 7 5 ] + [ 0 ] = 1 3. 3 2 5 \mathrm{ms}
$$

## 9.2 Measurement rate in forced mode

In forced mode, the measurement rate depends on the rate at which it is forced by the master. The highest possible frequency in Hz can be calculated as:

$$
O D R _ {m a x, f o r c e d} = \frac {1 0 0 0}{t _ {m e a s u r e}}
$$

If measurements are forced faster than they can be executed, the data rate saturates at the attainable data rate. For the example above with 11.5 ms measurement time, the typically achievable output data rate would be:

$$
O D R _ {m a x, f o r c e d} = \frac {1 0 0 0}{1 1 . 5} = 8 7 \mathrm{Hz}
$$

## 9.3 Measurement rate in normal mode

The measurement rate in normal mode depends on the measurement time and the standby time and can be calculated in Hz using the following formula:

$$
O D R _ {n o r m a l \_ m o d e} = \frac {1 0 0 0}{t _ {m e a s u r e} + t _ {s t a n d b y}}
$$

The accuracy of tstandby is described in the specification parameter Δtstandby. For the example above with 11.5 ms measurement time, setting normal mode with a standby time of 62.5 ms would result in a data rate of:

$$
O D R _ {n o r m a l \_ m o d e} = \frac {1 0 0 0}{1 1 . 5 + 6 2 . 5} = 1 3. 5 1 \mathrm{Hz}
$$

## 9.4 Response time using IIR filter

When using the IIR filter, the response time of the sensor depends on the selected filter coefficient and the data rate used. It can be calculated using the following formula:

$$
t _ {r e s p o n s e, 75 \%} = \frac {1000 \cdot n _ {s a m p l e s , 75 \%}}{O D R}
$$

For the example above with a data rate of 13.51 Hz, the user could select a filter coefficient of 8. According to Table 6, the number of samples needed to reach 75% of a step response using this filter setting is 11. The response time with filter is therefore:

$$
t _ {r e s p o n s e, 75 \%} = \frac {1000 \cdot 11}{13.51} = 814 \mathrm{ms}
$$

## 9.5 Current consumption

The current consumption depends on the selected oversampling settings, the measurement rate and the sensor mode, but not on the IIR filter setting. It can be calculated as:

$$
\begin{array}{r l} & I _ {D D, f o r c e d} = I _ {D D S L} \cdot (1 - t _ {m e a s u r e} \cdot O D R) + \frac {O D R}{1 0 0 0} \\ & \qquad \cdot (2 0 5 + I _ {D D T} \cdot [ 2 \cdot T _ {-} o v e r s a m p l i n g ] _ {o s r s _ {-} t \neq 0} + I _ {D D P} \cdot [ 2 \cdot P _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} p \neq 0} \\ & \qquad + I _ {D D H} \cdot [ 2 \cdot H _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} h \neq 0}) \end{array}
$$

$$
\begin{array}{r l} & I _ {D D, n o r m a l} = I _ {D D S B} \cdot (1 - t _ {m e a s u r e} \cdot O D R) + \frac {O D R}{1 0 0 0} \\ & \qquad \cdot \left(2 0 5 + I _ {D D T} \cdot [ 2 \cdot T _ {-} o v e r s a m p l i n g ] _ {o s r s _ {-} t \neq 0} + I _ {D D P} \cdot [ 2 \cdot P _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} p \neq 0} \right. \\ & \qquad \left. + I _ {D D H} \cdot [ 2 \cdot H _ {-} o v e r s a m p l i n g + 0. 5 ] _ {o s r s _ {-} h \neq 0}\right) \end{array}
$$

Note that the only difference between forced and normal mode current consumption is that the current for the inactive time is either IDDSL or IDDSB. For the example above, the current would be

$$
\begin{array}{r l} & I _ {D D, n o r m a l} = 0. 2 \cdot (1 - 0. 0 1 1 5 \cdot 1 3. 5 1) + \frac {1 3 . 5 1}{1 0 0 0} (2 0 5 + 3 5 0 \cdot [ 2 \cdot 1 ] + 7 1 4 \cdot [ 2 \cdot 4 + 0. 5 ] + [ 0 ]) \\ & \qquad = 0. 2 \cdot (0. 8 4 5) + \frac {1 3 . 5 1}{1 0 0 0} (2 0 5 + 7 0 0 + 6 0 6 9 + 0) \\ & \qquad = 0. 2 + 9 4. 2 = 9 4. 4 \mu \mathrm{A} \end{array}
$$

## 10. Self test

The following chapter provides an explanation to the self-test code for the Bosch Sensortec BME280. The code itself refers to the API (Application Programming Interface) of the sensor, which can be obtained from Bosch Sensortec and is also included in this release package.

## 10.1 Self-test flow

The self-test starts by performing a soft reset of the device. After this, Chip-ID and trimming data are read and verified. Then temperature and pressure are measured and compared against customisable plausibility limits. A flow chart is given below.

![](./images/a9dc0a1da084bea02620be905af9b355f687afdc096ba4e7b9dcbba2f2945b91.jpg)  
Figure 25: Self-test flow chart

## 10.2 Function return codes

A list of the possible function return codes can be found below.

0 Sensor OK

10 Communication error or wrong device found

20 Trimming data out of bound

30 Temperature bond wire failure or MEMS defect

31 Pressure bond wire failure or MEMS defect

40 Implausible temperature (default limits: 0…40°C)

41 Implausible pressure (default limits: 900…1100 hPa)

42 Implausible humidity (default limits: 20...80 %rH)

Error testing is done in ascending error code sequence. This means that if e.g. a trimming data error is detected (code 20), the temperature plausibility (code 40) is not checked anymore. Instead, error code 20 is returned and no others tests are performed.

## 10.3 Usage

## 10.3.1 File and function pointer integration

 Include bme280.c in your programming environment and add the path to the compiler.

 Include bme280\_selftest.c in your programming environment and add the path to the compiler.

 Modify the lines with read/write function pointer to match your system. Sample functions are given in chapter 10.5:

```c
bme280.bus_read = BME280_I2C_bus_read; // must be defined by customer
bme280.bus_write = BME280_I2C_bus_write; // must be defined by customer
bme280.delay_msec = BME280_delay_msec; // must be defined by customer
```

 If necessary, adapt the measurement plausibility limits in bme280\_selftest.h. The default limits are 0…40°C for temperature and 900…1100 hPa for pressure measurement.

 If you are using I²C communication with the address 0x77 (SDO pin high), then change the BME280.h line

```c
#define BME280_I2C_ADDRESS    BME280_I2C_ADDRESS1
into
#define BME280_I2C_ADDRESS    BME280_I2C_ADDRESS2
```

## 10.3.2 Function call

Call the self test function using:

```c
unsigned char testresult;
testresult = bme280_selftest();
```

A test result of 0 indicates no error. The other return codes are detailed in chapter 10.2.

## 10.3.3 Test time and interface requirements

The self test uses a total wait time of 9 milliseconds. Of this, 2 milliseconds are used as wait time for soft reset and 7 milliseconds are used as wait time for conversion. The soft reset is performed in order to erase any possible old settings and could be omitted if the sensor is known to be in an untouched state after power on.

In the self test function, 4 write commands and 6 read commands are issued. In total, 4 bytes are written and 34 bytes are read. Assuming burst read is used, the following time duration can be expected for communication including overhead:

 6.0 ms for I²C at 100 kHz

 1.5 ms for I²C at 400 kHz

 0.5 ms for SPI at 1 MHz

Assuming a 400 kHz I²C interface with burst reads, the total function run time therefore equals 10.5 milliseconds.

## 10.4 Function explanation

## 10.4.1 Communication test

This function attempts to read the Chip ID. If it is correct, a functioning communication is assumed. Note that the write function functionality is not explicitly tested.

## 10.4.2 Bond wire test

A pressure and temperature measurement is performed and uncompensated pressure and temperature values are read out. If the measurement results are clipped to the respective minimum or maximum ADC values, this is usually caused by defective bond wires. However, a defective sensing element could also cause this test to fail.

Please note that some combinations of bond wire or sensing element defects do not result in clipping of the measurement value and will therefore not be detected with this test. These cases can be detected by the plausibility test instead.

## 10.4.3 Measurement plausibility test

The pressure and temperature values read out previously are compensated using the read out compensation parameters. The compensated temperature and pressure is compared against plausibility limits set in bme280\_selftest.h, which must be set to match the customer production environment. Please use the the plausibility limits as described in chapter 3.

## 10.5 Sample read, write and delay function

Below some samples read, write and delay functions are given. These are platform dependant and should only give an idea of how the functions could look.

```c
signed char BME280_I2C_bus_read(unsigned char device_addr, unsigned char reg_addr, unsigned char *reg_data, unsigned char cnt)
{
    int iError=0;
    unsigned char array[I2C_BUFFER_LEN];
    unsigned char stringpos;
    array[0] = reg_addr;
    iError = I2C_write_read_string(I2C0, device_addr, array, array, 1, cnt)
    for(stringpos=0;stringpos<cnt;stringpos++)
    {
    *(reg_data + stringpos) = array[stringpos];
    }
    return (signed char)iError;
}

signed char BME280_I2C_bus_write(unsigned char device_addr, unsigned char reg_addr, unsigned char *reg_data, unsigned char cnt)
{
    int iError=0;
    unsigned char array[I2C_BUFFER_LEN];
    unsigned char stringpos;
    array[0] = reg_addr;
    for(stringpos=0;stringpos<cnt;stringpos++)
    {
    array[stringpos+1] = *(reg_data + stringpos);
    }
    iError = I2C_write_string(I2C0, device_addr, array, cnt+1);
    return (signed char)iError;
}

void BME280_delay_msec(BME280_U16_t msec) //delay in milliseconds
{
    BME280_U32_t counter;
    for (counter = 0; counter/2000 < msec; counter++); // 2000 counts = 1 msec
}
```

## 11. Legal disclaimer

## 11.1 Engineering samples

Engineering Samples are marked with an asterisk (\*), (E) or (e). Samples may vary from the valid technical specifications of the product series contained in this data sheet. They are therefore not intended or fit for resale to third parties or for use in end products. Their sole purpose is internal client testing. The testing of an engineering sample may in no way replace the testing of a product series. Bosch Sensortec assumes no liability for the use of engineering samples. The Purchaser shall indemnify Bosch Sensortec from all claims arising from the use of engineering samples.

## 11.2 Product use

Bosch Sensortec products are developed for the consumer goods industry. They may only be used within the parameters of this product data sheet. They are not fit for use in life-sustaining or safetycritical systems. Safety-critical systems are those for which a malfunction is expected to lead to bodily harm, death or severe property damage. In addition, they shall not be used directly or indirectly for military purposes (including but not limited to nuclear, chemical or biological proliferation of weapons or development of missile technology), nuclear power, deep sea or space applications (including but not limited to satellite technology).

Bosch Sensortec products are released on the basis of the legal and normative requirements relevant to the Bosch Sensortec product for use in the following geographical target market: BE, BG, DK, DE, EE, FI, FR, GR, IE, IT, HR, LV, LT, LU, MT, NL, AT, PL, PT, RO, SE, SK, SI, ES, CZ, HU, CY, US, CN, JP, KR, TW. If you need further information or have further requirements, please contact your local sales contact.

The resale and/or use of Bosch Sensortec products are at the purchaser’s own risk and his own responsibility. The examination of fitness for the intended use is the sole responsibility of the purchaser.

The purchaser shall indemnify Bosch Sensortec from all third party claims arising from any product use not covered by the parameters of this product data sheet or not approved by Bosch Sensortec and reimburse Bosch Sensortec for all costs in connection with such claims.

The purchaser accepts the responsibility to monitor the market for the purchased products, particularly with regard to product safety, and to inform Bosch Sensortec without delay of all safety-critical incidents.

## 11.3 Application examples and hints

With respect to any examples or hints given herein, any typical values stated herein and/or any information regarding the application of the device, Bosch Sensortec hereby disclaims any and all warranties and liabilities of any kind, including without limitation warranties of non-infringement of intellectual property rights or copyrights of any third party. The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics. They are provided for illustrative purposes only and no evaluation regarding infringement of intellectual property rights or copyrights or regarding functionality, performance or error has been made.

## 12. Document history and modification

<table><tr><td>Rev. No</td><td>Page</td><td>Description of modification/changes</td><td>Date</td></tr><tr><td>0.1</td><td></td><td>Document creation</td><td>2012-11-06</td></tr><tr><td>1.0</td><td></td><td>Final datasheet</td><td>2014-11-12</td></tr><tr><td>1.1</td><td>48</td><td>Updated RoHS directive to 2011/65/EU effective 8 June 2011</td><td>2015-05-07</td></tr><tr><td>1.2</td><td>2, 3</td><td>Adjusted target devices, applications</td><td>2015-10-15</td></tr><tr><td>1.4</td><td></td><td>Minor corrections</td><td>2018-01-17</td></tr><tr><td>1.5</td><td></td><td>Template update</td><td>2018-09-17</td></tr><tr><td>1.8</td><td>Chapter 10</td><td>Updated legal disclaimer</td><td>2020-03-12</td></tr><tr><td>1.9</td><td>Chapter 10</td><td>Update disclaimer</td><td>2020-11-23</td></tr><tr><td>1.10</td><td>Chapter 10</td><td>New added chapter self-test disclaimer now 11</td><td>2021-03-18</td></tr><tr><td>1.21</td><td>Chapter 1.4</td><td>New typical accuracy</td><td>2021-07-22</td></tr><tr><td>1.22</td><td>Chapter 7.12</td><td>Update of ROHS directive</td><td>2021-10-22</td></tr><tr><td>1.23</td><td>1.4</td><td>Final Temperature spec</td><td>2022-01-22</td></tr><tr><td>1.24</td><td>Chapter 2</td><td>Remove condensation</td><td>2024-02-20</td></tr></table>

Bosch Sensortec GmbH Gerhard-Kindler-Straße 9 72770 Reutlingen / Germany

contact@bosch-sensortec.com www.bosch-sensortec.com