Gas resistance values from BME688 on Thingy:53

I'm interested in using the gas detector on the BME688 on my Thingy53. I've compiled and run zephyr/samples/sensor/bme680 using nRF Connect toolchain 2.3.0, and it produces reasonable output for temperature, pressure, and humidity. However the gas detector resistance value printed seems very high (more than 12 megaohms) and is unchanging, even when I breathe on it or put it in a sealed container with a few ml of isopropanol.

Does the Zephyr driver need to be updated to deal with differences between the 680 and the 688? This Bosch FAQ seems to suggest so. I understand there will be additional work required to use Bosch's fancy proprietary models, but I'd like to just see if the hardware is working.

Any suggestions for next steps?

Other tickets I found on DevZone:

Similar problem with stuck values, apparently unresolved.

A (partially?) successful attempt to use Bosch libraries, but no confirmation of success reading gas values.

Parents
  • Hi  I had a same problem.

    There's small difference between bme680 and bme688's register map.

    If you want to use gas sensor, you should set "run_gas" register in GAS_1_CTRL (0x70).

    However, ncs-zephyr's driver (which is in this directory : zephyr/drivers/sensor/bme680/bme680.c)
    doesn't set the "run_gas" bit field. 

    Because It's been to long that I figured this problem, I'm not sure the register's address and value was correct. But I ensure that it is not appropriate to use directly zephyr's bme680 driver to bme688.

    I changed the source like this which are in "zephyr/drivers/sensor/bme680"

    =========== ORIGIN  ===========

    bme680.c

    err = bme680_reg_write(dev, BME680_REG_CTRL_HUM, BME680_HUMIDITY_OVER);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CONFIG, BME680_CONFIG_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1,
    			       BME680_CTRL_GAS_1_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_RES_HEAT0,
    			       bme680_calc_res_heat(data, BME680_HEATR_TEMP));
    	if (err < 0) {
    		return err;
    	}

    bme680.h

    #define BME680_CHIP_ID 0x61
    
    #define BME680_LEN_FIELD     15
    #define BME680_LEN_COEFF_ALL 42
    #define BME680_LEN_COEFF1    23
    #define BME680_LEN_COEFF2    14
    #define BME680_LEN_COEFF3    5

    =========== NEW  ===========

    bme680.c

    	err = bme680_reg_write(dev, BME680_REG_CTRL_HUM, BME680_HUMIDITY_OVER);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CONFIG, BME680_CONFIG_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	// err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1,
    	// 		       BME680_CTRL_GAS_1_VAL);
    	// if (err < 0) {
    	// 	return err;
    	// }
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_0,
    			       0); // BME68X_ENABLE_HEATER	0x00
    	if (err < 0) {
    		return err;
    	}
    
    	uint8_t gas_1_ctrl_val;
    	gas_1_ctrl_val = BME680_CTRL_GAS_1_VAL | 0xa0;
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1, gas_1_ctrl_val);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_RES_HEAT0,
    			       bme680_calc_res_heat(data, BME680_HEATR_TEMP));
    	if (err < 0) {
    		return err;
    	}
    

    bme680.h

    // #define BME680_LEN_FIELD                15
    #define BME680_LEN_FIELD     17
    #define BME680_LEN_COEFF_ALL 42
    #define BME680_LEN_COEFF1    23
    #define BME680_LEN_COEFF2    14
    #define BME680_LEN_COEFF3    5

    Check the datasheet and register map I enveloped.
    bme688 --> BME688 Datasheet (bosch-sensortec.com)

    bme680 --> Newsletter-Template-DE (adafruit.com)

    Sincerely,

Reply
  • Hi  I had a same problem.

    There's small difference between bme680 and bme688's register map.

    If you want to use gas sensor, you should set "run_gas" register in GAS_1_CTRL (0x70).

    However, ncs-zephyr's driver (which is in this directory : zephyr/drivers/sensor/bme680/bme680.c)
    doesn't set the "run_gas" bit field. 

    Because It's been to long that I figured this problem, I'm not sure the register's address and value was correct. But I ensure that it is not appropriate to use directly zephyr's bme680 driver to bme688.

    I changed the source like this which are in "zephyr/drivers/sensor/bme680"

    =========== ORIGIN  ===========

    bme680.c

    err = bme680_reg_write(dev, BME680_REG_CTRL_HUM, BME680_HUMIDITY_OVER);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CONFIG, BME680_CONFIG_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1,
    			       BME680_CTRL_GAS_1_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_RES_HEAT0,
    			       bme680_calc_res_heat(data, BME680_HEATR_TEMP));
    	if (err < 0) {
    		return err;
    	}

    bme680.h

    #define BME680_CHIP_ID 0x61
    
    #define BME680_LEN_FIELD     15
    #define BME680_LEN_COEFF_ALL 42
    #define BME680_LEN_COEFF1    23
    #define BME680_LEN_COEFF2    14
    #define BME680_LEN_COEFF3    5

    =========== NEW  ===========

    bme680.c

    	err = bme680_reg_write(dev, BME680_REG_CTRL_HUM, BME680_HUMIDITY_OVER);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_CONFIG, BME680_CONFIG_VAL);
    	if (err < 0) {
    		return err;
    	}
    
    	// err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1,
    	// 		       BME680_CTRL_GAS_1_VAL);
    	// if (err < 0) {
    	// 	return err;
    	// }
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_0,
    			       0); // BME68X_ENABLE_HEATER	0x00
    	if (err < 0) {
    		return err;
    	}
    
    	uint8_t gas_1_ctrl_val;
    	gas_1_ctrl_val = BME680_CTRL_GAS_1_VAL | 0xa0;
    	err = bme680_reg_write(dev, BME680_REG_CTRL_GAS_1, gas_1_ctrl_val);
    	if (err < 0) {
    		return err;
    	}
    
    	err = bme680_reg_write(dev, BME680_REG_RES_HEAT0,
    			       bme680_calc_res_heat(data, BME680_HEATR_TEMP));
    	if (err < 0) {
    		return err;
    	}
    

    bme680.h

    // #define BME680_LEN_FIELD                15
    #define BME680_LEN_FIELD     17
    #define BME680_LEN_COEFF_ALL 42
    #define BME680_LEN_COEFF1    23
    #define BME680_LEN_COEFF2    14
    #define BME680_LEN_COEFF3    5

    Check the datasheet and register map I enveloped.
    bme688 --> BME688 Datasheet (bosch-sensortec.com)

    bme680 --> Newsletter-Template-DE (adafruit.com)

    Sincerely,

Children
Related