BME280 is an integrated digital humidity, pressure and temperature sensor. This sensor module is compact in a small smart integrated device on a metal-led this device runs on a low power consumption that allow the sensor driven in a battery powered devices such as smart handset, GPS devices, Smart Watches, etc.
The BME280 achieves in a high performance in all applications that requires humidity and temperature measurement applicable to home automation and control, navigation, health care, and global positioning system (GPS). The humidity sensor provides a fast response time for fast context awareness application and high accuracy in a wide temperature range. The pressure sensor is a barometric pressure with extremely high accuracy and resolution and lower noise than other pressure sensor.
The integrated temperature sensor is optimized for lowest noise and highest resolution. Its output used for temperature compensation of the pressure and humidity sensor and can be used for estimation and acquisition of the ambient temperature.
This BME280 sensor provides both TWI/i2c and SPI interface that can be powered using 1.71 to 3.6 volts for the VDD and 1.2 ~ 3.6 volts for the VDD-IO the measurement can be triggered by the host. When the sensor is disabled the current consumption drops to 0.1 uA. The sensor also can be operated in 3 modes, sleep mode, normal mode, and forced mode. For wiring diagram using i2c or SPI see the diagram below.
Required Components
- Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- BME280 Sensor / BME280 Module
- Jumper Wires / DuPont Wires
- Solder Less Bread Board
Wiring Guide
Source Code Using Two Wire Interface / i2C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <Wire.h> #include "CORE_BME280_I2C.h" // Create BME280 object BME280_I2C bme; // Set to used address 0x77 as default // or BME280_I2C bme(0x76); // I2C using address 0x76 void setup() { Serial.begin(9600); Serial.println("14CORE | Test Code for Bosch BME280 Pressure - Humidity - Temp Sensor"); if (!bme.begin()) { Serial.println("Error: BME280 sensor, Check Wiring > "); while (1); } bme.setTempCal(-1);// Set temp was reading high so subtract 1 degree Serial.println("Pressure\tHumdity\t\tTemp\ttTemp"); } void loop() { sensebme.readSensor(); Serial.print(sensebme.getPressure_MB()); Serial.print(" mb\t"); Serial.print(sensebme.getHumidity()); Serial.print(" %\t\t"); Serial.print(sensebme.getTemperature_C()); Serial.print(" *C\t"); Serial.print(sensebme.getTemperature_F()); Serial.println(" *F"); delay(2000); } |
Source Code Using Serial Peripheral Interface (SPI)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#include <SPI.h> #include "CORE_BME280_SPI.h" //Download the library below #define SENSE_SCK 13;// Set Serial Clock #define SENSE_MISO 12;// Set Serial Data Out #define SENSE_MOSI 11;// Set Serial Data In #define SENSE_CS 10;// Set Chip Select // Create BME280 object // BME280_SPI bme(SENSE_CS); // Set Using Hardware SPI BME280_SPI bme(SENSE_CS,SENSE_MOSI,SENSE_MISO,SENSE_SCK); // Set Using Software SPI void setup() { Serial.begin(9600); Serial.println("14CORE | Bosch BME280 Pressure - Humidity - Temp Sensor | Test Code "); if (!bme.begin()) { Serial.println("Error: BME280 sensor, Check Wiring > "); while (1); } bme.setTempCal(-1);//Set Sensor was reading high so offset by 1 degree C Serial.println("Pressure\tHumdity\t\tTemp\ttTemp"); } void loop() { senseBME.readSensor(); Serial.print(senseBME.getPressure_MB()); Serial.print(" mb\t"); Serial.print(senseBME.getHumidity()); Serial.print(" %\t\t"); Serial.print(senseBME.getTemperature_C()); Serial.print(" *C\t"); Serial.print(senseBME.getTemperature_F()); Serial.println(" *F"); delay(2000); } |
Downloads
- Download BOSCH SENSORTEC BME280 Datasheet | PDF
- Download BME280 I2C Code Library | Zip
- Download BME280 SPI Code Library | Zip
Pingback:Wiring the Analog Devices ADuM340E / ADuM341E / ADuM342E Quad SPI – Isolator with BOSCH BME280 Sensor | 14core.com