SGP30 w/ Photon/Boron

Got the components.
Double check circuit before trying it? Anything missing?

Sorry for late answer, I was a little busy.
Yup the circuit looks good :+1:
let us know the results :blush:

One more thing, make sure that after you power-up your SGP30 wait a little to reach the condition specified in datasheet:



I’m a little confused here regarding BS250 pinout. Many website shows that the Drain is on left side when the transistor front side (part no# side) is facing towards to you (also your drawing suggest the same thing ) e.g.:

but the datasheet shows that on left side is source. :thinking:

Make sure to double check that and I’ll personally follow the datasheet or even make a test with multimeter to determinate it. You can google the methods how to deal with it. But the principals are easy:
(let’s follow the datasheet suggestions )
set the multimeter on “diode test”.
The “S” Source, regarding to datasheet is on left side so lets connect the positive (red) probe to it
We know that on the middle is a G (gate) so connect black probe to and wait a little to charge it, then move/connect the black probe to the right side “D” Drain. If the datasheet is correct you will see on multimeter some voltage drop (transistor on condition ) if there is none that’s suggest that the “S” source is on right and “D” is on left :slight_smile: which you can confirm using the same method

1 Like

Double checked the “datasheet” from the amazon link where I got the bs250, and the pinout is S, G, D with flat side facing towards you.

Hooked up the sgp30 after letting it run for 24 hours (confirmed co2 level change when powering it directly from 3.3V pin), using the 2N7000 & BS250 with D2 as En/Disable, the sgp30 is still not working properly, never gets a value above 400ppm for eco2…not sure what else to try at this point :frowning:

// Example usage for Adafruit_SGP30 library.
// This library was modified/wrapped by SJB (
// in order to work with Particle Photon & Core.

#include <Particle.h>
#include <Wire.h>
#include <math.h>
#include <Adafruit_SGP30.h>

Adafruit_SGP30 sgp;

/* return absolute humidity [mg/m^3] with approximation formula
* @param temperature [°C]
* @param humidity [%RH]
// uint32_t getAbsoluteHumidity(float temperature, float humidity) {
//     // approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
//     const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
//     const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
//     return absoluteHumidityScaled;
// }

void setup() {
  pinMode(D2, OUTPUT);
  digitalWrite(D2, HIGH);
  while (!sgp.begin()){
    Serial.println(F("SGP30 - Fault"));
  Serial.println(F("SGP30 - Ready"));
  Serial.print("SGP30 Serial#: ");
  Serial.print(sgp.serialnumber[0], HEX);
  Serial.print(sgp.serialnumber[1], HEX);
  Serial.println(sgp.serialnumber[2], HEX);
  //sgp.setIAQBaseline(0x8C7D, 0x8BE7);  //(@eCO2, @TVOC) will vary for each sensor!

int counter = 0;
void loop(){
  //float temperature = 22.1; // [°C]
  //float humidity = 45.2; // [%RH]
  //sgp.setHumidity(getAbsoluteHumidity(temperature, humidity));

  if (!sgp.IAQmeasure()) {
    Serial.println("IAQMeaure :(");
  Serial.print("TVOC: "); Serial.print(sgp.TVOC); Serial.print(" PPB\t");
  Serial.print("eCO2: "); Serial.print(sgp.eCO2); Serial.println(" PPM");

  if (counter == 30) {
    counter = 0;
    uint16_t TVOC_base, eCO2_base;
    if (! sgp.getIAQBaseline(&eCO2_base, &TVOC_base)) {
      Serial.println("Baseline :(");
    Particle.publish("CO2 Baseline: ", String(eCO2_base));
    Particle.publish("TVOC Baseline: ", String(TVOC_base));
    Serial.print("Baseline values: eCO2: 0x"); Serial.print(eCO2_base, HEX);
    Serial.print(" & TVOC: 0x"); Serial.println(TVOC_base, HEX);

Not sure why but also not sure if is a good idea to put it to sleep mode. This is what I found:

I don’t have this sensors and I don’t use any of them but may be
@RWB can help here.