Problem with SGP30 sensor

Hello,
I'm trying to use the SGP30 gas sensor for ethanol measurements. Unfortunately the output shows 400 ppm for CO2 and zero for the other 4 values and it seems to be blocked (it doesn't change even after the 15-20 samples how it's written in the datasheet). I used both Adafruit and SparkFun lib and it gave me same results. Can anybody please help me?

welcome to the forum.

Please post your code, your schematic, and some good, clear photos of your setup.

For instructions to do that, please see the 'How to get the best out of this forum' post.

This is the code from the SparkFun lib:

`#include "SparkFun_SGP30_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_SGP30
#include <Wire.h>

SGP30 mySensor; //create an object of the SGP30 class
long t1, t2;
void setup() {
Serial.begin(9600);
Wire.begin();
//Sensor supports I2C speeds up to 400kHz
Wire.setClock(400000);
//Initialize sensor
if (mySensor.begin() == false) {
Serial.println("No SGP30 Detected. Check connections.");
while (1);
}
//Initializes sensor for air quality readings
//measureAirQuality should be called in one second increments after a call to initAirQuality
mySensor.initAirQuality();
t1 = millis();
}

void loop() {
//First fifteen readings will be
//CO2: 400 ppm TVOC: 0 ppb
t2 = millis();
if ( t2 >= t1 + 1000) //only will occur if 1 second has passed
{
t1 = t2;
//measure CO2 and TVOC levels
mySensor.measureAirQuality();
Serial.print("CO2: ");
Serial.print(mySensor.CO2);
Serial.print(" ppm\tTVOC: ");
Serial.print(mySensor.TVOC);
Serial.println(" ppb");
//get raw values for H2 and Ethanol
mySensor.measureRawSignals();
Serial.print("Raw H2: ");
Serial.print(mySensor.H2);
Serial.print(" \tRaw Ethanol: ");
Serial.println(mySensor.ethanol);
}
}`

And I'm using an Arduino uno board



Schematic?

You need to use the <CODE> button to get the code properly formatted - see the 'How to get the best out of this forum' post.

Sorry, I'm new in the forum

#include "SparkFun_SGP30_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_SGP30
#include <Wire.h>

SGP30 mySensor; //create an object of the SGP30 class
long t1, t2;
void setup() {
  Serial.begin(9600);
  Wire.begin();
  //Sensor supports I2C speeds up to 400kHz
  Wire.setClock(400000);
  //Initialize sensor
  if (mySensor.begin() == false) {
    Serial.println("No SGP30 Detected. Check connections.");
    while (1);
  }
  //Initializes sensor for air quality readings
  //measureAirQuality should be called in one second increments after a call to initAirQuality
  mySensor.initAirQuality();
  t1 = millis();
}

void loop() {
  //First fifteen readings will be
  //CO2: 400 ppm  TVOC: 0 ppb
  t2 = millis();
  if ( t2 >= t1 + 1000) //only will occur if 1 second has passed
  {
    t1 = t2;
    //measure CO2 and TVOC levels
    mySensor.measureAirQuality();
    Serial.print("CO2: ");
    Serial.print(mySensor.CO2);
    Serial.print(" ppm\tTVOC: ");
    Serial.print(mySensor.TVOC);
    Serial.println(" ppb");
    //get raw values for H2 and Ethanol
    mySensor.measureRawSignals();
    Serial.print("Raw H2: ");
    Serial.print(mySensor.H2);
    Serial.print(" \tRaw Ethanol: ");
    Serial.println(mySensor.ethanol);
  }
}

I have the same Problem, do you have a solution for that? When I use the Adafruit libary, I get the error code: Raw Measurement failed!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.