BME280 Complex measurement

Home / Sensors / BME280 Complex measurement


This page will take through all steps you need to make this sensor work with your microcontroller such as Arduino, ESP8266, Wemos.
I will be using I2C bus demanding only 4 wires for these pins: Vcc, GND, SCL, SDA.

Temperature sensor accuracy

Min temp. [°C] Max temp. [°C] Temp. [°C] Accuracy [°C] Resolution [°C]
25+-0.50 0.01
065+-1.00 0.01
-200+-1.25 0.01
-40-20+-1.50 0.01

Humidity sensor accuracy

Min [%RH]Max [%RH]Temp. [°C]Accuracy [%RH ]Resolutio [%RH ]
Min [hPa]Max [hPa] Min temp. [°C]Max temp. [°C]Accuracy [hPa]Resolution [hPa]
7009002540+-1.2 (relative)0.0.1

Pressure sensor accuracy

Min [hPa]Max [ hPa]Min Temp. [°C] Max Temp. [°C] Accuracy [hPa]Resolution [hPa]


It is crucial to identify what pins on your development board can be used as SCL, SDA

NodeMcu BME280 wiring
Wemon D1 mini wiring

IIR filter

Using IIR filter is crucial for a constant precise readings in a slow changing enviroment.

Code with fixed self heating problem

If you want to really use BME280 for some of your projects, please use this code.
BME280 has well known self heating problems causing rising temperature up to + 2°C.

  Lukas Pomykal 2019
  BME280  reading example with advanced settings

  Adafruit library:
#include <Adafruit_BME280.h>
#define BME280_Address (0x76) // usually (0x76), but might be (0x77)
#define seaLevelPressure (1013.25) // sea level pressure at your location
#define delayTime (60000) //It is necessary to read values in a longer interval so the sensor will not heat up itself, read every minute (60000 ms = 60 s = 1 min)

Adafruit_BME280 bme; // I2C

void setup() {
  Serial.println("BME280 test");

  if (!bme.begin(BME280_Address)) {  // If sensor has not been found (could not been initialized)
    Serial.println("BME280 has not been found!");
    Serial.println("Please check your wiring or BME280_Address");
    while (1);

  //BME280 weather station settings corresponding to datasheet
  bme.setSampling(Adafruit_BME280::MODE_FORCED, // Force reading after delayTime
                Adafruit_BME280::SAMPLING_X1, // Temperature sampling set to 1
                Adafruit_BME280::SAMPLING_X1, // Pressure sampling set to 1
                Adafruit_BME280::SAMPLING_X1, // Humidity sampling set to 1
                Adafruit_BME280::FILTER_OFF   // Filter off - immediate 100% step response

void loop() {
    // Only needed in forced mode! In normal mode, you can remove the next line.
    bme.takeForcedMeasurement(); // has no effect in normal mode
    Serial.print("Temperature = ");
    Serial.println(" °C");

    Serial.print("Pressure = ");
    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Altitude = ");
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.println(" %RH");


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *