adafruit_tca9548a
Works with
Any board with I2C — Feather, Metro, Trinket M0, Raspberry Pi Pico, and more.
What it does
The TCA9548A is an I2C multiplexer. It lets you connect up to 8 I2C devices that share the same address to a single I2C bus — something that would normally cause a conflict.
The chip sits between your microcontroller and your devices. You address each device through a numbered channel (tca[0] through tca[7]), and the library handles switching the bus transparently.
Classic use case: The SSD1306 OLED display always has the same I2C address. Without a multiplexer, you can only have one per bus. With a TCA9548A, you can have eight.
Installing the library
Copy these to the lib/ folder on your CIRCUITPY drive:
Both are in the Adafruit CircuitPython Bundle.
Quick start
import board
import busio
from adafruit_tca9548a import TCA9548A
i2c = busio.I2C(board.SCL, board.SDA)
tca = TCA9548A(i2c)
# Each tca[n] is a virtual I2C bus — pass it to your device library
# exactly like you would pass a regular i2c object
from adafruit_ssd1306 import SSD1306_I2C
display0 = SSD1306_I2C(128, 64, tca[0])
display1 = SSD1306_I2C(128, 64, tca[1])
display2 = SSD1306_I2C(128, 64, tca[2])
display0.fill(0)
display0.text("Channel 0", 0, 0, 1)
display0.show()
The virtual bus objects work with any library that accepts an i2c argument — you don't have to change anything else in your sensor code.
Key things you can do
| What you want | How to do it |
|---|---|
| Create the multiplexer | tca = TCA9548A(i2c) — default address 0x70 |
| Access a channel | tca[n] where n is 0–7 |
| Pass a channel to a sensor | sensor = SomeDevice(tca[3]) |
| Check what's on a channel | tca[n].scan() — returns list of I2C addresses |
| Use a non-default address | tca = TCA9548A(i2c, address=0x71) |
| Chain two TCA9548A chips | Use 0x70 and 0x71 — gives you 16 channels |
Reading the official docs
Full API reference and wiring details: https://docs.circuitpython.org/projects/tca9548a/en/latest/
Projects using this library
- Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout — Adafruit's full guide with wiring diagrams and multi-display examples