I2C multiplexer TCA9548A problem with ESPHome 2021.10.1

Just to be sure: a multiplexer like the TCA9548A normally is used when several (identical) sensors have to be connected via I2C to the same controller. Since you only connect one sensor in your example, why are you using the multiplexer?
Did you try to connect the DHT20 sensor directly to the ESP32 (so without the multiplexer), and if so did this work?
And another possible cause of the problem could be wiring. What kind of wiring are you using for the I2C connection, and what length?

1 Like

I need 6 DHT20 sensors they have a fix 0x38 address, I just try it with one single sensor until i get it to run. I tried to connect it directly to the ESP32 and it works.

T

Here is a picture of the wiring:

I did that you can see in the Yaml Code.

Yep gonna try this now, lets see.

Thanks for helping :slight_smile:


EDIT:

After trying other components, I realized that TCA9548A did not work. With the other ones it works.

1 Like

Right, so that’s clear: you indeed need a multiplexer for that.

OK, so currently it is only a proto setup.
Those short wires should be no problem, if only you assure that the pins in the breadboard are connecting properly. I had some issues with that in the past.
For connecting I2C devices over longer distances I have some good experiences with using UTP cabling, and then feed SDA + VCC through one twisted pair and SCL + GND through another twisted pair.
This is working fine for me for up to 10 meters in length.

Great! Problem solved then :smiley:

Hi,
I study this thread because I want to use esp32 with TCA9548a Multiplexer to run 8 Oled displays. Unfortunately the following code doesn´t work:

substitutions:
  name: esphome-web-8a7ed4
  friendly_name: Test

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:


# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:


# I2C Konfiguration
i2c:
  sda: 21  # SDA Pin fĂźr ESP32
  scl: 22  # SCL Pin fĂźr ESP32
  scan: true
  id: i2c0

# Schriftart
font:
  - file: "gfonts://Roboto"
    id: font1
    size: 20

# Example configuration entry
tca9548a:
  - address: 0x70
    id: multiplex0
    i2c_id: i2c0
    channels:
      - bus_id: multiplex0channel0
        channel: 0
      - bus_id: multiplex0channel1
        channel: 1
      - bus_id: multiplex0channel2
        channel: 2
      - bus_id: multiplex0channel3
        channel: 3
      - bus_id: multiplex0channel4
        channel: 4
      - bus_id: multiplex0channel5
        channel: 5
      - bus_id: multiplex0channel6
        channel: 6
      - bus_id: multiplex0channel7
        channel: 7
# OLED Display Konfiguration
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel0
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel1
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel2
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel3
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel4
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel5
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel6
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    i2c_id: multiplex0channel7
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");
     
 






# OTA und Webserver aktivieren
ota:
  password: "your_password"
  platform: esphome



web_server:
  port: 80


dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

Can you see a mistake? I checked the adresses of the Multiplexer (0x70/A0, A1, A2 all to ground) and of the displays 0x3C. I used Pullups in SCA and SCL between esp32 and the Multiplexer - not yet between Multiplexer and display. I will do this next.
But maybe you find a mistake in my code? The displays stay black…

Thanks

Markus