Interfacing Boche BME680

Hi,

I am trying the sample code in this regard. I have changed the I2C pins in the overllay file and bme register address to 0x77 as follows. It seems working but I have many questions.

&i2c0 {
	compatible = "nordic,nrf-twi";
	status = "okay";
	bme680: bme680@77 {
		compatible = "bosch,bme680";
		label = "BME680";
		reg = <0x77>;
	};
};

1. I think this is using the Zephyr built in bme680 driver, isn't it?

2. I am evaluating both BME680 and BME688.  How can I change code to suit BME688?

3. My case is a battery powered sensor, so I have to make it as much power efficient as possible. The sample program doesnt seem to meet that goal. I tried commenting out each channel and it doesn't seem that affect the power consumption.  I tried using 'sensor_sample_fetch_chan (dev, SENSOR_CHAN_AMBIENT_TEMP) just to fetch temp channel, but still same. Any idea why?

4. I want to read/write registers of the sensor, but Sensor API doesn't seem to provide any interface. How can I do  this?

Cheers,

Kaushalya

Parents
  • Hello, 

    Both sensors have been in use in our samples and prototyping platforms Thingy:53 and Thingy:91. What version of our SDK are you using? The information below is based on nRF Connect SDK v2.8.0.

    1. I think this is using the Zephyr built in bme680 driver, isn't it?

    Yes, looking at zephyr\boards\nordic\thingy53\thingy53_nrf5340_common.dtsi

    &i2c1 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	clock-frequency = <I2C_BITRATE_FAST>;
    
    	pinctrl-0 = <&i2c1_default>;
    	pinctrl-1 = <&i2c1_sleep>;
    	pinctrl-names = "default", "sleep";
    	bmm150: bmm150@10 {
    		compatible = "bosch,bmm150";
    		reg = <0x10>;
    	};
    
    	bh1749: bh1749@38 {
    		compatible = "rohm,bh1749";
    		reg = <0x38>;
    		int-gpios = <&gpio1 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    	};
    
    	bme688: bme688@76 {
    		compatible = "bosch,bme680";
    		reg = <0x76>;
    	};
    };

    2. I am evaluating both BME680 and BME688.  How can I change code to suit BME688?

    Have a the look at the BME68x: Gas sensor sample. This supports both sensors. You can also have a look the samples in our SDK that uses these sensors i.e. the sensor module in Asset Tracker v2 or the Bluetooth Mesh: sensor sample.

    3. My case is a battery powered sensor, so I have to make it as much power efficient as possible. The sample program doesnt seem to meet that goal. I tried commenting out each channel and it doesn't seem that affect the power consumption.  I tried using 'sensor_sample_fetch_chan (dev, SENSOR_CHAN_AMBIENT_TEMP) just to fetch temp channel, but still same. Any idea why?

    I'm not that familiar with the BME68x devices. What sample program are you referring to? The Sensors API in the Zephyr OS does have power management features
    There are options to set ultra low power using CONFIG_BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER=y but I recommend looking through the BME68x driver documentation.

    4. I want to read/write registers of the sensor, but Sensor API doesn't seem to provide any interface. How can I do  this?

    I think you will need to look at the Sensor API 

    I hope this helps and provides some answers.

    Kind regards,
    Øyvind

  • Hi,

    Thanks for the reply.

    My SDK is 2.6.0.

    2. Unfortunately I cant find any driver like bme68x_irq under my 'drivers/sensor' folder. How can I install the bme68x driver code?

    3. I have managed to cut the power by turning off the heater for gas measurements. But I had to comment out the line 219 in bme680.c in 'drivers/sensor/bme680/'. The line is 

    __ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL)
    This seems like the 'chan' variable has to be SENSOR_CHAN_ALL or otherwise a kernel panic would occur. I want to measure just temp and humidity channel. What is the reason for this _ASSERT ?
    Cheers,
    Kaushalya
  • Hi

    kaushalyasat said:
    Unfortunately I cant find any driver like bme68x_irq under my 'drivers/sensor' folder. How can I install the bme68x driver code?

    Have you followed the documentation for the BME68x driver?

    kaushalyasat said:
    This seems like the 'chan' variable has to be SENSOR_CHAN_ALL or otherwise a kernel panic would occur. I want to measure just temp and humidity channel. What is the reason for this _ASSERT ?

    The __ASSERT_NO_MSG() macro can be used to perform an assertion that reports the failed test and its location, but lacks additional debugging information provided to assist the user in diagnosing the problem; its use is discouraged.

    Do you actually get an error from your side? Does the sample work out of the box without editing anything

    Kind regards,
    Øyvind

  • Hi Øyvind,

    Thanks. I have added the bme68x_irq to my 2.6.0 SDK. However the sample I found was in nrf folder and it would have been much better if this is mentioned in the 'BME68X: Gas Sensor' page, as there are other samples folders as well with bme680. 

    I managed to get the sample running and can see the iaq, CO2 and VOC readings. I see these increases when I bring a permanent marker near the sensor and goes down after removing it. So I reckon the sensor is working. 

    Do you actually get an error from your side? Does the sample work out of the box without editing anything

    I think out of the box it worked. Then I wanted to fetch just individual channels and then I got the kernel panic. For individual channels, I changed the fetch to fetch_chan and specified chan as SENSOR_CHAN_AMBIENT_TEMP. Then I got the kernel panic. Cant figure out the logic behind the assert as it seems like if the chan is not SENSOR_CHAN_ALL, it would make a kernel panic. But after I moved to bme68x_iaq, I haven't noticed that. 

    But since I now can get the bme68x_irq working, I integrated it to my sensor app, which is a SED. I set following in the prj.conf.

    CONFIG_I2C=y
    CONFIG_SENSOR=y
    CONFIG_SENSOR_INFO=y
    
    CONFIG_BME680=n
    CONFIG_BME68X_IAQ=y
    CONFIG_CONSOLE=y
    CONFIG_LOG=y
    CONFIG_BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER=y

    I can see a sample being taken every 5 minutes. 

    1. My console seems to hang after this sample is taken. No log messages are printed as well. 

    2. I want to get temp and humidity samples every 60 sec and VOC every 10 minutes. How can I configure the timing?

    Cheers,

    Kaushalya

  • Hi Øyvind,

    1. While I am trying to integrate it with my sensor code, when I add 

    CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER=y
    to my prj.conf, I get build error
    C:/ncs/v2.6.0/nrf/drivers/sensor/bme68x_iaq/bme68x_iaq.c:463:35: error: 'BSEC_SAMPLE_PERIOD_S' undeclared
    But when I use 
    CONFIG_BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER=y
    then no prob. 
    I can see the 
    BSEC_SAMPLE_PERIOD_S is defined in CMakeLists.txt in the driver folder. Why am I getting a build error when I use 
    CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER ?
    2. Also for a long time all my iaq measurements are static no matter what I do. I always get 
    iaq: 50; CO2: 500.000000; VOC: 0.499999
    But my temp and humidity changes. I had it working in one instance. 
    All of a sudden my iaq, co2 and voc values start changing. After that they seem to respond correctly. 
    Does this means BME688 takes some time before the iaq, co2 and voc data becomes available?
    Cheers,
    Kaushalya
Reply
  • Hi Øyvind,

    1. While I am trying to integrate it with my sensor code, when I add 

    CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER=y
    to my prj.conf, I get build error
    C:/ncs/v2.6.0/nrf/drivers/sensor/bme68x_iaq/bme68x_iaq.c:463:35: error: 'BSEC_SAMPLE_PERIOD_S' undeclared
    But when I use 
    CONFIG_BME68X_IAQ_SAMPLE_RATE_ULTRA_LOW_POWER=y
    then no prob. 
    I can see the 
    BSEC_SAMPLE_PERIOD_S is defined in CMakeLists.txt in the driver folder. Why am I getting a build error when I use 
    CONFIG_BME68X_IAQ_SAMPLE_RATE_QUICK_ULTRA_LOW_POWER ?
    2. Also for a long time all my iaq measurements are static no matter what I do. I always get 
    iaq: 50; CO2: 500.000000; VOC: 0.499999
    But my temp and humidity changes. I had it working in one instance. 
    All of a sudden my iaq, co2 and voc values start changing. After that they seem to respond correctly. 
    Does this means BME688 takes some time before the iaq, co2 and voc data becomes available?
    Cheers,
    Kaushalya
Children
No Data
Related