BME280 sensor is an ecological sensor with temperature, barometric tension, and humidity!. We already successfully interface Temperature and humidity sensors with arduino. This precision sensor is the most ideal low-expense sensing solution for estimating humidity with ±3% accuracy, barometric pressure with ±1 hPa absolute precision, and temperature with ±1.0°C accuracy. Since pressure changes with altitude and the pressure measurements are so great, you can likewise use it as an altimeter with  ±1 meter or better exactness!

How BME280 Pressure Sensors looks

The sensor has a BME280 chip and I2C Adress Selector soldering Pins.

BME280 front side

On the back side, it has a 3.3V LDO Regulator with an I2C Voltage Level Translator and 4 different pinouts, VIN, GND, SLC, and SDA.

BME280 Back side

Features Of BME280 Pressure Sensor

The BME280 consumes under 1mA during estimations and just 5μA during inactive. This low power utilization permits the execution of battery-driven gadgets like handsets, GPS modules, or watches. The module accompanies an onboard LM6206 3.3V controller and I2C Voltage Level Translator, so you can utilize it with a 3.3V or 5V logic microcontroller like Arduino without stress.

Pinout of BME280 Pressure Sensor

The BME280 pressure sensor has only 4 pins that are connected to the outside world. Those connections are as following:

  • VIN is the power supply for the module which could be anywhere between 3.3V to 5V.
  • GND needs to be connected to the ground of the Arduino. 
  • SCL acts as a serial clock pin for the I2C interface.
  • SDA is a serial data pin for the I2C interface.

Material required

To complete this method materials required are as such you:-

Arduino1
Breadboard1
BME280 sensor module1
Jumper wiresAs per requirement

Circuit Connection Of BME280 Pressure Sensor

The BME280 module is connected to the Arduino via the following steps:

Circuit Connection Of BME280 Pressure Sensor

The VIN pin is associated with the 5V output on the Arduino and interfaces GND to the ground because connection steps are quite basic. Currently, we are remaining with the pins that are utilized for I2C communication.

Note: that each Arduino Board has different I2C pins which ought to be associated similarly.

On the Arduino boards with the R3 design, the SDA (data line) and SCL (clock line) are on the pin headers near the AREF pin. They are also called A5 (SCL) and A4 (SDA). 

How to install the BME280 library? 

To get readings from the BME280 sensor module you are required to utilize the Adafruit_BME280 library. Follow the subsequent steps to install the library in your Arduino IDE:

  • Open your Arduino IDE and go to Sketch then click on Include Library then Manage Libraries. Wait for the Library Manager to open.
  • Search for “adafruit bme280 ” on the Search box and then install the library.
BME280 library
  • Search for “adafruit unified Sensor ” on the Search box and then install the library.
adafruit unified librarry

Arduino Code For Temperature, Humidity, And Barometric Pressure

This program will give you a complete understanding on how to read the temperature, relative humidity, and barometric pressure from the BME280 module. Upload the code on your Arduino UNO board

// the code is Downloaded from www.electronicsmith.com visit ower website for more tutorials.

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

void setup() {
    Serial.begin(9600);

    if (!bme.begin(0x76)) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }
}

void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println("*C");

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

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println("m");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println("%");

    Serial.println();
    delay(1000);
}		

Serial output

Code Explanation:

The outlet begins by importing the Wire.h, SPI.h, Adafruit Sensor.h, and Adafruit BME280.h libraries.

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Then, in order to access its related functions, we declare the SEALEVELPRESSURE HPA variable required to compute altitude and build an object of the Adafruit BME280 library.

#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;

In the setup section of the code, we call the begin() function and initialize the serial communication with the PC. The I2C address of the module is a parameter for the begin(I2C ADDR) function. You must accurately mention the I2C address if your module has a different I2C address or if you altered it. This function confirms the validity of the chip ID and initializes the I2C interface with the specified I2C address. It then does a soft reset on the chip and waits for the sensor to wake up before calibrating it.

Serial.begin(9600);

if (!bme.begin(0x76)) {
	Serial.println("Could not find a valid BME280 sensor, check wiring!");
	while (1);
}

The Loop functions are used in the code’s looping portion to read the BME280 module’s temperature, relative humidity, and barometric pressure.

The temperature from the sensor is returned by the readTemperature() function.

    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println("*C");

The barometric pressure from the sensor is returned by the readPressure() function.

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

Using the provided atmospheric pressure (in hPa), sea-level pressure, and height (in meters), the readAltitude(SEALEVELPRESSURE HPA) function computes the altitude (in meters) (in hPa).

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println("m");

The relative humidity from the sensor is returned by the readHumidity() function.

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println("%");

Newsletter SignupLoving Our Content?

Subscribe to our weekly newsletter below and never miss any update that is most likely to blow your mind.