# Adafruit PCA9546 4-Channel I2C Multiplexer

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/130/883/medium800/adafruit_products_5663-07.jpg?1719322594)

You just found the perfect I2C sensor, and you want to wire up two or three or more of them to your Arduino when you realize "Uh oh, this chip has a fixed I2C address, and from what I know about I2C, you cannot have two devices with the same address on the same SDA/SCL pins!" Are you out of luck? You would be if you didn't have this ultra-cool **PCA9546 1-to-4 I2C multiplexer**!

![](https://cdn-learn.adafruit.com/assets/assets/000/130/884/medium800/adafruit_products_5663-06.jpg?1719322623)

Finally, a way to get up to 4 same-address I2C devices hooked up to one microcontroller - this multiplexer acts as a gatekeeper, shuttling the commands to the selected set of I2C pins. [If you need to have up to 8 multiplexed devices, check out the 8-channel TCA9548 version of this board.](https://www.adafruit.com/product/2717)

![](https://cdn-learn.adafruit.com/assets/assets/000/130/885/medium800/adafruit_products_5663-04.jpg?1719322647)

Using it is fairly straight-forward: the multiplexer itself is on I2C address 0x70 (but can be adjusted from 0x70 to 0x77) and you simply write a single byte with the desired multiplexed output number to that port, and bam - any future I2C packets will get sent to that port. In theory, you could have 8 of these multiplexers on each of 0x70-0x77 addresses in order to control 8\*4 = 32 of the same-I2C-addressed-part.

![](https://cdn-learn.adafruit.com/assets/assets/000/130/886/medium800/adafruit_products_5663-05.jpg?1719322669)

Like all Adafruit breakouts, we put this nice chip on a board for you, so you can use it on a breadboard with capacitors, and pullups and pulldowns to make usage a snap. Some header is required, and once soldered, you can plug it into a solderless breadboard. The chip itself is 3V and 5V compliant, so you can use it with either logic level.

Comes with only the assembled PCB, no [cables or sensors included (we have tons available though!)](http://learn.adafruit.com/introducing-adafruit-stemma-qt)

# Adafruit PCA9546 4-Channel I2C Multiplexer

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/130/887/medium800/adafruit_products_pinout.png?1719323103)

The default I2C address is&nbsp; **0x70**.

## Power Pins

- **VIN** - this is the power pin. Since the multiplexer chip uses 3-5 VDC, to power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V.
- **GND** - common ground for power and logic.

## I2C Logic Pins - Control

- **SCL** - I2C clock pin, connect to your microcontroller I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.
- **SDA** - I2C data pin, connect to your microcontroller I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.

## I2C Logic Pins - Multiplexed

There are 4 sets of **SDA** &nbsp;and&nbsp; **SCL** &nbsp;pins, from&nbsp; **SD0/SC0** to&nbsp; **SD3/SC3**. These are the multiplexed pins. Each one is a completely separate I2C bus set. You can have 4 I2C devices with identical addresses, as long as they are on one I2C bus each.&nbsp;

Warning: 

## Address Pins

On the back of the board are&nbsp; **three address jumpers** , labeled&nbsp; **A0** ,&nbsp; **A1** , and&nbsp; **A2,** next to the lower mounting hole. These jumpers allow you to chain up to 8 of these boards on the same pair of I2C clock and data pins. To do so, you solder the jumpers "closed" by connecting the two pads.

On the front of the board are three address pins, labeled **A0** , **A1** and **A2**. Just like the jumpers, these pins allow you to change the I2C address to connect multiple boards by connecting them to **VIN**.

The default I2C address is&nbsp; **0x70**. The other address options can be calculated by “adding” the&nbsp; **A**** 0/A1/A2 **&nbsp;to the base of&nbsp;** 0x70**.

**A0** &nbsp;sets the lowest bit with a value of&nbsp; **1** ,&nbsp; **A**** 1 **&nbsp;sets the next bit with a value of&nbsp;** 2&nbsp; **and&nbsp;** A ****2** &nbsp;sets the next bit with a value of&nbsp; **4.&nbsp;** The final address is&nbsp; **0x70 + A2 + A1 + A0** &nbsp;which would be&nbsp; **0x77**.

 So for example if&nbsp; **A**** 2 **&nbsp;is soldered closed and&nbsp;** A ****0** &nbsp;is soldered closed, the address is&nbsp; **0x70 + 4 + 1 = 0x75**.

 If only&nbsp; **A**** 0 **&nbsp;is soldered closed, the address is&nbsp;** 0x70 + 1 = 0x71**

 If only&nbsp; **A1** &nbsp;is soldered closed, the address is&nbsp; **0x70 + 2 = 0x72**

 If only&nbsp; **A**** 2 **&nbsp;is soldered closed, the address is&nbsp;** 0x70 + 4 = 0x74**

The table below shows all possible addresses, and whether the pin(s) should be high (closed) or low (open).

![](https://cdn-learn.adafruit.com/assets/assets/000/117/484/medium800/adafruit_products_i2ctable.jpg?1673364512)

## Reset Pin

- **RST** - Reset pin for resetting the multiplexer chip. Pulled high by default, connect to ground to reset.

## I2C Pullup Jumpers

On the back of the board, directly below the Adafruit logo on the silkscreen, are two jumpers located next to the SCL and SDA control pins. You can cut these jumpers to disable to 10K pullup on each pin.

## Old Version with Incorrect Labeling

The SCL/SDA output pins were incorrectly labeled on the first production run. If you happen to have a version with these pin labels, use this info to determine the proper output pin names.

- **SD0/SC1** should be **SD0/SC0**
- **SD2/SC2** should be **SD1/SC1**
- **SD3/SC3** should be **SD2/SC2**
- **SD4/SC5** should be **SD3/SC3**

![adafruit_products_pin_fix.png](https://cdn-learn.adafruit.com/assets/assets/000/130/888/medium640/adafruit_products_pin_fix.png?1719323864)

# Adafruit PCA9546 4-Channel I2C Multiplexer

## CircuitPython & Python

It's easy to use the **PCA9546** with Python or CircuitPython, and the [Adafruit\_CircuitPython\_TCA9548A](https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A) module. This module allows you to easily write Python code that allows you to multiplex up to 4 I2C breakout boards with the **PCA9546** I2C multiplexer. You can use this multiplexer with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

If you're curious why you'd need an I2C multiplexer, be sure to [check out this guide](https://learn.adafruit.com/working-with-multiple-i2c-devices) that goes in depth on working with _ **multiple** _ copies of the same I2C device, which most likely have the **same I2C address**.

[Working with Multiple Same Address I2C Devices Learn Guide](https://learn.adafruit.com/working-with-multiple-i2c-devices)
## Why the Adafruit\_CircuitPython\_TCA9548A Module?

The PCA9546 is the four output version of the PCA9548 and the PCA9548 is the 'fraternal twin sister' of the TCA9548. The PCA954x chips are easier to get during the great chip shortage of 2022. They work exactly the same, they just can't go down to 1.8V power which is OK because QT boards are 3V or 5V only anyways. [You can still use any example code or library for the TCA9546](https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/overview), but a **_PCA9546A class_** has been added to the library that only allows for reading up to four attached devices.

## CircuitPython Microcontroller Wiring

First, wire up a PCA9546 to your board exactly as shown below. Here's an example of wiring a Feather M4 to the PCA9546 on a breadboard with **0.100" pitch** headers. Then, wire up two TSL2591 STEMMA boards into the PCA9546 SD0/SC1 and SD2/SC2 pins:

 **Power**

- **Feather 3V** to **multiplexer VIN (red wire)**
- **Feather 3V** to **TSL2591 1**** &nbsp;VIN (red wire)**
- **Feather 3V** to **TSL2591 2**** &nbsp;VIN (red wire)**

**Ground**

- **Feather GND** to **multiplexer**** &nbsp;GND (black wire)**
- **Feather GND** to **TSL2591 1**** &nbsp;GND (black wire)**
- **Feather GND** to **TSL2591 2**** &nbsp;GND (black wire)**

**Feather I2C**

- **Feather SCL** to **multiplexer**** &nbsp;SCL (yellow wire)**
- **Feather SDA** to **multiplexer**** &nbsp;SDA (blue wire)**

**TSL2591 I2C**

- **TSL2591 1 SCL** to **multiplexer SC0 (yellow wire)**
- **TSL2591 1 SDA** to **multiplexer SD0 (blue wire)**
- **TSL2591 2 SCL** to **multiplexer SC1 (yellow wire)**
- **TSL2591 2 SDA** to **multiplexer SD1 (blue wire)**

![adafruit_products_featherBB_fixed_silk_bb_43.png](https://cdn-learn.adafruit.com/assets/assets/000/130/898/medium640/adafruit_products_featherBB_fixed_silk_bb_43.png?1719336140)

## Python Computer Wiring

Since there's&nbsp;_dozens_&nbsp;of Linux computers/boards you can use, below shows wiring for Raspberry Pi. For other platforms,&nbsp;[please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired to the I2C multiplexer using a solderless breadboard:

 **Power**

- **Pi 3V** to **multiplexer**** &nbsp;VIN (red wire)**
- **Pi 3V** to **TSL2591 1**** &nbsp;VIN (red wire)**
- **Pi 3V** to **TSL2591 2**** &nbsp;VIN (red wire)**

**Ground**

- **Pi GND** to **multiplexer**** &nbsp;GND (black wire)**
- **Pi GND** to **TSL2591 1**** &nbsp;GND (black wire)**
- **Pi GND** to **TSL2591 2**** &nbsp;GND (black wire)**

**Pi I2C**

- **Pi SCL** to **multiplexer**** &nbsp;SCL (yellow wire)**
- **Pi SDA** to **multiplexer**** &nbsp;SDA (blue wire)**

**TSL2591 I2C**

- **TSL2591 1 SCL** to **multiplexer SC0 (yellow wire)**
- **TSL2591 1 SDA** to **multiplexer SD0 (blue wire)**
- **TSL2591 2 SCL** to **multiplexer SC1 (yellow wire)**
- **TSL2591 2 SDA** to **multiplexer SD1 (blue wire)**

![adafruit_products_piBB_fixed_silk_bb_43.png](https://cdn-learn.adafruit.com/assets/assets/000/130/901/medium640/adafruit_products_piBB_fixed_silk_bb_43.png?1719338003)

## Python Installation of TCA9548A Library

You'll need to install the&nbsp; **Adafruit\_Blinka** &nbsp;library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `pip3 install adafruit-circuitpython-tca9548a`

If your default Python is version 3, you may need to run&nbsp;`pip`&nbsp;instead. Make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython Usage

To use with CircuitPython, you need to first install the TCA9548A library, and its dependencies, into the&nbsp; **lib** &nbsp;folder on your&nbsp; **CIRCUITPY** &nbsp;drive. Then you need to update&nbsp; **code.py** &nbsp;with the example script.

Thankfully, we can do this in one go. In the example below, click the&nbsp; **Download Project Bundle** &nbsp;button below to download the necessary libraries and the&nbsp; **code.py** &nbsp;file in a zip file. Extract the contents of the zip file, and copy the&nbsp; **entire&nbsp;**** lib **&nbsp;** folder **&nbsp;and the&nbsp;** code.py **&nbsp;file to your&nbsp;** CIRCUITPY**&nbsp;drive.

Your&nbsp; **CIRCUITPY/lib** &nbsp;folder should contain the following folders and file:

- **adafruit\_bus\_device/**
- **adafruit\_tca9548a.mpy**
- **adafruit\_tsl2591.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/tca9584a_tca9548a_multisensor.py.png )

## Python Usage

Once you have the library&nbsp;`pip3`&nbsp;installed on your computer, copy or download the following example to your computer, and run the following, replacing **code.py** with whatever you named the file:

`python3 code.py`

## Simple Test Example Code
https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A/blob/main/examples/pca9546a_simpletest.py

 **If running CircuitPython:** &nbsp;Once everything is saved to the&nbsp; **CIRCUITPY** &nbsp;drive,&nbsp;[connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console)&nbsp;to see the data printed out!

**If running Python:&nbsp;** The console output will appear wherever you are running Python.

![](https://cdn-learn.adafruit.com/assets/assets/000/117/490/medium800/adafruit_products_replCPbasic.jpg?1673379858)

In this simple test for the PCA9546, an I2C scan is performed for all four of its ports. If any devices are connected, then the I2C address will be printed to the REPL next to the channel number. If no device is connected, then the port will print with empty brackets (`[]`).

## Multi-Sensor Example Code
https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A/blob/main/examples/pca9546a_multisensor.py

In the multi-sensor example, the PCA9546 is used as an I2C multiplexer with two TSL2591 light sensors. When the connected sensors are instantiated over I2C, the I2C pins declared are the multiplexed I2C pairs outputs on the PCA9546.

In the example, the first TSL2591 light sensor, instantiated as `tsl1`, is attached to pins SD0/SC1 (`tca[0]`) and the second TSL2591 light sensor, instantiated as `tsl2`, is attached to pins SD2/SC2 (`tca[1]`).

```python
# Create the PCA9546A object and give it the I2C bus
mux = adafruit_tca9548a.PCA9546A(i2c)

# For each sensor, create it using the PCA9546A channel instead of the I2C object
tsl1 = adafruit_tsl2591.TSL2591(mux[0])
tsl2 = adafruit_tsl2591.TSL2591(mux[1])
```

In the loop, the readings from the two light sensors are printed to the REPL every `0.1` seconds.&nbsp;

```python
while True:
    print(tsl1.lux, tsl2.lux)
    time.sleep(0.1)
```

![](https://cdn-learn.adafruit.com/assets/assets/000/117/491/medium800/adafruit_products_multiSensorREPL.jpg?1673380015)

# Adafruit PCA9546 4-Channel I2C Multiplexer

## Python Docs

# Adafruit PCA9546 4-Channel I2C Multiplexer

## Arduino

Using the PCA9546 I2C multiplexer with Arduino involves wiring up the I2C multiplexer to your Arduino-compatible microcontroller and running the provided example code.

If you're curious why you'd need an I2C multiplexer, be sure to [check out this guide](https://learn.adafruit.com/working-with-multiple-i2c-devices) that goes in depth on working with _ **multiple** _ copies of the same I2C device, which most likely have the **same I2C address**.

[Working with Multiple Same Address I2C Devices Learn Guide](https://learn.adafruit.com/working-with-multiple-i2c-devices)
## Wiring

Wire as shown for a&nbsp; **5V** &nbsp;board like an Uno. If you are using a **&nbsp;3V** &nbsp;board, like an Adafruit Feather, wire the board's 3V pin to the PCA9546 VIN.

Here is an Adafruit Metro wired up to the PCA9546 using a solderless breadboard, along with two VL53L4CD STEMMA boards attached to pins SD0/SC1 and SD2/SC2:

 **Power**

- **Metro 5V** to **multiplexer**** &nbsp;VIN (red wire)**
- **Metro 5V** to **VL53L4CD 1 VIN (red wire)**
- **Metro 5V** to **VL53L4CD 2 VIN (red wire)**

**Ground**

- **Metro GND** &nbsp;to **multiplexer**** &nbsp;GND (black wire)**
- **Metro GND** &nbsp;to **VL53L4CD 1**** &nbsp;GND (black wire)**
- **Metro GND** &nbsp;to **VL53L4CD 2**** &nbsp;GND (black wire)**

**Metro I2C**

- **Metro SCL** &nbsp;to **multiplexer**** &nbsp;SCL (yellow wire)**
- **Metro SDA** &nbsp;to **multiplexer**** &nbsp;SDA (blue wire)**

**VL53L4CD I2C**

- **VL53L4CD 1 SCL** to **multiplexer SC0**
- **VL53L4CD 1 SDA** to **multiplexer SD0**
- **VL53L4CD 2 SCL** to **multiplexer SC1**
- **VL53L4CD 2 SDA** to **multiplexer SD1**

![adafruit_products_metroBB_fixed_silk_bb_43.png](https://cdn-learn.adafruit.com/assets/assets/000/130/902/medium640/adafruit_products_metroBB_fixed_silk_bb_43.png?1719338078)

## Library Installation

The Multi-Sensor example uses two VL53L4CD time of flight sensors. You can install the&nbsp; **VL53L4CD** &nbsp;library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/117/492/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1673380654)

Click the&nbsp; **Manage Libraries ...** &nbsp;menu item, search for&nbsp; **VL53L4CD** ,&nbsp;and select the&nbsp; **STM32duino VL53L4CD** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/117/493/medium800/adafruit_products_components_arduinoLibFlight.png?1673380779)

## I2C Scanner Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/PCA9546_Demos/PCA9546_I2C_Scanner/PCA9546_I2C_Scanner.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/117/495/medium800/adafruit_products_ardScannerSerial.jpg?1673381754)

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. You should see the 4 ports print to the Serial Monitor. If an I2C device is plugged into one of the ports, its address will be printed below the port number.

## Multi-Sensor Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/PCA9546_Demos/PCA9546_MultiSensors/PCA9546_MultiSensors.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/117/497/medium800/adafruit_products_multSenseArdSerial.jpg?1673381807)

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. You should see readings from the two VL53L4CD time of flight sensors print to the Serial Monitor.

# Adafruit PCA9546 4-Channel I2C Multiplexer

## Downloads

## Files

- [PCA9546 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/117/480/original/pca9546a.pdf?1673362983)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-PCA9546-PCB)
- [3D models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5663%20PCA9546%20Multiplexer)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20PCA9546%204-Channel%20I2C%20Multiplexer.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/117/481/medium800/adafruit_products_schem.png?1673363335)

![](https://cdn-learn.adafruit.com/assets/assets/000/117/482/medium800/adafruit_products_fab.png?1673363348)


## Primary Products

### Adafruit PCA9546 4-Channel I2C Multiplexer

[Adafruit PCA9546 4-Channel I2C Multiplexer](https://www.adafruit.com/product/5663)
You just found the perfect I2C sensor, and you want to wire up two or three or more of them to your Arduino when you realize "Uh oh, this chip has a fixed I2C address, and from what I know about I2C, you cannot have two devices with the same address on the same SDA/SCL pins!" Are you...

In Stock
[Buy Now](https://www.adafruit.com/product/5663)
[Related Guides to the Product](https://learn.adafruit.com/products/5663/guides)

## Featured Products

### 20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack

[20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack](https://www.adafruit.com/product/4160)
Female header is like the duct tape of electronics. It's great for connecting things together, soldering to perf-boards, sockets for wires or break-away header, etc. We go through these real fast, and thought that given how handy they are, we'd offer them in a pack of five!

Each...

In Stock
[Buy Now](https://www.adafruit.com/product/4160)
[Related Guides to the Product](https://learn.adafruit.com/products/4160/guides)
### Break-away 0.1" 36-pin strip male headers in Various Colors

[Break-away 0.1" 36-pin strip male headers in Various Colors](https://www.adafruit.com/product/4235)
In this world nothing can be said to be certain, except we need headers, headers, and&nbsp;_more headers_!

Each pack contains ten **36-pin&nbsp;0.1" pitch break-away male headers.**

We gave these in bags of 10, in **classic black** as well as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4235)
[Related Guides to the Product](https://learn.adafruit.com/products/4235/guides)

## Related Guides

- [Adafruit Arcade Bonnet for Raspberry Pi](https://learn.adafruit.com/adafruit-arcade-bonnet-for-raspberry-pi.md)
- [Pi Hole Ad Blocker with Pi Zero W](https://learn.adafruit.com/pi-hole-ad-blocker-with-pi-zero-w.md)
- [Creating FunHouse Projects with CircuitPython](https://learn.adafruit.com/creating-funhouse-projects-with-circuitpython.md)
- [Adafruit AS7331 UV / UVA / UVB / UVC Sensor](https://learn.adafruit.com/adafruit-as7331-uv-uva-uvb-uvc-sensor.md)
- [Touch Tone Phone Dial-a-Song](https://learn.adafruit.com/touch-tone-phone-dial-a-song.md)
- [Adafruit MEMENTO Camera Board](https://learn.adafruit.com/adafruit-memento-camera-board.md)
- [Nunchuck Controlled Laser Cat Toy](https://learn.adafruit.com/nunchuck-controlled-laser-cat-toy.md)
- [Busy Box Interruption Sign](https://learn.adafruit.com/busy-box-interruption-sign.md)
- [Adafruit ST25DV16K I2C RFID EEPROM Breakout](https://learn.adafruit.com/adafruit-st25dv16k-i2c-rfic-eeprom-breakout.md)
- [PyPortal Trivia Time with the Open Trivia Database](https://learn.adafruit.com/pyportal-trivia-time-open-trivia-database.md)
- [Adafruit CAN Pal](https://learn.adafruit.com/adafruit-can-pal.md)
- [Accessing and Using Adafruit PCB Design Files](https://learn.adafruit.com/accessing-and-using-adafruit-pcb-design-files.md)
- [Circuit Playground or Hallowing Jack-o'-Lantern](https://learn.adafruit.com/circuit-playground-jack-o-lantern.md)
- [Adafruit VEML7700 Ambient Light Sensor](https://learn.adafruit.com/adafruit-veml7700.md)
- [Adafruit HUZZAH32 – ESP32 Breakout Board](https://learn.adafruit.com/huzzah32-esp32-breakout-board.md)
