Hey y’all,
I am putting together an IoT enviromental sensor suite and was hoping I could get some help with my SGP30 gas sensor. I haven’t found any problems like it on the discussion boards, so hopefully it’s just a newbie fix.
I am using a photon with firmware 1.5.0 and am flashing code from the Web IDE.
I’m using the Adafruit_SGP30 library and example file from the libraries included on the Web IDE and I’m using the particle serial monitor to watch the results after flashing. Currently I’m working with this message from the I2C debug.
SGP30 test
Sensor not found :(
-> 0x36, 0x82,
<- 0x0, 0x0, 0x81, 0x0, 0xCA, 0x1D, 0x42, 0x34, 0xD0,
CRC calced: 0x81 vs. 0x81
Read: 0x0
CRC calced: 0x1D vs. 0x1D
Read: 0xCA
CRC calced: 0xD0 vs. 0xD0
Read: 0x4234
-> 0x20, 0x2F,
<- 0x0, 0x22, 0x65,
CRC calced: 0x65 vs. 0x65
Read: 0x22
I thought my sensor was not connected correctly, but upon using the i2c_scanner tool it was found at address 0x58 which is correct.
Here’s the code from the example sketch:
// Example usage for Adafruit_SGP30 library.
// This library was modified/wrapped by SJB (https://github.com/dyadica)
// in order to work with Particle Photon & Core.
#include "Particle.h"
#include "Adafruit_SGP30.h"
Adafruit_SGP30 sgp;
void setup()
{
Serial.begin(9600);
Serial.println("SGP30 test");
while (! sgp.begin()){
Serial.println("Sensor not found :(");
while(1);
}
Serial.print("Found SGP30 serial #");
Serial.print(sgp.serialnumber[0], HEX);
Serial.print(sgp.serialnumber[1], HEX);
Serial.println(sgp.serialnumber[2], HEX);
// If you have a baseline measurement from before you can assign it to start, to 'self-calibrate'
//sgp.setIAQBaseline(0x8E68, 0x8F41); // Will vary for each sensor!
}
int counter = 0;
void loop() {
if (! sgp.IAQmeasure()) {
Serial.println("Measurement failed");
return;
}
Serial.print("TVOC "); Serial.print(sgp.TVOC); Serial.print(" ppb\t");
Serial.print("eCO2 "); Serial.print(sgp.eCO2); Serial.println(" ppm");
delay(1000);
counter++;
if (counter == 30) {
counter = 0;
uint16_t TVOC_base, eCO2_base;
if (! sgp.getIAQBaseline(&eCO2_base, &TVOC_base)) {
Serial.println("Failed to get baseline readings");
return;
}
Serial.print("****Baseline values: eCO2: 0x"); Serial.print(eCO2_base, HEX);
Serial.print(" & TVOC: 0x"); Serial.println(TVOC_base, HEX);
}
}
Any ideas?
Thanks