How do I connect the XIAO ESP32-C6 to the Adafruit SCD41? (I²C not detected) (For Home Assistant)

Hi all — I’m trying to connect the Seeed Studio XIAO ESP32-C6 to the Adafruit SCD41 (SCD4x) sensor, and the board flashes fine, but I²C scan shows no devices.

Can someone confirm the correct wiring?

Here’s what I think the correct connections are:

  • SCD41 VIN → 3V3 on the XIAO

  • SCD41 GND → GND

  • SCD41 SDA → D4 (GPIO4)

  • SCD41 SCL → D5 (GPIO5)

In yaml code:

  • i2c:
    sda: GPIO4
    scl: GPIO5
    scan: true

I tested the same scd41 with a raspberry pi pico 2 w, and it works fine - so the sensor is good.

I just can’t get teh xiaoesp32c6 to detect the adafruit scd41

Thanks

David

Hi there,

So what about the Pullup Resistors?
You may need them or a jumper on the Adafruit board. RP probably has them built in?

HTH
GL :slight_smile: PJ :v:

What is a pullup resistor?

OK, I looked up the specs, Adafruit provides the scd41 pull-up resistors for running off the 3v3 connector.

Even still, I will use the resistors I have to see if can figure this out.

My 10K ones did not work I will see if I can find a smaller one.

Hi there,

So , OK… You will need to start here and read through this… The Xiao is the same requires Pull-UP res. if your device doesn’t already have them.

More or less . I2C requires two pull-up resistors, one each for the SDA (data) and SCL (clock) lines, to pull the signals to a high state when the bus is not being actively driven low. These resistors are typically in the

2kΩ2 k ohm
to 10kΩ10 k cap ohm
range, with
4.7kΩ4.7 kohm
4.7𝑘Ω
and
10kΩ10 kohm
10𝑘Ω

being common values, and should be connected to the same voltage supply as the devices’ logic level. Many I2C breakout boards have these resistors built-in.

Role of pull-up resistors in I2C

  • Default state: The I2C bus uses open-drain or open-collector configurations, meaning devices can pull the line low but not high. Pull-up resistors provide a default high state for the bus lines.
  • Bus operation: When a device is not transmitting, the pull-up resistor pulls the signal line high. When a device wants to send a low bit, it connects the line to ground, overriding the pull-up resistor.
  • Multiple devices: Using pull-up resistors ensures that only one device can actively pull the line low at a time. If every device had an integrated pull-up resistor, the driving device would have to handle the current from all of them.

HTH
GL :slight_smile: PJ :v:

Well I tried everything you told me to do.

And I thank you for your input.

I made sure the resistor were what you specified. What I found out was other I2C sensors did not play nice with this chip either.

I bought 3 of these, one was broke out of the box and the other 2 chips act similarly. So at this stage all fingers point to this chip. I wish it worked but I need to move to other esp32 that I know work.

Thanks again, I learned a lot.

Honestly, I had high hopes for using the heck out of this.

On the ESP32C6, D4 = GPIO22 and D5 = GPIO23.
If you post a photo of the SCD41 and XIAO connection and the I2C scan sketch you tried, we might be able to figure something out.

Please ignore the previous post…

scl and sdl was switched….

This is how it is setup.

Power Pins

  • VIN - This is the power pin. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 3V microcontroller like a Feather M4, use 3V, or for a 5V microcontroller like Arduino, use 5V.

  • 3Vo - This is the output from the onboard 3.3V regulator. If you have a need for a clean 3.3V output, you can use this! It can provide at least 100mA output.

  • GND - This is common ground for power and logic.

The 3Vo pin is a 3.3V output terminal. Connect 3.3V to the VIN pin.

ok done

#include <Wire.h>

void setup() {

  Serial.begin(115200);
  while(!Serial);
  Serial.println("I2C Scanner initialization");
  Wire.begin();
  Wire.setClock(100000UL);
  Serial.println("I2C Scanner");
}


void loop() {
  byte error, address;
  int nDevices;
  nDevices = 0;

 
  Serial.println("I2C1 Scanning..."); 
  for(address = 1; address < 127; address++) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    
    if (error == 0) {
      Serial.print("I2C1 device found at address 0x");
      if (address < 16) 
        Serial.print("0");
      Serial.println(address, HEX);

      nDevices++;
    }
    else if (error == 4) {
      Serial.print("Unknown error at address 0x");
      if (address < 16) 
        Serial.print("0");
      Serial.println(address, HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C1 devices found");
  else
    Serial.println("I2C1 done");
    Serial.println("");
    delay(1000);  
}

Try this sketch.

Yeah, I thought about that too:

The I2C is not seen;

Any other microprocessor works fine. I am not spending any more time on this. I need to make progress and not spin my wheels. Let me know if someone else figures this out.

In short, this processor can’t see the I2C on it.

Thanks for your help.

My ESP32C6 is currently recognizing various I2C boards on my desk. Perhaps there’s an issue with the SCD41 side.

My scd41 and other I2C sensors work on the raspberry pico 2 w, and a feather light esp32c6.

So it looks like the chips are no good.

D4 = GPIO22, D5 = GPIO23. There seems to be an issue with how you’re specifying the GPIO numbers. Please be sure to try using the sketch I sent.

Hey Sir, I copied and pasted this code into the Arduino IDE and it came back with a lot of errors.

DS

oooooooooooohhhhhhhhhhhhhhhh, I found the problem!!!

Thank you msfujino

This is painful……

I was specifying the pins when I SHOULD have been specifying the GPIO numbers.

The pinout does NOT equal GPIO Number!

In all my other processors, the GPIO number and PIN MATCH.

Thank you so much, everyone. I apologize for getting frustrated.

footnote: I have a bunch of other stuff on order from SeeedStudio now. THANK YOU VERY MUCH