Contents

BME280 Temperature, Humidity and Pressure Sensor Module with Arduino

BME280 Sensor Module Features

The BME280 sensor module is a high-accuracy module for measuring temperature, humidity and atmospheric pressure. The key features are:

  • Temperature Measuring range: -40 to +80 degrees Celsius; Accuracy: 1 degree Celsius In the range of 0 to +65 and 1.5 degrees Celsius out of this range
  • humidity: 0-100%RH; Accuracy: 3%RH.
  • pressure: 330hPa to 1100hPa. Accuracy: 1hPa

This module also calculates altitude indirectly using atmospheric pressure. The communication protocol of this sensor can be both SPI and I2C. The module used in this tutorial has I2C communication protocol.

BME280 Sensor Module Pinout

This module has 4 pins:

  • VCC: Module power supply – 5V
  • GND: Ground
  • SCL: Serial Clock Input for I2C protocol
  • SDA: Serial Data Input/Output for I2C protocol

You can see the pinout of this module here.

Required Materials

Hardware Components

Arduino UNO R3 × 1
BME280 Temperature and Humidity and Pressure Sensor Module × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Interfacing BME280 Sensor Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to BME280 module. Connect wires accordingly.

Step 2: Library

Go to Library manager and install Adafruit BME280 and Adafruit Unified Sensor.

Note

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Step 3: Code

Upload the following code to Arduino. After that open the Serial Monitor.

    /*
modified on Jan 04, 2021
Modified by MehranMaleki from Arduino Examples
Home
*/ #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.write("\xC2\xB0"); //The Degree symbol Serial.print("C"); Serial.print("\t Pressure = "); Serial.print(bme.readPressure() / 100.0F); Serial.print("hPa"); Serial.print("\t Altitude = "); Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); Serial.print("m"); Serial.print("\t Humidity = "); Serial.print(bme.readHumidity()); Serial.println("%"); Serial.println(); delay(1000); }

In the above code, the data of temperature, atmospheric pressure, approximate altitude and humidity is received from the sensor each second and displayed in the Serial Monitor.

The output is as follows.

Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

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