Custom I2C pins don't work

I can use my SDC30 sensor with the standard I2C pins, but not with the commented-out pin numbers of the following configuration because then I get the “Results from i2c bus scan: Found no i2c devices!” error. Why?

i2c:
  # sda: 3
  # scl: 2
  scan: true
  id: bus_a

sensor:
  - platform: scd30
    co2:
      name: "Workshop CO2"
      accuracy_decimals: 1
    temperature:
      name: "Workshop Temperature"
      accuracy_decimals: 2
    humidity:
      name: "Workshop Humidity"
      accuracy_decimals: 1
    temperature_offset: 1.5 °C
    address: 0x61
    update_interval: 5s

Which esp board do you have?

Pin 3 on both ESP8266 and ESP32 is not the first choice to use - as it can do interesting things at boot time, which may be confusing your I2C device. Google “esp what pins to use” for some tables showing reason why some pins are last choice to use on devices.

@JulianDH

esp32:
  board: az-delivery-devkit-v4
  framework:
    type: arduino

@zoogara I understand, but these pins should work regardless, shouldn’t they?

ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials is my usual go-to-place when it comes to pin usage, might give you an idea. there are “easier” pins to use than your selection. Good luck :slight_smile:

@mondalaci the ESP32 pin link that @Lakini gave you is quite good. Reading the link, for ESP32 i2c you can reassign different pins other than the default 21 / 22 (as referred to in the ESPHome link), but you will read that the two you chose, 4 is not good because it is meant to be high on boot. Different variations make different pins available, so needs a bit of reading. I do a spreadsheet of all the sensors I wish to use, before I assemble and test. Good luck

1 Like

ah, forgot one detail: i dont have much experience with i2c, but just in the last days I was going crazy figuring out an SPI issue. Although it is supported to reassign other pins than the standard ones, at least for SPI that can result in less performance and stability. So if you can somehow arrange it, I would definitely go with the default pins, just to rule that out as a source of trouble

1 Like