mauriciobarroso / bme68x_lib Goto Github PK
View Code? Open in Web Editor NEWESP-IDF component for BME680 and BME688 4 in 1 enviromental sensors
License: MIT License
ESP-IDF component for BME680 and BME688 4 in 1 enviromental sensors
License: MIT License
Hello,
I just got a BME688 and a ESP32C6 wroom board, so I'm using the latest master on esp-idf to have support for esp32c6. I tried to do something like this in app main:
i2c_t i2cinfo;
i2cinfo.i2c_addr = BME68X_I2C_ADDR_LOW;
i2cinfo.i2c_conf = conf;
i2cinfo.i2c_num = 0;
memset(&bsec2_dev, 0, sizeof(bsec2_t));
bsec2_init(&bsec2_dev, &i2cinfo, BME68X_I2C_INTF);
if (bsec2_dev.status != 0)
{
printf("Something is wrong with bme688 %d \n", bsec2_dev.status);
}
bsec_sensor_configuration_t requested_virtual_sensors[7];
uint8_t n_requested_virtual_sensors = BSEC_MAX_PHYSICAL_SENSOR;
requested_virtual_sensors[0].sensor_id = BSEC_OUTPUT_IAQ;
requested_virtual_sensors[0].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[1].sensor_id = BSEC_OUTPUT_RAW_TEMPERATURE;
requested_virtual_sensors[1].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[2].sensor_id = BSEC_OUTPUT_RAW_PRESSURE;
requested_virtual_sensors[2].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[3].sensor_id = BSEC_OUTPUT_RAW_HUMIDITY;
requested_virtual_sensors[3].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[4].sensor_id = BSEC_OUTPUT_RAW_GAS;
requested_virtual_sensors[4].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[5].sensor_id = BSEC_OUTPUT_STABILIZATION_STATUS;
requested_virtual_sensors[5].sample_rate = BSEC_SAMPLE_RATE_CONT;
requested_virtual_sensors[6].sensor_id = BSEC_OUTPUT_RUN_IN_STATUS;
requested_virtual_sensors[6].sample_rate = BSEC_SAMPLE_RATE_CONT;
// Allocate a struct for the returned physical sensor settings
bsec_sensor_configuration_t required_sensor_settings[BSEC_MAX_PHYSICAL_SENSOR];
uint8_t n_required_sensor_settings = BSEC_MAX_PHYSICAL_SENSOR;
// Call bsec_update_subscription() to enable/disable the requested virtual sensors
bsec_library_return_t update_result = bsec_update_subscription(requested_virtual_sensors, n_requested_virtual_sensors, required_sensor_settings, &n_required_sensor_settings);
printf("update sub result is %d \n", update_result);
xTaskCreate(bme_task, "bme688", 4096, NULL, 5, NULL);
Then in the task I'm doing requestion data from bme688 with:
bsec2_run(&bsec2_dev);
vTaskDelay(5000 / portTICK_PERIOD_MS);
bsec_outputs_t *thisout = bsec2_get_outputs(&bsec2_dev);
if (thisout)
printf("bme688 Sensor id: %.2d %%\n", thisout->output->sensor_id);
}
bsec_data_t temp_data = bsec2_get_data(&bsec2_dev, BSEC_OUTPUT_RAW_TEMPERATURE);
printf("temp data is %0.2f \n", temp_data.signal);
but im getting I2C error, so I looked into the I2C stuff and it seems to using the wrong i2c number and/or i2c address?
Sorry my code is super messy, I'm quite new to the esp-idf stuff and also bme688, so everything seems quite difficult for me, I wonder if you can point me in the right direction on how to properly use this?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.