BME680 Digital Humidity Temperature Pressure High Altitude Sensor Module Documentation
The BME680 is a digital sensor module that measures temperature, humidity, pressure, and gas (VOC) levels. It is designed for high-altitude applications and is ideal for use in IoT projects, weather stations, and environmental monitoring systems.
Temperature range: -40C to 85C
Humidity range: 0% to 100% RH
Pressure range: 300hPa to 1100hPa
Gas (VOC) range: 0 to 500 ppb
IC and SPI interfaces
3.3V and 5V compatible
VCC: 3.3V or 5V power supply
GND: Ground
SCL: IC clock
SDA: IC data
CS: Chip select (for SPI interface)
INT: Interrupt pin
### Example 1: Basic Temperature and Humidity Reading using Arduino and IC Interface
This example demonstrates how to read temperature and humidity values from the BME680 using an Arduino board and the IC interface.
```c
#include <Wire.h>
#include <BME680.h>
BME680 bme; // IC address: 0x76 or 0x77
void setup() {
Serial.begin(9600);
Wire.begin();
bme.begin();
}
void loop() {
if (bme.begin()) {
Serial.print("Temperature: ");
Serial.print(bme.readTemperature());
Serial.println(" C");
Serial.print("Humidity: ");
Serial.print(bme.readHumidity());
Serial.println(" %RH");
delay(1000);
} else {
Serial.println("BME680 not found");
}
}
```
### Example 2: Pressure and Altitude Reading using Raspberry Pi and Python
This example demonstrates how to read pressure and altitude values from the BME680 using a Raspberry Pi and the Python programming language.
```python
import smbus2
import bme680
# IC bus number (Raspberry Pi)
bus = smbus2.SMBus(1)
# BME680 IC address
bme680_address = 0x76
# Create a BME680 object
bme = bme680.BME680(bus, bme680_address)
# Initialize the BME680
bme.set_calibration_data()
while True:
# Read pressure and altitude
pressure = bme.get_pressure()
altitude = bme.get_altitude(pressure)
print("Pressure: {:.2f} hPa".format(pressure))
print("Altitude: {:.2f} meters".format(altitude))
# Wait 1 second before taking the next reading
time.sleep(1)
```
These code examples demonstrate the basic usage of the BME680 sensor module in different contexts. For more advanced usage and configuration options, refer to the BME680 datasheet and the documentation of the chosen development platform.