Getting started with BME280 – Humidity, Pressure and Temperature Sensor

The BME280 is an integrated environmental sensor by Bosch that measures humidity, pressure and temperature which is able to give users a comprehensive and holistic measurement of the environment. It is designed with an 8-pin metal-lid LGA package for low power consumption, long term stability and high EMC robustness.

This sensor features a fast response time to support performance requirements and also high accuracy. It is also optimized for low noise and high-resolution performance.


Today, through this blog, we are going to talk about:

  • Seeed’s BME280 Sensor: Grove – BME280 Environmental Sensor (Temperature Humidity Barometer)
  • Applications of the BME280
  • BME280 with Arduino
  • Related Sensors to the BME280

Before you start, you will, of course, require a BME280 sensor!


Grove – BME280 Environmental Sensor (Temperature Humidity Barometer) ($17.00)

  • This is Seeed very own Grove- BME280 Environmental Sensor based on Bosch BME28 which is low-cost, high-precision and supports both I2C and SPI communication.
    • If you do not know what is I2C or SPI or its differences, you can check out my other article here about communication peripherals.
  • Grove BME280 provides a precise measurement of not only barometric pressure and temperature, but also the humidity in the environment.
  • Owing to its high accuracy on measuring the pressure, and the pressure changes with altitude, we can calculate the altitude with ±1 meter accuracy, which makes it a precise altimeter as well.
  • In addition, you don’t even need to worry about the I2C collisions as it provides both I2C and SPI interfaces.
    • To use SPI, simply de-solder the bonding pads on the back of this BME280 breakout board.
    • For I2C, the board also provides 2 I2C addresses for you to select as you want.  
  • We also have a highly abstracted library for users to build projects quicker with the BME280!

Specifications:

ParameterGrove – BME280 Environmental Sensor
Dimensions40mm x20mm x15mm
WeightG.W 10g
Supply Voltage5V or 3.3V
Current Consumption0.4 mA
Humidity Accuracy±3%
Temperature Range -40 to 85
Temperature Accuracy±1
Air pressure Range300 – 1100 hPa
Air Pressure Accuracy±1.0 hPa

Background on Grove

You may be wondering, what exactly is grove? Grove is Seeed’s very own modular, standardized connector prototyping system. Grove takes a building block approach to assemble electronics and compared to the jumper or solder based system, it is easier to connect, experiment and build which simplifies the learning system for hobbyists. Do not worry as it is not to the point where it becomes dumbed down. 


Applications of the BME280

  • So where can you use the BME280 sensor? Due to its, capabilities and features like its I2C and SPI compatibility, this sensor is suitable for every weather / environmental sensing! Some applications in the current industry include:
    • Enhancement of GPS navigation
    • Outdoor/indoor navigation
    • Weather forecast
    • Fitness monitoring
    • Home automation control
    • Any other project that requires accurate atmospheric pressure reading.

BME280 with Arduino

The Grove – BME280 Environmental Sensor are easily compatible with various microcontrollers like the Arduino, Beaglebone or LinkIt ONE through I2C or SPI. In today example, I will show you guys how to easily connect your Grove – BME280 Environmental Sensor to the Arduino.

What do you need?

Step by Step instructions for BME280 with Arduino

  • Step 1
    • Connect the Grove BME280 Sensor to the I2C port of the Grove Base Shield V2 and plug it into Seeeduino.
    • If you do not have a Grove Base Shield, you can directly connect this module to the Seeeduino as shown below:
Seeeduino V4.2Grove BME280 Sensor
5VVCC
GNDGND
SDASDA
SCLSCL

Your connection should look something like this now:

  • Step 2
    • Connect Seeeduino to PC via a USB cable
  • Step 3
    • Now, we are at the Software part of the tutorial!
    • Firstly, Download the Library and example code from Github
    • If you do now know how to install library, refer to our guide on How to install library to install the library to your Arduino
  • Step 4
    • Create a new Arduino sketch and paste the codes below to it or open the code directly by the path:
    • File -> Example ->Barometer_Sensor->Barometer_Sensor
    • This is the code:
/*
 * bme280_example.ino
 * Example sketch for bme280
 *
 * Copyright (c) 2016 seeed technology inc.
 * Website    : www.seeedstudio.com
 * Author     : Lambor
 * Create Time:
 * Change Log :
 *
 * The MIT License (MIT)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include "Seeed_BME280.h"
#include <Wire.h>

BME280 bme280;

void setup()
{
  Serial.begin(9600);
  if(!bme280.init()){
    Serial.println("Device error!");
  }
}

void loop()
{
  float pressure;

  //get and print temperatures
  Serial.print("Temp: ");
  Serial.print(bme280.getTemperature());
  Serial.println("C");//The unit for  Celsius because original arduino don't support speical symbols

  //get and print atmospheric pressure data
  Serial.print("Pressure: ");
  Serial.print(pressure = bme280.getPressure());
  Serial.println("Pa");

  //get and print altitude data
  Serial.print("Altitude: ");
  Serial.print(bme280.calcAltitude(pressure));
  Serial.println("m");

  //get and print humidity data
  Serial.print("Humidity: ");
  Serial.print(bme280.getHumidity());
  Serial.println("%");

  delay(1000);
}
  • Step 5
    • Upload the code to your Arduino
    • If you do not know how to upload the code, you can refer to our guide on How to Upload Code.
  • Step 6
    • Open the serial monitor to receive the sensor’s data including temperature, barometric pressure value, altitude and humidity.

And that’s all! In just 6 steps, you can easily run the Grove BME280 sensor with the Seeeduino! Here are some additional resources for you on the BME280 including a datasheet and also a library:


Related Sensors to the BME280

Looking for something else other than the BME280? Here are some sensors that are closely related to the BME280!

Grove – Barometer Sensor (BMP280) ($8.90)

  • The Grove BMP280 Barometer Sensor is built around Bosch BMP280, it is a low-cost and high-precision environmental sensor measures the temperature and barometer. This sensor supports both I2C and SPI communication which we have also provided the BMP280 Arduino library.
  • Similarly to the Grove BME280 Barometer Sensor, it can also act as a precise altimeter as well!

Specifications:

ParameterGrove – Barometer Sensor (BMP280)
Dimensions20mm x 40mm
Weight3g
Supply Voltage5V or 3.3V
Current Consumption0.6 mA
Barometric Pressure Range300 – 1100 hPa
Barometric Pressure Accuracy±1.0 hPa
Temperature Measurement Range-40 to 85
Temperature Measurement Accuracy±1

BME280 vs BMP280, what are their differences?

  • The Grove BMP280 is similar to Grove BME280, and their parameter performance is almost the same, so people are often confused.
  • The BMP280 can only measure temperature and air pressure, while the BME280 can measure humidity in addition to temperature and air pressure. 
  • Because of this difference, BMP280 is much cheaper than BME280. 
  • Simply put, the BMP280 Barometer sensor is an upgrade to the BMP180 Barometer sensor, and the BME280 environmental sensor adds humidity measurement to the BMP280.
  • So if you just want to get the atmospheric pressure, then we recommend you to use Grove BMP280, however, if you want to monitor the environment more comprehensively, then we recommend Grove BME280.

Grove – Temperature, Humidity, Pressure and Gas Sensor (BME680) ($20.50)

  • The Grove-Temperature & Humidity & Pressure & Gas Sensor (BME680) has multiple functional sensors which can measure temperature, pressure, humidity and gas at the same time which is based on the BME680 module by Bosch Electronics. 
  • The 4-in-1 function is integrated on such a small module, it will be very beneficial to apply on IoT or GPS devices.
  • It features low power consumption, wide measurement range and has an optional output which allows individual humidity, pressure and gas sensors to be independently enabled/disabled.
  • Some applications of this sensor include
    • Indoor air quality
    • Home automation and control
    • Vertical Velocity indication (risk/sink speed)

Specifications:

ParameterGrove – Temperature, Humidity, Pressure and Gas Sensor (BME680)
Dimensions40mm x20mm x7mm
WeightG.W 9.1g
Supply Voltage5V or 3.3V
Operating Range
-40~+85℃; 0-100% r.H.; 300-1100hPa
Humidity Absolute Accuracy
± 3%r.H. (20-80 %r.H.,25℃)
Humidity Resolution0.008 %r.H.
Pressure Absolute Accuracy± 0.6 hPa (300-1100 hPa, 0-65℃)
Pressure Resolution0.18 Pa
Temperature Absolute Accuracy± 0.5℃ (25℃, At,25); ± 1℃ (0-65℃, At, full)
Temperature Resolution0.01℃

BME280 vs BME680, what are their differences?

  • Similarly to the BME280, the BME680 can measure humidity with ±3% accuracy, barometric pressure with ±1 hPa absolute accuracy, temperature with ±1.0°C accuracy and also as an altimeter with  ±1 meter or better accuracy.
  • However, the BME680 can also measure gas along with temperature, pressure and humidity as it contains an additional MOX sensor.
  • It can detect a broad range of gases to measure air quality for personal well-being. Gases that can be detected by the BME680 include Volatile Organic Compounds (VOC) from paints (such as formaldehyde), lacquers, paint strippers, cleaning supplies, furnishings, office equipment, glues, adhesives and alcohol!
  • Even though it is slightly more expensive than the BME280, you will also definitely get a bang for your buck as it is a
    4-in-1 sensor!

Not what you are looking for? You can check out our other blog on 8 Types of Temperature Sensors You Should Know or check out all the other sensors that we offer here!


Summary

That’s all on Getting started with BME280 – Humidity, Pressure and Temperature Sensor! Curious about what you can do with the BME280? Check out Seeed’s project on an automatic information collection system using the BME280 for a tea plantation!

About Author

Calendar

November 2019
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930