BME688 Environmental Sensor

View on Amazon
Overview
About BME688 Environmental Sensor
The BME688, developed by Bosch Sensortec, is a multi-functional environmental sensor that integrates temperature, humidity, barometric pressure, and gas sensing. It is the first gas sensor with AI capabilities, enabling customized gas scanning and detection of volatile organic compounds (VOCs) and volatile sulfur compounds (VSCs).
⚡ Key Features
- Multi-Sensor Integration – Measures temperature, humidity, pressure, and gas composition.
- AI-Powered Gas Detection – Identifies VOCs and VSCs for advanced air quality analysis.
- I²C & SPI Communication – Easily interfaces with ESP32, Arduino, and other microcontrollers.
- Compact & Low Power – Ideal for smart home, industrial, and wearable applications.
With its advanced sensing and AI-driven gas detection, the BME688 is perfect for air quality monitoring, environmental control, and smart IoT applications. 🚀
🔗 Learn more about the BME688 sensor.
BME688 Specifications
Complete technical specification details for BME688 Environmental Sensor
📊 Technical Parameters
BME688 Pinout
The **BME688** supports both **I²C** and **SPI** with AI-powered gas sensing:
Visual Pinout Diagram

Pin Types
Quick Tips
**Dual Protocol**: Supports both I²C and SPI,📡 **I²C Address**: 0x76 or 0x77,🌡️ **Temperature**: -40°C to +85°C,💧 **Humidity**: 0-100% RH
**Pressure**: 300-1100 hPa,💨 **Gas Sensor**: AI-powered VOC and VSC detection,🤖 **AI Capable**: Train for specific gas detection
**IAQ**: Indoor Air Quality Index,⚡ **Power**: 1.71V-3.6V (typically 3.3V),🎯 **Applications**: Advanced air quality, smart homes, industrial
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 VIN | Power | Power input | 1.71V to 3.6V (typically 3.3V) |
2 GND | Power | Ground connection | |
3 SDA/SDI | Communication | I²C data / SPI data in | Connect to ESP32 GPIO21 (I²C) or GPIO23 (SPI) |
4 SCL/SCK | Communication | I²C clock / SPI clock | Connect to ESP32 GPIO22 (I²C) or GPIO18 (SPI) |
5 CS | Communication | Chip select for SPI | Connect to GND for I²C mode, GPIO5 for SPI |
6 SDO | Communication | SPI data out | GPIO19 for SPI, optional in I²C |
Wiring BME688 to ESP32
To interface the **BME688** with an **ESP32** using **I²C**:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| BME688 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 VIN Required | 3.3V | Power supply | |
2 GND Required | GND | Ground | |
3 SDA/SDI Required | GPIO21 | I²C data line | |
4 SCL/SCK Required | GPIO22 | I²C clock line | |
5 CS Required | GND | Set to GND for I²C mode |
**I²C Address**: 0x76 or 0x77 (check with scanner)
**AI Training**: Use Bosch BME AI Studio for custom gas profiles
**Gas Sensor**: Requires heating element (automatic)
**Warm-up**: ~30 minutes for stable gas readings
**Power**: Use 3.3V
**Enhanced**: Improved accuracy over BME680
BME688 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The Arduino IDE cannot locate the required BME688 library.
Solution: Ensure that the Adafruit BME680 library is installed via the Arduino Library Manager. Restart the Arduino IDE after installation. Note that the BME688 is compatible with the BME680 library.
Issue: The BME688 sensor fails to initialize, displaying an error message such as Could not find a valid BME680 sensor, check wiring!.
Solution: Verify that all wiring connections are correct and that the sensor is receiving appropriate power. Use an I²C scanner to confirm the sensor's address.
Issue: The sensor provides inaccurate or fluctuating temperature, humidity, or gas readings.
Solution: Ensure that the sensor is not exposed to rapid environmental changes or placed near heat sources. Allow the sensor to stabilize after power-up, as recommended by Bosch Sensortec. Calibration may be necessary for precise gas measurements.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
BME688 Programming Examples
Ready-to-use code examples for different platforms and frameworks
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME680 bme;
void setup() {
Serial.begin(115200);
if (!bme.begin()) {
Serial.println("Could not find a valid BME680 sensor, check wiring!");
while (1);
}
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320°C for 150 ms
}
void loop() {
if (!bme.performReading()) {
Serial.println("Failed to perform reading :(");
return;
}
Serial.print("Temperature = ");
Serial.print(bme.temperature);
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bme.pressure / 100.0);
Serial.println(" hPa");
Serial.print("Humidity = ");
Serial.print(bme.humidity);
Serial.println(" %");
Serial.print("Gas = ");
Serial.print(bme.gas_resistance / 1000.0);
Serial.println(" KOhms");
delay(2000);
}This Arduino code initializes the BME688 sensor using the Adafruit BME680 library, which is compatible with the BME688. The sensor is configured for temperature, humidity, pressure, and gas readings with specific oversampling and filtering settings. The gas heater is set to 320°C for 150 milliseconds to ensure accurate detection of volatile organic compounds (VOCs) and other gases. The sensor data is read in the loop function and printed to the Serial Monitor every two seconds.
#include "bme688.h"
#include "esp_log.h"
#define I2C_MASTER_SCL_IO 22
#define I2C_MASTER_SDA_IO 21
#define I2C_MASTER_FREQ_HZ 100000
#define BME688_ADDR 0x76
static const char *TAG = "BME688";
void app_main() {
ESP_LOGI(TAG, "Initializing BME688...");
bme688_dev dev;
bme688_init(&dev, I2C_MASTER_SCL_IO, I2C_MASTER_SDA_IO, I2C_MASTER_FREQ_HZ, BME688_ADDR);
while (1) {
bme688_data data;
bme688_read(&dev, &data);
ESP_LOGI(TAG, "Temperature: %.2f°C", data.temperature);
ESP_LOGI(TAG, "Pressure: %.2f hPa", data.pressure);
ESP_LOGI(TAG, "Humidity: %.2f %%", data.humidity);
ESP_LOGI(TAG, "Gas Resistance: %.2f KOhms", data.gas_resistance / 1000.0);
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
}This ESP-IDF code configures the ESP32 to interface with the BME688 sensor over I²C. The bme688_init function initializes the sensor, and bme688_read fetches temperature, humidity, pressure, and gas resistance readings, which are logged to the console every two seconds.
sensor:
- platform: bme680
temperature:
name: "BME688 Temperature"
pressure:
name: "BME688 Pressure"
humidity:
name: "BME688 Humidity"
gas_resistance:
name: "BME688 Gas Resistance"
address: 0x76This ESPHome configuration integrates the BME688 sensor, allowing it to report temperature, pressure, humidity, and gas resistance values. The default I²C address of 0x76 is used.
platformio.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
adafruit/Adafruit BME680 Library
wire
monitor_speed = 115200main.cpp
#include <Wire.h>
#include "Adafruit_BME680.h"
Adafruit_BME680 bme;
void setup() {
Serial.begin(115200);
if (!bme.begin()) {
Serial.println("Could not find a valid BME688 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature: ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
Serial.print("Pressure: ");
Serial.print(bme.readPressure() / 100.0);
Serial.println(" hPa");
Serial.print("Humidity: ");
Serial.print(bme.readHumidity());
Serial.println(" %");
Serial.print("Gas Resistance: ");
Serial.print(bme.readGas() / 1000.0);
Serial.println(" KOhms");
delay(2000);
}This PlatformIO code configures the BME688 sensor using the Adafruit BME680 library. It reads and prints temperature, pressure, humidity, and gas resistance values to the Serial Monitor every two seconds.
Wrapping Up BME688
The ESP32 BME688 Environmental Sensor is a powerful environment sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the BME688 into your ESP32 project and bring your ideas to life!
Explore Alternative Sensors
Looking for alternatives to the BME688? Check out these similar sensors that might fit your project needs.

SHT40 Temperature and Humidity Sensor
The SHT40 is a high-accuracy digital temperature and humidity sensor with a compact design and low power consumption. Its I²C interface and...

SHTC3 Temperature and Humidity Sensor
The SHTC3 sensor offers precise temperature and humidity measurements in a compact and energy-efficient package. It is designed for...

BMP388 / CJMCU-388 Barometric Pressure Sensor
The BMP388 is a high-precision digital barometric pressure and temperature sensor, offering enhanced accuracy and stability. It supports...



