ROS2 Jazzy driver for the Bosch BME680 environmental sensor (temperature, pressure, humidity, gas/VOC) over I2C.
- Publishes
sensor_msgs/FluidPressureonbme680/pressure - Publishes
sensor_msgs/Temperatureonbme680/temperature - Publishes
sensor_msgs/RelativeHumidityonbme680/humidity - Publishes
std_msgs/Float32onbme680/gas_resistance(Ohms) fake_modefor testing without hardware (random Gaussian data)- Configurable oversampling (pressure, temperature, humidity) and IIR filter
- Configurable gas heater temperature and duration
- Runtime
publish_ratechange viaros2 param set - Calibration and reset services
There is an existing BME280 driver (mingyo186/bme280_env). This package extends the same pattern with gas resistance (VOC) measurement:
| Feature | bme280_env | This package (bme680_env) |
|---|---|---|
| Temperature | Yes | Yes |
| Pressure | Yes | Yes |
| Humidity | Yes | Yes |
| Gas Resistance (VOC) | No | Yes (bme680/gas_resistance) |
| Gas Heater Config | N/A | Configurable temp & duration |
| Operating Mode | Normal (continuous) | Forced (per-measurement) |
| Topics | 3 | 4 |
Choose bme280_env if you only need temperature, pressure, and humidity. Choose this package if you also need VOC/air quality (gas resistance) measurement.
- ROS 2 Jazzy
- Python 3
smbus2(only for real hardware:pip install smbus2)
cd ~/ros2_ws
colcon build --packages-select bme680_env --symlink-install
source install/setup.bashros2 launch bme680_env bme680_launch.pyros2 run bme680_env bme680_node.pyros2 launch bme680_env bme680_launch.py \
params_file:=path/to/your_params.yamlSet fake_mode: false in your YAML file.
ros2 launch bme680_env bme680_launch.py \
params_file:=/path/to/custom_params.yamlros2 topic echo /bme680/pressure
ros2 topic echo /bme680/temperature
ros2 topic echo /bme680/humidity
ros2 topic echo /bme680/gas_resistance| Parameter | Type | Default | Description |
|---|---|---|---|
fake_mode |
bool | true |
Generate random data without hardware |
i2c_bus |
int | 1 |
I2C bus number (/dev/i2c-N) |
device_address |
int | 0x76 |
I2C address (ALT: 0x77) |
publish_rate |
float | 1.0 |
Publishing rate in Hz (runtime changeable) |
frame_id |
string | bme680_link |
TF frame ID |
pressure_oversampling |
int | 5 |
0=skip, 1=x1, 2=x2, 3=x4, 4=x8, 5=x16 |
temperature_oversampling |
int | 2 |
0=skip, 1=x1, 2=x2, 3=x4, 4=x8, 5=x16 |
humidity_oversampling |
int | 1 |
0=skip, 1=x1, 2=x2, 3=x4, 4=x8, 5=x16 |
iir_filter |
int | 4 |
0=off, 1=2, 2=4, 3=8, 4=16 |
gas_heater_temp |
int | 320 |
Gas heater target temperature (C) |
gas_heater_duration |
int | 150 |
Gas heater duration (ms) |
pressure_variance |
float | 0.0 |
Pressure variance (0 = unknown) |
temperature_variance |
float | 0.0 |
Temperature variance (0 = unknown) |
humidity_variance |
float | 0.0 |
Humidity variance (0 = unknown) |
| Service | Type | Description |
|---|---|---|
bme680/calibrate |
std_srvs/srv/Trigger |
Collect samples for 2 s, compute pressure bias |
bme680/reset |
std_srvs/srv/Trigger |
Clear bias, reinitialize sensor |
bme680_env/
├── CMakeLists.txt
├── package.xml
├── config/
│ └── bme680_params.yaml
├── launch/
│ └── bme680_launch.py
├── bme680_env/
│ ├── __init__.py
│ └── bme680_driver.py
├── nodes/
│ └── bme680_node.py
├── test/
│ └── test_bme680_node.py
├── .gitignore
├── LICENSE
├── CONTRIBUTING.md
└── README.md
Tested on Ubuntu 24.04 (WSL2) with fake_mode: true.
| Test Category | Test | Result |
|---|---|---|
| Topics | bme680/pressure publishes sensor_msgs/FluidPressure |
PASS |
| Topics | bme680/temperature publishes sensor_msgs/Temperature |
PASS |
| Topics | bme680/humidity publishes sensor_msgs/RelativeHumidity |
PASS |
| Topics | bme680/gas_resistance publishes std_msgs/Float32 |
PASS |
| Services | bme680/calibrate returns success=True |
PASS |
| Services | bme680/reset returns success=True |
PASS |
| Parameters | publish_rate runtime change |
PASS |
| Shutdown | Clean exit | PASS |
| Linting | pep257, flake8, copyright, xmllint | PASS |
MIT