BME680 – Gas Sensor

In this blog we look at the BME680 Integrated Environmental Sensor with Arduino Nano microcontroller. The BME680 is a gas sensor that measures relative humidity, barometric pressure, ambient temperature, gas (VOC Volatile Organic Compound) and IAQ (Indoor Air Quality). Because the pressure varies with altitude, The sensor can be used to measure estimated altitude. Using a mathematical equation related to temperature and humidity, we can also derive the dew point. This type is a is a much improved version of BMP180 and BME280 with extra extra functions.

BME680

The Sensor is a digital 4-in-1 sensor with gas, humidity, pressure and temperature measurement based on proven detection principles. The gas sensor on the BME680 can detect a wide variety of volatile organic compounds to monitor indoor air quality. The sensor has high linearity and high accuracy.

The Sensor has been specially developed for mobile applications and wearables where size and low power consumption are critical requirements. The Sensor has features such as a specific operating mode, optimized power consumption, long-term stability and high EMC robustness. To measure air quality, the gas sensor in the BME680 can detect a wide variety of gases, such as volatile organic compounds (VOCs). For more information on the sensor, please refer to the BME680 data sheet.

BME680 board Pinouts

BH1750 is a digital ambient light sensor. It can be easily used for backlight adjustments of mobile phone keypads and LCDs. This figure shows the pin configuration layout of an ambient light sensor module.

PinNameFunction
1VCCPower supply pin requires 1.7V to 3.6V for operation
2GNDGND Pin
3SCLSerial Clock Pin for I2C Interface / SCK Pin for SPI Communication
4SDASerial Data Pin for I2C Interface / MOSI Pin for SPI Communication
5SD0MISO Pin for SPI Communication
6CSChip Select Pin for SPI Interface

 

BME680 module pinouts

Left: Top view of the chip with input / output pins   |   Right: bottom view of the chip with input / output pins

PinName I /O typeDescriptionConnection
SPI 4WSPI 3WI2C
1GNDSupplyGroundGND  
2CSBINChip SelectCSBCSBVDDIO
3SDIIN / OUTSerial data inputSDISDI /SDOSDA
4SCKINSerial clock inputSCKSCKSCL
5SDOIN / OUTSerial data outputSDODNCGND for default adress
6VDDIOSupplyDigtal / interface supplyVDDIO  
7GNDSupplyGroundGND  
8VDDSupplyAnalog supplyVDD  

Changing the default I2C address

The BME680 breakout has a default I2C address of 0x76. But you can change the I2C address so that you can use up to two breakouts on the same Arduino Nano. To change the I2C address to 0x77, just connect SDO to GND.

Breakout scheme

The basic concept of a breakout board is that is takes a single electrical component and makes it easy to use. Usually the electrical component is an integrated circuit (IC). Integrated circuits, as you may know, have pins on them. The pins on an IC can do a multitude of things, but you usually have pins for supply power, pins for providing a ground, pins for receiving an input and pins for sending an output. A breakout board “breaks out” these pins onto a printed circuit board that has its own pins that are spaced perfectly for a solderless breadboard, giving you easy access to use the integrated circuit.

BME680 as IAQ (Indoor Air Quality) Sensor

BME680 is a metal oxide based sensor that detects VOC’s by adsorption on its sensitive layer. The Sensor reacts to most volatile substances that pollute the indoor air (except CO2). The Sensor is able to measure the sum of VOC contaminants in the surrounding air, such as outgassing from paint, furniture or waste, high VOC levels due to cooking, food consumption and exhaled air or sweating.

As a raw signal, the sensor will output resistance values ​​and it changes due to varying VOC concentrations. The higher the concentration of reducing VOC’s, the lower the resistance and vice versa. Since this raw signal is affected by parameters other than the VOC concentration (e.g. humidity level), the raw values ​​are converted by smart algorithms within BSEC (Bosch Sensortec Environmental Cluster) into an indoor air quality index (IAQ).

IAQstatusMeaning
0 ~ 50GoodAir quality is considered satisfactory, and air pollution poses little or no risk
51 ~ 100ModerateAir quality is acceptable; however, for some pollutants there may be a modorate health concern for a very small number of peaople who are unusually sensitive to air pollution
101 ~ 150Unhealty for Sensitive groupsMemebers od sensituve groups may experience health affects. The geneeral public is not likely to be affected.
151 ~ 200UnhealtyEveryone mat begin to experience health effects; members of sensitive groups may exerience more serious heath effects.
201 ~ 300Very UnhealtyHeatl alert; everyone may experience more serious health effects.
301 ~ 500HazardousHealth warnings of emergency conditions. The entiere population is more likly to be affected.

The IAQ scale ranges from 0 (clean air) to 500 (highly polluted air). During operation, the algorithms are automatically calibrated and adapted to the typical environments in which the sensor is used. The calibration process takes into account the recent measurement history to ensure that an IAQ of 25 corresponds to “typically good” air and an IAQ of 250 indicates “typically polluted” air.

Interfacing BME680 with Arduino using I2C Interface

The BME680 Integrated Environmental Sensor has both the I2C & SPI Interface. First we will have a look how to use the I2C Pins of BME680 to interface it with Arduino Nano Board. The connection between BME680 & Arduino Nano is fairly simple. Connect the VCC pin of the BME680 to Arduino 3.3V Pin and GND to GND. Similarly, connect the I2C Pins of BME680, SDA and SCL Pins to Arduino A4 and A5 Pins respectively.

Interfacing BME680 with Arduino using SPI Interface

After connecting the BME680 with a Arduino Nano I2C interfacing, we can now look for SPI interfacing. The connection diagram for BME680 SPI interface with Arduino Nano Board. The SPI connection between BME680 and Arduino Nano is fairly simple. Connect the VCC pin of the BME680 to Arduino 3.3V Pin and  GND to GND. Similarly, connect the SCL, SDA, SDO, CS pin of BME680 to Arduino Nano digital 13, 11, 12, 10 pins respectively.

BME680 Library’s

The BME680 Library developed by Adafruit can measure the temperature, humidity, pressure, altitude, dew point & gas. The library is simplified and using only few lines of code, you can interface BME680 with the Arduino Nano. The library requires another library for a compilation called Adafruit Unified Sensor. You can download the library from the following link.

Download: Adafruit Unified Sensor

After adding the above library to the Arduino IDE, you can add BME680 Arduino Library to the Arduino IDE. The download link for the library is given below.

Download: Adafruit BME680 Library

Source Code/program

 

Source Code: BME680 Arduino I2C Interface

Source Code: BME680 Arduino SPI Interface

Testing & Results

You can use any of the above circuits, the I2C circuit or the SPI circuit. Then upload one of the codes according to the circuit diagram. Open the serial monitor after uploading the code to the Arduino Nano board. For example I used the I2C circuit here for demonstration.

The serial monitor displays the temperature in degrees Celsius, Humidity in percentages, Atmospheric pressure in hPa, Altitude in meters, Dew point in degrees Celsius and Gas as resistance value. The sensor is used to obtain the so-called gas resistance and then calculate an air quality index (IAQ) from a combination of humidity and gas content measurements of the air. Using the BME680 cannot calculate Arduino code IAQ. So you need to use a different library to calculate the Index of Air Quality (IAQ), which is explained below.

 

Calculate IAQ using BSEC Arduino Library

The BSEC fusion library has been conceptualized to provide a higher level of signal processing and fusion for the BME680. The library receives compensated sensor values ​​from the sensor API. It processes the BME680 signals to provide the requested sensor outputs.

The IAQ index is a function of humidity contributing up to 25% and gas concentrations contributing up to 75%. In this current version, only humidity and gas concentrations are used for the index, but adding temperature would be easy because temperatures for humans that are too high or too low, along with humidity and gas concentrations, contribute to the overall air quality index.

BSEC library is supported on 32, 16 and 8 bit MCU platforms. And unfortunately the library is not supported by Arduino UNO, Nano, Pro Mini, etc. The library is only supported by some Arduino Boards such as Arduino MEGA 2560, Arduino Zero and Arduino Due. Download the library from the link below and use it with the supported Arduino board.

Download: BME680 BSEC Library

 

Source code / program

Copy the following code and upload it to the supported Arduino board.

The following parameters will be displayed every 3 seconds:
1. Timestamp in milliseconds
2. Raw Temperature in °C
3. Pressure in hPa
4. Raw Relative Humidity in %
5. Raw data from the gas sensor as a resistance value in Ohm
6. IAQ index
7. IAQ Accuracy
8. Temperature in °C
9. Relative Humidity in %
10. Static IAQ
11. CO2 equivalent
12. Breath VOC equivalent output

for more information about BSEC go to https://github.com/BoschSensortec/BSEC-Arduino-library

REFERENCE

Bosch Sensortec, BME680(2021), Gas sensor measuring relative humidity, barometric pressure, ambient temperature and gas (VOC). , https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/ Bosch Sensortec, BSEC-Arduino-library(2021),Instructions for using the BSEC Arduino Library in Arduino 1.8.13, https://github.com/BoschSensortec/BSEC-Arduino-library  Adafruit, Adafruit_BME680 (2020),Adafruit BME680 Library, https://github.com/adafruit/Adafruit_BME680 How To Electronics, BME680 Sensor(2021),Interfacing BME680 Integrated Environmental Sensor with Arduino, https://github.com/HomeACcessoryKid/life-cycle-manager RandomNerdTutorials, BME680 Environmental Sensor(2021),Guide for BME680 Environmental Sensor with Arduino (Gas, Temperature, Humidity, Pressure), https://randomnerdtutorials.com/bme680-sensor-arduino-gas-temperature-humidity-pressure/ Theorycircuit, BME680 Arduino(2021),BME680 Arduino interfacing is very easy to do and the breakout board from adafruit makes it simple., https://theorycircuit.com/bme680-arduino

 

Scroll to Top