Team10 temperature and humidity sensor
Revision as of 10:42, 11 October 2022 by 138.246.3.127 (talk) (Specifications and setup of a BME680 sensor using the Wemos D1 Mini with Arduino.)
Contents
BME680 Temperature, Humidity, Air Pressure & Gas Sensor
The BME680 is a sensor by BOSCH that can measure gas, preassure, humidity an temperature. It was especially developed for wearables making it small and its power consumption minimal. The sensor can be interfaced with I2C and SPI.
Technical Data
- Size: 3mm x 3mm + 0,93mm
- Temperature: -40... + 85°C - Accuracy: +-1°C
- Humidity: 0 - 100% relative Humidity - Accuracy: +- 3%
- Preassure: 300‒1100 hPa - Accuracy: +- 1 hPa
- Gas sensor: outputs a direct index for air quality (IAQ) with range from 0 (Excellent air quality) to >351 (Extremely polluted)
Advantages and Disadvantages
Advantages
- humidity and preassure can be handled independently
- low power consumption (Average current consumptionfor humidity and temperature: 2.1 µA at 1 Hz)
- small size (2,5mm x 2,5mm x 0,93mm)
- possibility of adding preassure and gas measurements
- context awareness (skin detection, room change detection)
Disadvantages
- only small in size without breakout
- library takes up more memory flash space than other similar sensors
- you need to use the BOSCH libraries
Get it to work
We connected the Wemos D1 Mini ESP8266 with the BME680 using Arduino.
Parts list
- Wemos D1 mini
- BME680 Air Quality Sensor breakout board
- 4 connecting wires
Software
- Arduino IDE
- Adafruit BME680 library
- Adafruit Unified Sensor Library
Schematic
- Connect the Ground Pin of the BME680 to the Ground Pin of the Wemos D1 Mini
- Connect the SCL Pin of the BME680 to D1 on the Wemos D1 Mini
- Connect the SDA Pin of the BME680 to D2 on the Wemos D1 Mini
- Connect the SCL Pin of the BME680 to D1 on the Wemos D1 Mini
Code example
1 #include <Wire.h>
2 #include <SPI.h>
3 #include <Adafruit_Sensor.h>
4 #include "Adafruit_BME680.h"
5
6
7 #define SEALEVELPRESSURE_HPA (1013.25)
8
9 Adafruit_BME680 bme; // I2C
10
11 void setup() {
12 Serial.begin(115200);
13 while (!Serial);
14 Serial.println(F("BME680 test"));
15
16 if (!bme.begin(0x76))
17 {
18 Serial.println("Could not find a valid BME680 sensor, check wiring!");
19 while (1);
20 }
21
22 // Set up oversampling and filter initialization
23 bme.setTemperatureOversampling(BME680_OS_8X);
24 bme.setHumidityOversampling(BME680_OS_2X);
25 bme.setPressureOversampling(BME680_OS_4X);
26 bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
27 bme.setGasHeater(320, 150); // 320*C for 150 ms
28 }
29
30 void loop()
31 {
32 if (! bme.performReading())
33 {
34 Serial.println("Failed to perform reading :(");
35 return;
36 }
37 Serial.print("Temperature = ");
38 Serial.print(bme.temperature);
39 Serial.println(" *C");
40
41 Serial.print("Pressure = ");
42 Serial.print(bme.pressure / 100.0);
43 Serial.println(" hPa");
44
45 Serial.print("Humidity = ");
46 Serial.print(bme.humidity);
47 Serial.println(" %");
48
49 Serial.print("Gas = ");
50 Serial.print(bme.gas_resistance / 1000.0);
51 Serial.println(" KOhms");
52
53 Serial.print("Approx. Altitude = ");
54 Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
55 Serial.println(" m");
56
57 Serial.println();
58 delay(2000);
59 }
Instructional video
coming soon