ArduinoGeneral

scd30 read problem with firebeetle v 4.0

userHead alvaromourazonovillo 2021-05-10 22:43:02 810 Views4 Replies
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
2021-05-13 16:36:12 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 userHeadPic alvaromourazonovillo
2021-05-12 15:37:35 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. userHeadPic 347945801
2021-05-11 14:19:59 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. userHeadPic alvaromourazonovillo
2021-05-11 13:38:21 You can check the power supply, it is possible that the board voltage of DFRobot is not enough to drive the sensor. userHeadPic 347945801