0
\$\begingroup\$

I'd like to use a SCD30 sensor connected to ESP8266. I know it's possible to use for example Adafruit library to connect SCD's to Arduino:

// Basic demo for readings from Adafruit SCD30
#include <Adafruit_SCD30.h>

Adafruit_SCD30  scd30;


void setup(void) {
  Serial.begin(115200);
  while (!Serial) delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit SCD30 test!");

  // Try to initialize!
  if (!scd30.begin()) {
    Serial.println("Failed to find SCD30 chip");
    while (1) { delay(10); }
  }
  Serial.println("SCD30 Found!");


  // if (!scd30.setMeasurementInterval(10)){
  //   Serial.println("Failed to set measurement interval");
  //   while(1){ delay(10);}
  // }
  Serial.print("Measurement Interval: "); 
  Serial.print(scd30.getMeasurementInterval()); 
  Serial.println(" seconds");
}

void loop() {
  if (scd30.dataReady()){
    Serial.println("Data available!");

    if (!scd30.read()){ Serial.println("Error reading sensor data"); return; }

    Serial.print("Temperature: ");
    Serial.print(scd30.temperature);
    Serial.println(" degrees C");
    
    Serial.print("Relative Humidity: ");
    Serial.print(scd30.relative_humidity);
    Serial.println(" %");
    
    Serial.print("CO2: ");
    Serial.print(scd30.CO2, 3);
    Serial.println(" ppm");
    Serial.println("");
  } else {
    //Serial.println("No data");
  }

  delay(100);
}

But it requires SDL and SDA pins, which my ESP doesn't have. And this code at least doesn't allow changing the connection pins. I know that connecting SCD30 and ESP8266 is at the very least possible using YAML format, then you can use regular digital pins. But I'd like to know if it's possible to do it with Arduino code as well.

If SCD30 isn't possible to use this way then how about other air sensors, would the CSS811 work?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The ESP8266 datasheet appears to show support for I2C. Do you mean a ESP8266 module is being used which doesn't break out the I2C pins to the connectors on the module? \$\endgroup\$ Commented Nov 17, 2023 at 11:08
  • \$\begingroup\$ The Datasheet Sensirion SCD30 Sensor Module says the digital interface can be selected as I2C or UART. Is using a UART an option? \$\endgroup\$ Commented Nov 17, 2023 at 11:09
  • 1
    \$\begingroup\$ "You can change what pins are used in the software - for Arduino it's done by passing in the pin numbers in the Wire.begin() function" - esp8266.com/viewtopic.php?p=87469 \$\endgroup\$ Commented Nov 17, 2023 at 12:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.