Multiple Devices on I2C bus

@goeste Could you share your setup please?
Best regards :smiley:

@KaherdinTristan @animeshp1: sry for coming back only now… also i got rid of the AM… and switched to a bme280

this is my complete config: unfortunately there is no diagram, but according to the pins you should be able to figure it all out. I connected nearly all grounds to one single GND though

esphome:
  name: "esphome-garage"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

###
### WIFI
###
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-xxxxxx"
    password: "xxxxxx"
###
# Los geht's
###
captive_portal:

###
# I2C
###
i2c:
  - id: bus_a
    sda: 16
    scl: 17
    scan: true

###
# BinarySensors
###
binary_sensor:
  - platform: gpio
    name: Regensensor
    device_class: moisture
    pin:
      number: GPIO14
      inverted: True
      mode:
        input: True
        pullup: True
#Regenmenge
  - platform: gpio
    name: "Regenmenge"
    device_class: window
    pin:
      number: GPIO26
      inverted: True
      mode:
        input: True
        pullup: True
###
# Sensors
###
sensor:
#Helligkeit
#  - platform: bh1750
#    i2c_id: bus_b
#    name: "Lux Garage"
#    address: 0x23
#    #address: 0xc5
#    update_interval: 30s
#    filters:
#      - sliding_window_moving_average:
#          window_size: 10
#          send_every: 10
#          send_first_at: 1
#      - or:
#          - throttle: 60s
#          - delta: 10
#Temperatur
  - platform: bme280
    i2c_id: bus_a
    temperature:
      name: "Garage Temperature"
      oversampling: 16x
    pressure:
      name: "Garage Pressure"
    humidity:
      name: "Garage Humidity"
    address: 0x76
    update_interval: 5s
#Windsensor
  - platform: pulse_meter
    pin: 
      number: GPIO20
      mode: INPUT_PULLUP
    name: 'Garage Windgeschwindigkeit'
    icon: 'mdi:weather-windy'
    unit_of_measurement: 'm/s'
    internal_filter: 13us
    timeout: 5s
    filters:
      - multiply: 0.005560619
      - sliding_window_moving_average:
          window_size: 5
          send_every: 5

###
# Switches
###
switch:
  - platform: restart
    name: "Garage Restart"
1 Like

I think this comment just saved my day. Thanks alot @tom_l I was really starting to get crazy…

1 Like

Hello,

I’m facing quite same problem handling multiple I2C elements linked to my ESP32 using espHome.

In fact I would like both BH1750 and esp32cam to work together on same board.

For now I suceeded making only one working at a time.

I found the Pinout of the board Here https://github.com/Freenove/Freenove_Basic_Starter_Kit_for_ESP32/blob/5e168c36288cd304ef906464573b25e59ed3ef6a/Datasheet/ESP32-Pinout.pdf

Here is my yaml file

esphome:
  name: illuminance-mezzanine
  friendly_name: illuminance-mezzanine

esp32:
  board: esp32dev
  framework:
    type: arduino

# .....

captive_portal:

i2c:
  - sda: 26
    scl: 27
    id: bus_a
    scan: True

sensor:
  - platform: bh1750
    name: "BH1750 illuminance"
    update_interval: 1s
    i2c_id: bus_a
    #address: 0x5c


switch:
  - platform: restart
    name: "ESP32 Restart"

As for now Camera seams to be found using the scan parameter but not accessible.

When I tried to add the esp32cam component it obviously failed due to same pin usage.

Is someone can help me find out a way to share the pins or maybe to find some other I2C pins that are not used by the camera ?

Thanks