>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

SGP30 not detected with SHT30 on DIY board

I am currently using an SHT30 on my DIY board and everything is working great, however, if I try to add an SGP30 to the same board, the SGP30 isn’t detected, at all.

I can test the SGP30 on an Arduino Mega 2560 with a sample sketch, it shows up and works correctly, but as soon as I attach it to the (v1) DIY PCB, which already has an SHT30 attached, it doesn’t show up at all, even with the same example sketch.

I’ve tried the I2C Address Finder and on the DIY PCB, it detects 0x3C (OLED) and 0x44 (SHT30), but not the SGP30. This stays the same even if I remove the OLED, which others have suggested in different threads. I’ve also tried the SGP30 on both 3.3v and 5v - Both voltages work fine when testing on the Mega. I’ve also tried example sketches for the SGP30 and they all fail on the DIY board but work fine on the Mega.

At this point, the only thing I can think of is that the SGP30 and SHT30 are incompatible with eachother, although, I really hope that isn’t the case.

I’m using the Jeff Geerling sketch, although I doubt that makes much difference in this instance.

I don’t (currently) have a spare SHT30 to test having both devices on the Mega 2560 to see if it’s all detected OK on there.

Does anyone have any ideas at all as to what I can try to make it all work together?

Thanks in advance

Do you also have the OLED shield connected? If so, try removing it and running with only SGP30 and SHT30

Tried it both with and without the OLED shield, and on both 3.3v and 5v to no avail

I had this same issue. All components from the DIY kit but adding an SGP30. The only way the SGP30 would work is to remove the OLED shield and do reset of the board. I grabbed this i2c scanner code and call it in the loop along with a handful of debug info that let me see what’s working or not. I’m also using RobTillaart/SGP30 library for the SGP30.

void loop() {
  i2cScanner();
  ...
  // Other measurements
  ...
  if (hasTVOC) {
    bool sgpConnected = SGP.isConnected();
    bool test = SGP.measureTest();
    uint16_t features = SGP.getFeatureSet();
    // This should output 
    // [TVOC] SGP test result: true, SGP connect: true, Features: 34
    // converting 0x0022 to string results in 34
    Serial.println("[TVOC] SGP test result: " + String(test) + ", SGP connected: " + String(sgpConnected) + ", Features: " + String(features));
    if (hasCO2 || hasPM || hasSHT)
      payload = payload + ",";

    if (hasSHT) {
      Serial.println("[TVOC] Temp: " + String(tmp_rh.t) + ", RH: " + String(tmp_rh.rh));
      float ah = SGP.setRelHumidity(tmp_rh.t, tmp_rh.rh);
      Serial.println("[TVOC] AH: " + String(ah));
      SGP.setAbsHumidity(ah);
    }

    SGP.measure(true);
    int TVOC = SGP.getTVOC();
    int eCO2 = SGP.getCO2();
    int H2 = SGP.getH2_raw();
    int ethanol = SGP.getEthanol_raw();
    payload = payload + "\"tvoc\":" + String(TVOC);
    Serial.println("[TVOC] TVOC: " + String(TVOC) + ", eCO2: " + String(eCO2) + ", H2: " + String(H2) + ", Ethanol: " + String(ethanol));
    showTextRectangle("TVOC", String(TVOC), false);
    delay(3000);
  }
  ...
  // Finish and ship off results
  ...
}


void i2cScanner(){
  byte error, address; // variable for error and I2C address
  int nDevices;

  // Begin I2C Scanner
  Serial.println("\n[I2C] I2C Scanner");
  Serial.println("[I2C] Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++) {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0) {
      Serial.print("[I2C] I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    } else if (error == 4) {
      Serial.print("[I2C] Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("[I2C] No I2C devices found\n");
  else
    Serial.println("[I2C] done\n");
  delay(5000);
}

In the end, I gave up on the SGP30 and went with an SGP41 instead, which has been working great, took quite a bit of manual coding but it works

I’ve even added a BMP180 atmospheric pressure sensor too :slight_smile:

Which SGP41/from where did you purchase? Link would be great!