How to Use Multiple Sensors with the Same I2C Address Using an I2C Multiplexer
- alexanderalbenstet
- 6. Dez. 2024
- 3 Min. Lesezeit

Recently, I worked on a project where I needed to use multiple sensors of the same type — the SPS30 Particulate Matter Sensor from Sensirion. The sensors communicate via the I2C protocol to retrieve data. However, I quickly ran into an issue: all four sensors shared the same I2C device address.
This created a conflict because the microcontroller (in this case, a Raspberry Pi) couldn't distinguish signals from different sensors as the addresses weren’t unique.
In this article, I'll explain:
Why Fixed I2C Addresses Can Be a Problem
What Is an I2C Multiplexer and How It Works
Choosing the Right I2C Multiplexer for Your Project
Step-by-Step Guide to Connecting Sensors with the TCA9548A I2C Multiplexer
Why Fixed I2C Addresses Can Be a Problem
Every I2C-compatible device is assigned a 7-bit or 10-bit address, set by the manufacturer. These addresses allow the microcontroller to identify and communicate with the device. In my case, the SPS30 particulate matter sensors all shared the same fixed address: 0x69.
If you're using only one sensor, this isn't an issue. However, when multiple devices on the same I2C bus share the same address, they interfere with each other. The microcontroller cannot differentiate between them, leading to data collisions.
There are two main solutions:
Changing the Address: Some sensors allow you to modify their I2C address via hardware jumpers or software. Unfortunately, not all devices support this, or the process can be cumbersome.
Using an I2C Multiplexer: This is the most practical solution when dealing with devices that have fixed addresses. An I2C multiplexer isolates devices and allows you to communicate with them individually.
What Is an I2C Multiplexer and How It Works
An I2C multiplexer is a device that lets you connect multiple I2C devices with the same address to a single I2C bus by creating independent communication channels.
Here’s how it works:
Channel Assignment: Each sensor or device is connected to a separate channel on the multiplexer.
Channel Selection: The microcontroller communicates with the multiplexer (which has a unique address) to select a specific channel. This ensures that only one device is active at a time.
Fast Switching: Although only one sensor communicates at a time, the switching is so fast that it appears as if all devices are being read simultaneously.
For example, if you connect four SPS30 sensors to four channels of a TCA9548A I2C multiplexer, the multiplexer allows you to individually read from each sensor without address conflicts.
Choosing the Right I2C Multiplexer for Your Project
Choosing the right multiplexer is actually farely easy. Most of the time you only have to consider two things Number of Channels and Voltage Compatibility.
Number of Channels: Ensure the multiplexer supports enough channels for all your devices. For each device you need one channel. So if you want to use 4 sensors you also need 4 channels.
Voltage Compatibility: Match the voltage requirements of your sensors and microcontroller. Make sure that the
Conclusion
Address conflicts in I2C communication can be a challenging problem, but an I2C multiplexer offers an elegant solution. By isolating devices and switching between them, you can seamlessly connect multiple sensors or peripherals with the same address.
Whether you’re working on air quality monitoring, robotics, or other IoT projects, understanding and using I2C multiplexers is an essential skill for building scalable sensor networks.
Comments