How to convert the gas resistance of bme680 sensor to IAQ in thingy53

Hi 
I am working on thingy53, Using Hello world application    NCS- 1.9.1

So I have enable the bme680 sensor of thingy53

I received the values for temp, pressure, humidity, gas resistance. ------How to change this gas resistance to IAQ value in thingy53-----  

This is my main.c 

/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr.h>
#include <drivers/sensor.h>

void main(void)
{
	
	const struct device *bme = DEVICE_DT_GET_ONE(bosch_bme680);
	struct sensor_value temp, press, humidity, gas_res;


	if (!device_is_ready(bme)) {
		printk("sensor: device not ready.\n");
		return;
	}
	printk("Device %p name is %s\n", bme, bme->name);

	while (1) {
		k_sleep(K_MSEC(3000));

		sensor_sample_fetch(bme);
		sensor_channel_get(bme, SENSOR_CHAN_AMBIENT_TEMP, &temp);
		sensor_channel_get(bme, SENSOR_CHAN_PRESS, &press);
		sensor_channel_get(bme, SENSOR_CHAN_HUMIDITY, &humidity);
		sensor_channel_get(bme, SENSOR_CHAN_GAS_RES, &gas_res);

		printk("T: %d.%06d | P: %d.%06d | H: %d.%06d | G: %d.%06d\n",
				temp.val1, temp.val2, press.val1, press.val2,
				humidity.val1, humidity.val2, gas_res.val1,
				gas_res.val2);
	}
}

And this is the output on RTT monitor

I have gone through many tickets but didn't find a solution.

Please help

Parents Reply
  • Hi

    Yes I have already looked at it. and even I have already asked about this above 

    Edited:- I read in the docs bsec_bme_settings_t::next_call field is used to determine the frequency between measurements.   Please goto line 71 in above file,you will see I have only added run_gas[1], should I need to add more, If yes then what to add and what to write in the respective fields 

    P.S- I only need IAQ 

    Could you help me to know how to do that--->

    t says that the sensor must be sampled periodically at the interval specified by the bsec_sensor_control() function.

    I have made changes and the next_call is updating in every call. But still, it is stuck to only one value of IAQ.

Children
Related