Sensirion I2C SGP41 lib - measureRawSignals() error

Hello community,

I have installed Sensirion I2C SGP41 lib in a new project, but still I don’t manage to read any sensor values. The SGP41 is connected to ESP32-S3 with SDA pin 37 and SCL pin 38. I can read the serial number but the sensor data values are blank.

Does anyone have any idea what is going wrong here?

Thanks in advance
Alex

Code:

#include <Arduino.h>

#include <SensirionI2CSgp41.h>

#include <Wire.h>

SensirionI2CSgp41 sgp41;

// time in seconds needed for NOx conditioning

uint16_t conditioning_s = 10;

void setup() {

Serial.begin(115200);

while (!Serial) {

    delay(100);

}

Wire.setPins(37,38);

Wire.begin();

uint16_t error;

char errorMessage[256];

sgp41.begin(Wire);

uint16_t serialNumber[3];

uint8_t serialNumberSize = 3;

error = sgp41.getSerialNumber(serialNumber, serialNumberSize);

if (error) {

    Serial.print("Error trying to execute getSerialNumber(): ");

    errorToString(error, errorMessage, 256);

    Serial.println(errorMessage);

} else {

    Serial.print("SerialNumber:");

    Serial.print("0x");

    for (size_t i = 0; i < serialNumberSize; i++) {

        uint16_t value = serialNumber[i];

        Serial.print(value < 4096 ? "0" : "");

        Serial.print(value < 256 ? "0" : "");

        Serial.print(value < 16 ? "0" : "");

        Serial.print(value, HEX);

    }

    Serial.println();

}

uint16_t testResult;

error = sgp41.executeSelfTest(testResult);

if (error) {

    Serial.print("Error trying to execute executeSelfTest(): ");

    errorToString(error, errorMessage, 256);

    Serial.println(errorMessage);

} else if (testResult != 0xD400) {

    Serial.print("executeSelfTest failed with error: ");

    Serial.println(testResult);

}

}

void loop() {

uint16_t error;

char errorMessage[256];

uint16_t defaultRh = 0x8000;

uint16_t defaultT = 0x6666;

uint16_t srawVoc = 0;

uint16_t srawNox = 0;

delay(1000);

if (conditioning_s > 0) {

    // During NOx conditioning (10s) SRAW NOx will remain 0

    error = sgp41.executeConditioning(defaultRh, defaultT, srawVoc);

    conditioning_s--;

} else {

    // Read Measurement

    error = sgp41.measureRawSignals(defaultRh, defaultT, srawVoc, srawNox);

}

if (error) {

    Serial.print("Error trying to execute measureRawSignals(): ");

    errorToString(error, errorMessage, 256);

    Serial.println(errorMessage);

} else {

    Serial.print("SRAW_VOC:");

    Serial.print(srawVoc);

    Serial.print("\t");

    Serial.print("SRAW_NOx:");

    Serial.println(srawNox);

}

}

Monitor output:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x39c
load:0x403b6000,len:0x9a4
load:0x403ba000,len:0x2868
entry 0x403b61c0
SerialNumber:0x000001936FB5
Error trying to execute executeSelfTest(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received
Error trying to execute measureRawSignals(): Not enough data received

Maybe the library author at Issues · Sensirion/arduino-i2c-sgp41 · GitHub some insights.

Hello,
I’m facing the exact same issue as you are. @alexander.almendinge Were you able to find any resolution? Thanks for helping out.

Hello,
yes, after Sensirion company was involved, the root cause was found.

The PCB supplier (pcbgogo) assembled engineering samples that were never supposed to go into production. You have to use production parts for correct operations.

Thanks for the update. I purchased the ICs from digikey, perhaps they have old inventory or stock? I will look into it.

@alexander.almendinge, Is there a method you know that I could use to determine whether parts are engineering samples or production parts? Maybe something unique in the serial number? Thanks.

The cause on my side was determined from the label shown below
image001