Solving I2C Address Conflicts – TCA9548A I2C Multiplexer
Today we will resolve a common problem – what to do when two of your sensors or displays have the same I2C address?
Article with code – https://dbot.ws/i2cmulti
More articles and projects – https://dronebotworkshop.com
Join everyone on the forum – https://forum.dronebotworkshop.com
get the newsletter – https://dbot.ws/dbnews
I’ve covered the I2C bus in several previous videos, and today we’ll take another look at it. This time I’ll show you how to resolve a common problem – what to do if you need to use two identical sensors or displays that have the same, unalterable, I2C address?
The answer is pretty simple, you implement an additional I2C bus. And you can do this a couple of different ways.
The first way is through software. By using an alternative to the Arduino Wire Library you can implement more than one I2C bus on your Arduino, and you aren’t restricted to using pins A4 and A5.
But software solutions have their drawbacks, and my preferred way of doing this is using hardware.
The Adafruit TCA9548A MI2C Multiplexer Module is perfect for the job. You can use it to add up to 8 additional I2C buses to your Arduino, and you can use up to eight modules for a whopping 64 extra I2C buses!
I’ll restrict myself to one module today. And I’ll use it to drive two identical I2C OLED displays that have a fixed I2C address. I’ll build a temperature and humidity meter and send temperature to one display, humidity to the other.
Here is what I have in store for you today:
I2C Address Conflicts – 1:32
Software Solutions – 3:37
TCA9548A I2C Multiplexer – 8:31
Two OLED Demo – 11:52
Bonus Feature – 20:43
If you’d like to try this out yourself you’ll find the code in the accompanying article at https://dbot.ws/i2cmulti.
So let’s become mediators and end I2C address conflicts once and for all!
source