Troubleshooting

Issues with the Gas sensor on the SEN0629 (BME688)

userHead art.pm 2026-08-05 23:38:07 14 Views0 Replies

Hi there!

 

I try to make the SEN0629 measuring Gas level, but can't make it working. I hope someone here may have a solution…

 

I use ESP32 to collect data from many sensors and drive some devices in the automated mini greenhouse. 

My whole project is written in microPython. Just wanted to add one more sensor, the BME688 (SEN0629).

 

1. I tried this library for Python: https://github.com/DFRobot/DFRobot_BME68x/blob/master/Python/RaspberryPi/DFRobot_BME68x.py with this demo code: https://github.com/DFRobot/DFRobot_BME68x/blob/master/Python/RaspberryPi/examples/demo_read_all_data.py

I had to remove „future” part and add some lines to handle the I2C communication. My main code looks like this:

 

from DFRobot_BME68x import DFRobot_BME68x
import time

from machine import I2C, Pin

 

class MicroPythonSMBus:
   """Wrapper that translates SMBus method calls to MicroPython machine.I2C calls."""
   def __init__(self, i2c_bus):
       self.i2c = i2c_bus

   def read_byte_data(self, addr, register):
       return self.i2c.readfrom_mem(addr, register, 1)[0]

   def read_i2c_block_data(self, addr, register, length):
       return list(self.i2c.readfrom_mem(addr, register, length))

   def write_byte_data(self, addr, register, value):
       self.i2c.writeto_mem(addr, register, bytes([value]))

   def write_i2c_block_data(self, addr, register, data):
       self.i2c.writeto_mem(addr, register, bytes(data))

 

# Initialize MicroPython I2C 
hardware_i2c = I2C(0, scl=Pin(22), sda=Pin(21), freq=100000)
i2c_adapter = MicroPythonSMBus(hardware_i2c)

 

# Instantiate the sensor using the adapter as i2c_device
sensor = DFRobot_BME68x(i2c_addr=0x76, i2c_device=i2c_adapter)

 

sensor.set_humidity_oversample(sensor.OS_2X) #Oversampling value: OS_NONE, OS_1X, OS_2X, OS_4X, OS_8X, OS_16X
sensor.set_pressure_oversample(sensor.OS_4X) #Oversampling value: OS_NONE, OS_1X, OS_2X, OS_4X, OS_8X, OS_16X
sensor.set_temperature_oversample(sensor.OS_8X) #Oversampling value: OS_NONE, OS_1X, OS_2X, OS_4X, OS_8X, OS_16X
sensor.set_filter(sensor.FILTER_SIZE_3) #increasing resolution but reducing bandwidth
sensor.set_gas_status(sensor.ENABLE_GAS_MEAS) #1 for enable and 0 for disable

 

sensor.set_gas_heater_temperature(320) #value:target temperature in degrees celsius, between 200 ~ 400
sensor.set_gas_heater_duration(150) #value:target duration in milliseconds, between 1 and 4032
sensor.select_gas_heater_profile(0) #value:current gas sensor conversion profile: 0 to 9

 

print("\n\nPolling:")
while True:
   if sensor.get_sensor_data():
       print("Temperature:", sensor.data.temperature, "°C")
       print("Pressure:", sensor.data.pressure, "hPa")
       print("Humidity:", sensor.data.humidity, "%")
       print("Gas Resistance:", sensor.data.gas_resistance, "Ohms")
   time.sleep(5)

 

In the driver lib I just removed the “import smbus” because it caused issues. The rest remained as it was.

 

The first readings were around:

Temperature: 28.16 °C

Pressure: 984.41 hPa

Humidity: 50.771 %

Gas Resistance: 12895.426 Ohms

 

But for every measurement, the Gas Resistance went down.

At some point it reached the 2842.423 Ohms and it’s stuck:

Temperature: 27.41 °C
Pressure: 984.23 hPa
Humidity: 56.042 %
Gas Resistance: 2842.423 Ohms

 

Similar behavior was when I tried the C library. It was stuck immediately.

 

2. I tried also the official library in C/C++ from Bosch, so from the: https://github.com/boschsensortec/BME68x_SensorAPI. 

Behavior was the same - gas started at some level, then it slowly went down up to 5684.85 Ohm and got stuck on that value. I tried to change the environment, breath on the sensor etc. - nothing happened.

 

3. I found also a microPython solution from the https://docs.soldered.com/bme688/micropython/examples/ When I run that, the gas changes and it’s not stuck, but it’s totally random, like on the attached screen below. The range is from results like 1870 to 63859684 without any trends and with no signs of stability.

 

I kept the sensor running for burn-in for around 2 days now.

 

I'm not sure if that's the:

- sensor issue- software issue- wiring or other electrical issue

 

Just wanted to ask:

1. Which library is 100% reliable and I should use it for the SEN0629 connected to the ESP32 devkit v1? It can be either C or microPython. I prefer microPython, but if there is no choice, I can use the C/C++ code.

2. Should I still wait a few days for the burn-in?

3. Did anyone face issues like that with the SEN0629 / BME688?