Skip to content
Get started

TCA9548A I²C Multiplexer

The TCA9548A component allows you to use TCA9548A as a I²C multiplexer (datasheet, AdaFruit) in ESPHome. It uses I²C Bus for communication.

TCA9548A I²C multiplexer breakout
tca9548a I2C Multiplexer.

Once configured, you can use any of the 8 channels (TCA9548A) as separated channels for your projects. Each channel acts as a virtual I²C bus for the connected components, and can be set to a different frequency than the main I²C bus.

WARNING

The main (upstream) I²C bus frequency is temporarily changed to the frequency of the active channel, so the devices on the main bus must be able to gracefully handle all selected channel speeds. This is usually not a problem if the channels are all the same or slower than the main bus. With a multiplexer behind a port, the outer port’s frequency is the one a transfer uses.

# Example configuration entry
tca9548a:
- address: 0x70
channels:
- bus_id: multiplex0channel0
channel: 0
- bus_id: multiplex0channel1
channel: 1
# Individual I2C Devices
sensor:
- platform: bmp280
i2c_id: multiplex0channel1

The multiplexer itself and its channels can run at a different frequency than the main bus, for example a 400 kHz multiplexer on a 1 MHz bus, or a sensor on a long cable:

# Channels without a frequency of their own use the multiplexer's, then this one
i2c:
id: i2c0
frequency: 1 MHz
tca9548a:
- address: 0x70
i2c_id: i2c0
frequency: 400 kHz
channels:
- bus_id: multiplex0channel1
channel: 1
frequency: 100 kHz
  • id (Optional, ID): The id to use for this TCA9548A component.

  • address (Optional, int): Manually specify the I²C address of the multiplexer. Defaults to 0x70.

  • i2c_id (Optional, ID): The upstream I²C bus to use. Required when more than one I²C bus is configured.

  • frequency (Optional, frequency): The frequency the multiplexer itself is addressed at, and the default for its channels. Set it when the main bus runs faster than the multiplexer supports, 400 kHz for the TCA9548A. Without it the multiplexer is addressed at the main bus frequency, or at the slower of the main bus and the channel frequency when the channel sets one.

  • channels (Optional): The virtual I²C bus channels

    • bus_id (Required, ID): The id to use for this virtual I²C bus.

    • channel (Required): The channel (0-7) to use for this virtual I²C bus.

    • frequency (Optional, frequency): The frequency for the devices on this virtual I²C bus. Defaults to the multiplexer’s frequency, or the main bus frequency. On nRF52 the controller only distinguishes standard (100 kHz) and fast (400 kHz and above) mode, so other values round to one of those.