This Arduino library wraps the BME68x Sensor API to provide a simpler experience when using BME680 or BME688 sensors from Bosch Sensortec.
This version is optimized for UNIT Electronics development boards.
This library is based on the official Bosch-BME68x-Library fork and has been adapted to improve compatibility with UNIT Electronics development boards.
- UNIT TouchDot S3 - ESP32-S3 based, circular wearable design with NeoPixel RGB LED
- UNIT Pulsar ESP32-C6 - ESP32-C6 RISC-V based with Wi-Fi 6, Bluetooth 5, Matter, Thread support
- UNIT DualMCU ONE - Dual MCU ESP32 + RP2040
- UNIT DualMCU - ESP32 + RP2040 Development Board
- Arduino Uno/Nano/Mega
- Generic ESP32/ESP32-S3/ESP32-C3/ESP32-C6 boards
- Other Arduino-compatible boards
- Open Arduino IDE
- Go to Sketch → Include Library → Add .ZIP Library
- Select the ZIP file of this library
- Restart Arduino IDE
Add this line to your platformio.ini:
lib_deps =
https://github.com/UNIT-Electronics-MX/unit_bme68x_libraryunit_touchdot_s3_basic- Basic example for UNIT TouchDot S3unit_pulsar_c6_advanced- Advanced example for UNIT Pulsar ESP32-C6 with IoT featuresunit_dualmcu_dual_core- Dual-core example for UNIT DualMCU boardsunit_low_power_optimized- Low power consumption example for battery-powered projects
forced_mode- Basic forced modesequential_mode- Sequential modeparallel_mode- Parallel modebme688_dev_kit- For BME688 development kit
BME68x TouchDot S3
VCC → 3.3V
GND → GND
SCL → GPIO 8 (I2C)
SDA → GPIO 9 (I2C)
Note: TouchDot S3 has QWIIC connector for easy I2C connection
BME68x Pulsar C6
VCC → 3.3V
GND → GND
SCL → GPIO 7 (I2C)
SDA → GPIO 6 (I2C)
Note: Pulsar C6 has QWIIC connector for plug-and-play sensor connection
ESP32 Side:
BME68x ESP32
VCC → 3.3V
GND → GND
SCL → GPIO 22 (I2C)
SDA → GPIO 21 (I2C)
RP2040 Side:
BME68x RP2040
VCC → 3.3V
GND → GND
SCL → GPIO 5 (I2C)
SDA → GPIO 4 (I2C)
#include "bme68xLibrary.h"
#include "Wire.h"
Bme68x bme;
void setup() {
Serial.begin(115200);
Wire.begin(9, 8); // SDA=9, SCL=8 for TouchDot S3
// Initialize sensor (I2C)
bme.begin(BME68X_I2C_ADDR_LOW, Wire);
// Configure TPH (Temperature, Pressure, Humidity)
bme.setTPH();
// Configure heater (300°C for 100ms)
bme.setHeaterProf(300, 100);
}
void loop() {
bme68xData data;
bme.setOpMode(BME68X_FORCED_MODE);
delay(bme.getMeasDur(BME68X_FORCED_MODE));
if (bme.fetchData() && bme.getData(data)) {
Serial.println("Temp: " + String(data.temperature) + "°C");
Serial.println("Hum: " + String(data.humidity) + "%");
Serial.println("Press: " + String(data.pressure / 100.0) + " hPa");
Serial.println("Gas: " + String(data.gas_resistance) + " Ohms");
}
delay(1000);
}#include "bme68xLibrary.h"
#include "Wire.h"
Bme68x bme;
void setup() {
Serial.begin(115200);
Wire.begin(6, 7); // SDA=6, SCL=7 for Pulsar C6
if (!bme.begin(BME68X_I2C_ADDR_LOW, Wire)) {
Serial.println("BME68x sensor not found!");
while(1);
}
bme.setTPH();
bme.setHeaterProf(320, 150); // Optimized for C6
}
void loop() {
bme68xData data;
bme.setOpMode(BME68X_FORCED_MODE);
delay(bme.getMeasDur(BME68X_FORCED_MODE));
if (bme.fetchData() && bme.getData(data)) {
// JSON output for IoT applications
Serial.printf("{\"temp\":%.2f,\"hum\":%.2f,\"press\":%.2f,\"gas\":%u}\n",
data.temperature, data.humidity,
data.pressure/100.0, data.gas_resistance);
}
delay(2000);
}The library includes automatic board detection:
#include "bme68xLibrary.h"
void setup() {
// Auto-detect and configure for UNIT Electronics boards
Bme68x bme;
if (bme.beginAutoDetect()) {
Serial.println("BME68x initialized for UNIT board!");
}
}Found a bug or want to improve the library?
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the BSD-3-Clause License. See LICENSE for more information.
Copyright (c) 2021 Bosch Sensortec GmbH
Copyright (c) 2025 UNIT Electronics