Page 1 of 1

scd30 read problem with firebeetle v 4.0

Unread postPosted:Mon May 10, 2021 2:43 pm
by alvaromourazonovillo
I'm trying to read a scd30 sensor with an esp32 firebeetle v 4.0 with the sparkfun scd30 library with I2C protocol an Wire library of esp32, with a wrom esp32 board from Az-delivery I can read the sensor without problems but if I try to read with the same wire and the same code with the dfrobot board sometimes the sensor does not start and other times the sensor starts but does not give data.

How can it be possible? Thanks in advance.

Library:
https://github.com/sparkfun/SparkFun_SC ... no_Library

Code:
Code: Select all
#include <Wire.h>

#include "SparkFun_SCD30_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_SCD30
SCD30 airSensor;

void setup()
{
  Serial.begin(115200);
  Serial.println("SCD30 Example");
  Wire.begin();

  if (airSensor.begin() == false)
  {
    Serial.println("Air sensor not detected. Please check wiring. Freezing...");
    while (1)
      ;
  }

  //The SCD30 has data ready every two seconds
}

void loop()
{
  if (airSensor.dataAvailable())
  {
    Serial.print("co2(ppm):");
    Serial.print(airSensor.getCO2());

    Serial.print(" temp(C):");
    Serial.print(airSensor.getTemperature(), 1);

    Serial.print(" humidity(%):");
    Serial.print(airSensor.getHumidity(), 1);

    Serial.println();
  }
  else
    Serial.println("Waiting for new data");

  delay(500);
}
When the sensor doesn't start the output with the debug mode it is:
16:44:08.216 -> SCD30 Example
16:44:08.216 -> [E][esp32-hal-i2c.c:492] i2cInitFix(): Busy at initialization!
16:44:08.216 -> [E][esp32-hal-i2c.c:161] i2cWrite(): Busy Timeout! Addr: 61
16:44:08.216 -> Air sensor not detected. Please check wiring. Freezing...

And when it starts but doesn't get data the output is always:
16:44:15.790 -> SCD30 Example
16:44:15.837 -> [E][esp32-hal-i2c.c:228] i2cWrite(): Bus Timeout! Addr: 61
16:44:15.837 -> Waiting for new data
16:44:16.300 -> [E][esp32-hal-i2c.c:161] i2cWrite(): Busy Timeout! Addr: 61
16:44:16.300 -> Waiting for new data
16:44:16.813 -> [E][esp32-hal-i2c.c:161] i2cWrite(): Busy Timeout! Addr: 61
16:44:16.813 -> Waiting for new data

Re: scd30 read problem with firebeetle v 4.0

Unread postPosted:Tue May 11, 2021 5:38 am
by 347945801
You can check the power supply, it is possible that the board voltage of DFRobot is not enough to drive the sensor.

Re: scd30 read problem with firebeetle v 4.0

Unread postPosted:Tue May 11, 2021 6:19 am
by alvaromourazonovillo
I power the sensor with the vcc gpio and the micro usb port with 5v, the sensor works perfect with 3.3-5v. On the other hand, the onboard CHG LED doesn't stop blinking every 500ms from which I connect the board at all times, even when I load the code, is there something wrong with my board? Thanks in advance.

Re: scd30 read problem with firebeetle v 4.0

Unread postPosted:Wed May 12, 2021 7:37 am
by 347945801
The IIC on the dfrobot board is pulled up to 3.3v with a 10k resistor, and the IIC of the board you are using is pulled up to 3v with a 45k resistor. I am not sure if it is not working properly because of this reason. If you can provide another ESP32 The schematic diagram can facilitate us to further determine the problem.

Re: scd30 read problem with firebeetle v 4.0

Unread postPosted:Thu May 13, 2021 8:36 am
by alvaromourazonovillo
I changed the library for sensor reading to https://github.com/Seeed-Studio/Seeed_S ... tag/v1.0.0 and now it works, it seems a problem with the wire library handling methods