Skip to content

Issue in retriving the PM Mass Concentration values of Sensiron sen66 #14

Description

@KaviGowtham1

Hello,

I have interfaced my ESP32 with the Sensirion SEN66 sensor. While using the embedded I2C Sen66 driver you provided, I observed that the PM mass concentration values are being received incorrectly, whereas all other parameters are received correctly. I have attached the relevant proofs for reference. Could you please clarify this issue as soon as possible?
I've Attached the code i've written, the Output of it and the PM original Value confirmed by the SensorBridge (control center)

Here is the code i've written:

`#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#include "sensirion_config.h"
#include "sensirion_common.h"
#include "sensirion_i2c.h"
#include "sensirion_i2c_hal.h"
#include "sen66_i2c.h"

#define SEN66_I2C_ADDR SEN66_I2C_ADDR_6B

void app_main(void) {
int16_t err;
uint8_t padding = 0;
bool data_ready = false;

// Init I2C HAL (GPIO 21/22 in sensirion_i2c_hal.c)
sensirion_i2c_hal_init();
sensirion_i2c_hal_select_bus(0);
sen66_init(SEN66_I2C_ADDR);

printf("SEN66 demo starting...\r\n");

err = sen66_start_fan_cleaning();
if (err != NO_ERROR) {
    printf("Error fan cleaning: %d\r\n", err);
    return;
}

err = sen66_start_continuous_measurement();
if (err != NO_ERROR) {
    printf("Error start: %d\r\n", err);
    return;
}

sensirion_i2c_hal_sleep_usec(1500000); // 1.5 s warm-up
while (1) {
    uint16_t mc_pm1p0, mc_pm2p5, mc_pm4p0, mc_pm10p0;
    int16_t  rh_raw, t_raw, voc_index, nox_index;
    uint16_t co2_ppm;	
    err = sen66_get_data_ready(&padding, &data_ready);
    if (err != NO_ERROR) {
        printf("DataReady err: %d\r\n", err);
        break;
    }
    if (!data_ready) {
        sensirion_i2c_hal_sleep_usec(200000);
        continue;
    }

    // Mass concentration + T/RH/VOC/NOx/CO2
    err = sen66_read_measured_values_as_integers(
        &mc_pm1p0, &mc_pm2p5, &mc_pm4p0, &mc_pm10p0,
        &rh_raw, &t_raw, &voc_index, &nox_index, &co2_ppm);
    if (err != NO_ERROR) {
        printf("Read mass conc err: %d\r\n", err);
        break;
    }
		
	// PM MASS concentration
	float pm1p0  = mc_pm1p0  / 10.0f;
	float pm2p5  = mc_pm2p5  / 10.0f;
	float pm4p0  = mc_pm4p0  / 10.0f;
	float pm10p0 = mc_pm10p0 / 10.0f;
	
	// RH, Temperature, VOC, NOx 
	float rh     = rh_raw    / 100.0f;
	float temp_c = t_raw     / 200.0f;
	float nox    = nox_index / 10.0f;
	float voc    = voc_index / 10.0f;


    printf("T = %.2f C, RH = %.2f %%\r\n", temp_c, rh);
    printf("Mass: PM1.0=%.1f PM2.5=%.1f PM4.0=%.1f PM10=%.1f ug/m3\r\n",
           pm1p0, pm2p5, pm4p0, pm10p0);
    printf("NOx index=%.1f, CO2=%u ppm, VOC index=%.1f\r\n\r\n",
           nox, (unsigned)co2_ppm, voc);

    sensirion_i2c_hal_sleep_usec(1000000); // 1 s
}


sen66_stop_measurement();
sensirion_i2c_hal_free();

}`

Image Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions