Solving I2C Address Conflicts - TCA9548A I2C Multiplexer

  Рет қаралды 100,429

DroneBot Workshop

DroneBot Workshop

Күн бұрын

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 - dronebotworkshop.com/multiple...
More articles and projects - dronebotworkshop.com
Join everyone on the forum - forum.dronebotworkshop.com
get the newsletter - dronebotworkshop.com/subscribe/
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
So let’s become mediators and end I2C address conflicts once and for all!

Пікірлер: 128
@MrGeekGamer
@MrGeekGamer 4 жыл бұрын
This is something I have never seen addressed (no pun intended) elsewhere when discussing i2c devices.
@privatepeewee6402
@privatepeewee6402 2 жыл бұрын
I'm getting mixed signals, how can you post a pun and state no pun intended. J.k. it was kinda funny :)
@Coolarj10
@Coolarj10 2 жыл бұрын
Every time I see a topic made by DroneBot Workshop, I always rest easy knowing I'm going to find out exactly what I need to know!
@maybornelectronics7944
@maybornelectronics7944 4 жыл бұрын
DONT HAVE ENOUGH WORDS TO APPRECIATE THE WAY YOU EXPLAIN. THANK YOU VERY MUCH.
@jeefmeen3428
@jeefmeen3428 2 жыл бұрын
Great channel! Thank you for your work and your shared knowledge. Your clear and clear speech makes it possible to understand your explanations for non-English speakers. Thx.
@tubeDude48
@tubeDude48 4 жыл бұрын
This was great! It solved an issue I had...Thanks Bill !
@robertobrenes5283
@robertobrenes5283 3 жыл бұрын
This channel is a treasure, I hope you have backups of everything! Thank you so much for your videos!!!
@HelloHelloXD
@HelloHelloXD 2 ай бұрын
I have backups ;-)
@passenger000
@passenger000 4 жыл бұрын
thank you for your videos. You give information easy enough to learners and interesting enough to watch for experienced viewers :)
@robsciuk729
@robsciuk729 4 жыл бұрын
More very high quality work!!!! Well done.
@jean-marczenhausern5928
@jean-marczenhausern5928 4 жыл бұрын
I always enjoy your videos. I learn a lot new stuff. Please keep doing such great videos!
@hugbearsx4
@hugbearsx4 4 жыл бұрын
Excellent teaching. Thank you for your effort!
@dafydds
@dafydds 2 жыл бұрын
Thanks for this great video, I'm so green to all of this, but you're video just explained enough for me to get my TCA9548A. I was worried I would have to re-write other people's imported libraries, but this is a game changer for me! Thank-you :-)
@amizan8653
@amizan8653 3 жыл бұрын
This video is so good that at the 4:25 mark, I turned off my ad block and refreshed the page. Thanks for posting!
@klif_n
@klif_n 4 жыл бұрын
Another great video. I'm really new to all this micro controller fun, but I'm really enjoying it. Thanks for all the info.
@filiepmaes9071
@filiepmaes9071 4 жыл бұрын
Great video, Bill
@MadLabZ
@MadLabZ 4 жыл бұрын
Always worth watching. Thanks!!!
@atilayaksoy8993
@atilayaksoy8993 2 жыл бұрын
Dammmmn, exactly what I was looking for for a while. Thank you so much for this extra ordinary info on how to utilize multiple I2C with address conflict... Thunbs up...🙂
@mazbrenkgaming
@mazbrenkgaming 3 жыл бұрын
Thanks so much sir. You're even better than my teachers in terms of explaining the materials
@pedrorela8696
@pedrorela8696 4 ай бұрын
Thanks for the explanation, as always very clear!!!
@BobFeigl
@BobFeigl 2 жыл бұрын
Thank you for this content. I mentioned in your other single oled temp/humid sensor video but: If you get a NAN value displaying on one screen, you need to add an additional 2000 ms delay in the code. Pulling both values quickly doesn't work with these temp/humid sensors. They can only be polled once every 2 seconds. Adding that 2 second delay in between both reads fixes the NAN issue.
@guyd6
@guyd6 4 жыл бұрын
Encore une fois, un excelent travail. merci
@marvinsernande9790
@marvinsernande9790 4 жыл бұрын
Another great video for learning!
@harveyellis6758
@harveyellis6758 4 жыл бұрын
Another great video! Always informative and inspires new ideas for me.
@rondlh20
@rondlh20 4 жыл бұрын
Great information, very appreciated!
@AB-sk4kz
@AB-sk4kz 4 жыл бұрын
A lots of informations , well explained Thank you so much
@toystoryjohn8457
@toystoryjohn8457 4 жыл бұрын
This is just what I needed
@ACID2BREAKS
@ACID2BREAKS Жыл бұрын
Sir, I really want to thank you for this video. Really good detailed easy to understand description. Highly appreciated. As for a beginner like me, I can not value ur content high enough.
@yfhenkes7179
@yfhenkes7179 2 жыл бұрын
These videos are so good, thanks!!
@gholiamirza7102
@gholiamirza7102 4 жыл бұрын
Professionally discribed.🏅🏅🏅🏅🏅
@Jakub1989YTb
@Jakub1989YTb 4 жыл бұрын
Who else is watching at 1.25 speed? :D Btw, I love your channel. Every topic is so well explained. This is the way to go! Keep up the good work.
@EvileDik
@EvileDik 4 жыл бұрын
Missed my Sunday fix of Bill's soothing explanations, but now it's here! /replay
@simonedelgatto6136
@simonedelgatto6136 3 жыл бұрын
thank you so much now we can do my project at my job!!!
@gpc-systemcom
@gpc-systemcom 3 жыл бұрын
Excellent, many thanks
@Longtum
@Longtum 7 ай бұрын
Thanks! You helped me again😊
@Dronebotworkshop
@Dronebotworkshop 7 ай бұрын
Glad to be of service!
@fabricemotard4312
@fabricemotard4312 4 жыл бұрын
Great video !! 👏👏👏I didn't know there were adress conflicts on arduino ! Now i know thank you !! I learned many things since I follow your channel big thanks ( Excuse me for my english if i made some mistakes ! 😉 french guy )👍
@vladimirmalic
@vladimirmalic 4 жыл бұрын
Great video. Very useful.
@graycybermonk3068
@graycybermonk3068 3 жыл бұрын
This is awesome video. Great. Respect.
@Jarito1903
@Jarito1903 4 жыл бұрын
a link to the other videos could be great.... great channel, thanks,you´ve won another sub.
@michaelruth5775
@michaelruth5775 4 жыл бұрын
Add a pullup resistor on pin 2 DHT22. Excellent video as always.
@michaelruth5775
@michaelruth5775 4 жыл бұрын
Sorry. This comment should have been for your last video.
@electronic7979
@electronic7979 4 жыл бұрын
Helpful information. İ like your video
@sksuman4400
@sksuman4400 4 жыл бұрын
Thank you very much, sir. finally, you have made the video , I request this video 8 months ago to you.
@RoamingAdhocrat
@RoamingAdhocrat 4 жыл бұрын
I requested it in March 2020 - I'm impressed how quickly he responded!
@oscarilmio7148
@oscarilmio7148 4 жыл бұрын
@@RoamingAdhocrat Are you a time traveller?... :)
@RoamingAdhocrat
@RoamingAdhocrat 4 жыл бұрын
@@oscarilmio7148 Time is a tool you can put on the wall, or wear it on your rizd. The past is far behind us; the future doesn't exist.
@muhammedimdaad
@muhammedimdaad 3 жыл бұрын
thank you this is amazing
@bassome3000ify
@bassome3000ify 4 жыл бұрын
i had this issue, thanks
@zainalhas7416
@zainalhas7416 4 жыл бұрын
Thanks
@electric_mix
@electric_mix 4 жыл бұрын
Nice bro
@goldenhawktechnology3009
@goldenhawktechnology3009 4 жыл бұрын
Good morning sir :-) I am Praveen Prabhu, persuing my B.E. in EEE in INDIA, Karnataka, Banglore. I watch and enjoy all of your videos. Your videos are in detail so I learnt a lot and am improvising my projects by using additional displays and sensors. I get inspired to do some thing watching your video. I humbly Thank You for making such beautiful and knowledge videos and I always will aspire to become like you.
@eastern815
@eastern815 3 жыл бұрын
Excuse me, Sir What values is the resistor?
@MrRask99
@MrRask99 4 жыл бұрын
Очень полезное видео, лайк.
@galileomtz1975
@galileomtz1975 Жыл бұрын
Excelente
@rothpe1
@rothpe1 3 жыл бұрын
Thanks for your video. Code has solved my mistake in Code
@acc3095
@acc3095 2 жыл бұрын
awesome
@glouminou
@glouminou 4 жыл бұрын
Great video :) Was looking a bit around and noticed that smbus 3 allowed ARP for reassigning an address to the slave in case of conflicts but didn't find much documentation. Don't know if anyone already looked into it
@Guusie66
@Guusie66 4 жыл бұрын
Thank you for another great tutorial Bill. I really enjoy your work. How did you gather all this knowledge? Greetings from the Netherlands
@fat.32
@fat.32 3 жыл бұрын
Gracias! : )
@jerther_
@jerther_ 4 жыл бұрын
I hope to see your solutions to the 1m limitation. I have a personal project where I have to connect a MCU to a sensor located several meters away.
@112428
@112428 3 жыл бұрын
Try this. www.adafruit.com/product/4756
@Tarex_
@Tarex_ 4 жыл бұрын
great video as always! if the pins are outputs, is there a way to read multiple sensors through the bus and display on one display? looking for a way to connect 5-6 thermocouples without having an arduino or ideally an ESP32 for each one or two just to get the readings to one display
@davidhawley1132
@davidhawley1132 4 ай бұрын
Excellent. The only thing I didn't get was how to address slaves on the multiplexed buses.
@RoamingAdhocrat
@RoamingAdhocrat 4 жыл бұрын
Great video! Does it matter where on the I2C wires you attach to 5V via a resistor? Suppose the peripherals are a few metres from the multiplexer and in some cramped corner - does the 5V need to be fed to the I2C wires at the peripheral end or can it be fed in right next to the multiplexer?(If so it'd be simpler to just wire the resistors across the multiplexer itself, but if that was the case, they'd be built into the multiplexer itself probably)
@WeirdSide
@WeirdSide 3 жыл бұрын
Hey! would it be possible to use a cd4051 to hook up the data or clock from the arduino to each slave device, and use that to switch between them? Thanks for the help!
@_PathOfExile
@_PathOfExile 2 жыл бұрын
i solve this problem by making switch relay, simply i designed address giver circuit that allows the arduino to select which device going to be connected to the I2C on demand.
@RagaiMeena
@RagaiMeena Жыл бұрын
Great video. Would you please mind guiding me through a solution to an I2C issue? If I want to add a distance extender to an I2C bus, where would it be added : between the master and the multiplexer, or between the multiplexer and the sensor? Thank you
@mfeldheim
@mfeldheim 4 жыл бұрын
Love your simple, yet detailed videos. I learn something new every episode. One thing I personally find a bit annoying are the many repetitions of information and words in the clips I've seen so far. For example I think it's not necessary to address the device with its full name every time. This would also shorten the videos quite a bit.
@yairescalante10
@yairescalante10 4 жыл бұрын
Thanks for this tips. Just a question, where do you make your drawings? I liked them
@thedude5-6
@thedude5-6 2 жыл бұрын
Can you do a video on connecting and coding multiple 4 to 1 multiplexers?
@ashokas5812
@ashokas5812 Жыл бұрын
Sir, Any explanation for you connected same analogue pin for TCA and Temperature sensor?
@johnmarshall2660
@johnmarshall2660 Жыл бұрын
Hi Dave, ive been looking for a sketch which I can use for 2 x 128 x 32 Oled using a Nano and the TCA9548A module, I got a PCB made and it just arrived, and I think I can use your sketch for the Model railway display I need, its on a Gantry and it just displays a "P or B or T" depending on points triggerl and signal trigger, I already did one for a single Oled so I think yours is perfect, thanks so much I love your videos ... John
@SUSMITRUDRA
@SUSMITRUDRA 4 жыл бұрын
DroneBot Workshop lovers...hit here
@ianmccullough7294
@ianmccullough7294 4 ай бұрын
I think you could also do this with one (or more) 74LS125 (a tristate buffer) and GPIO to proverbially 'connect and disconnect' devices from the bus. This will consume GPIO pins for enabling, so it's not as elegant as the TCA9548A, but it should work, no? On the software side, it seems like this would be roughly the same. I haven't tried it, but conceptually it seems like it should work, no?
@wishicouldarduino8880
@wishicouldarduino8880 4 жыл бұрын
Isn't this temp sensor in the adafruit unified sensor library?
@GBODevelopment
@GBODevelopment 3 ай бұрын
Great video. I do have a question though. Why add the resistors as shown in your wiring diagram? Also, what resistors are those so I can purchase them? I am using an ELEG Mega 2560 board on this project and pulling from the 5V pin for this module with multiple OLED displays.
@disparky
@disparky 2 жыл бұрын
How about reading several encoders attached a single I2C device? Is it possible? Also sending data back to the I2C device to set the encoders to certain values.
@muhammadaqib0336
@muhammadaqib0336 4 жыл бұрын
Kindly make a project for mpu6050 oled display
@startobytes
@startobytes 4 жыл бұрын
Hi could you make it with you about the nrf24l01 Module and how to Connect it with the Arduino Uno?!
@plebaniaurydzyka8356
@plebaniaurydzyka8356 4 жыл бұрын
Could you make a video about shrinking Arduino projects to AtMega328 SMD (32 pins)? Is it similar to AtMega32 DIP (28 pins) using FDTI? Thank you
@1990mrburns
@1990mrburns 2 жыл бұрын
what is the purpose of the resistors
Ай бұрын
This video would have been improved if all I2C devices in the training would have been connected to the multiplexer. Instead, only the two displays are connected, thereby bypassing the connection of the third I2C device?
@imadalnajjar8251
@imadalnajjar8251 2 жыл бұрын
Hi, Can I split the I2C using PCA9685
@taranagnew436
@taranagnew436 2 жыл бұрын
what i2c devices have quiic connectors?
@srikanth5832
@srikanth5832 4 жыл бұрын
Excellent explanation sir, can you do one video on SPI bus how to connect more than one SPI devices to Arduino.
@tianyilim4674
@tianyilim4674 4 жыл бұрын
well, you wire up the second SPI device's CS/SS pin to another GPIO pin on the Arduino. The other pins (MISO, MOSI, SCK) are shared. Then when you want to communicate with a certain device, then you pull the respective CS line LOW.
@srikanth5832
@srikanth5832 4 жыл бұрын
Sir, I am trying to interface SD card module and nRF24L01.With single SD card it is working as soon as if I connect nRF24L01 MOSI,MISO,SCK pins along with SD card. Showing error . Like initialization of card is failed.
@srikanth5832
@srikanth5832 4 жыл бұрын
Thank anna for your reply sir.
@srikanth5832
@srikanth5832 4 жыл бұрын
Sir, if you have worked code related SD card and nRF24L01 can please send code. My mail id is "bsrikanthiitkgphzb@gmail.com"
@daryl7237
@daryl7237 2 жыл бұрын
hi is it possible to use NANO?
@nickhuynh6321
@nickhuynh6321 3 ай бұрын
i wonder how fast the multiplexer can switch ...
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 4 жыл бұрын
Have you tried to bit-bang your own master i2c code, it's not that hard and gives a great feeling of satisfaction when it works.
@karlareyes2830
@karlareyes2830 3 жыл бұрын
Hi! In case that I want my many similar slaves to be input sensors (all equal sensors) on the Arduino, will every of this slaves have a new different address to call it on the code when implementing the multiplexer?
@ramav2578
@ramav2578 3 жыл бұрын
Any chance you could help me. Ive followed this project closely but I am wondering how you would use 2 seperate temperature sensors ( Im using two DS18B20) to display to each screen instead of one sensor to a single OLED screen. I have the project working but it scrolls between temp sensors and I would like each screen to stay static on a given temp sensor. any help you could give a fellow Canuck would be appreciated.
@qzorn4440
@qzorn4440 Жыл бұрын
is there a video on: LILYGO® TTGO T-CAN485 ESP32 CAN RS-485 Supports TF Card WIFI Bluetooth Wireless i2c PCB like which pins are SCL SDA thanks.
@bob-ny6kn
@bob-ny6kn 2 жыл бұрын
Is there no #include file for the TCA9548A?
@fjallmann
@fjallmann 4 жыл бұрын
Hi DroneBot Workshop. I have a small question on a project I am trying to learn Arduino with. Would it be possible to run 4x Pressure sensors and a touch screen display on an Arduino Mega?
@Andi-gy6dj
@Andi-gy6dj 3 жыл бұрын
is it possible with different oled lcd addresses (SSD1306 AND SH1106)?
@rongeernaert1208
@rongeernaert1208 3 жыл бұрын
I've problems with I2C adress on my Pixhawk flight controller with an I2C splitter 4 connections for compass and ext LED and the LED don't work !
@Ata99afg
@Ata99afg 4 жыл бұрын
Hi I need your help
@AB-ee4nu
@AB-ee4nu 21 күн бұрын
I have a query, How do i get inputs from multiple MPU6050, i tried with it but it seems to display values that is in the max number of value in TCA like if i add 4 MPUs in ports (0,1,2 and 3) then the data is showing only one MPU (in TCA 3) for all values, even for the other MPU code
@languagelolli
@languagelolli Ай бұрын
Hello Bill! As an liberal arts student who studied art history and web design, I find your videos easy to follow! Thanks for your neat organization of information! I appreciate your attention to details!
@srikanth5832
@srikanth5832 4 жыл бұрын
Sir, I am trying to interface SD card module and nRF24L01.With single SD card it is working as soon as if I connect nRF24L01 MOSI,MISO,SCK pins along with SD card. Showing error . Like initialization of card is failed
@erdem3552
@erdem3552 8 ай бұрын
How many ohm resistors should I use to power NodeMCU over 3.3v? NodeMCU ile 3.3v üzerinden çalıştırmak için kaç ohm direnç kullanmalıyım?
@gustje0493
@gustje0493 8 ай бұрын
Hi, if you have a battery or a Powersupply you have to use some kind of Voltage Regulator, because the current draw off a microprocessor is not constand
@MrSasha3050
@MrSasha3050 4 жыл бұрын
Only 2 displays had connected? 🙂
@ravindupramod5998
@ravindupramod5998 4 жыл бұрын
Can you make video adout nrf24l01 module 😢 I burn 8 modules😭
@phillippaul3015
@phillippaul3015 3 жыл бұрын
Hey were you a professor at Humber college back in 1998-2000?
@aparnakrishnamurthy9710
@aparnakrishnamurthy9710 4 жыл бұрын
How to find an address of an i2C device?
@AtlantaTerry
@AtlantaTerry 4 жыл бұрын
Do the new Arduinos that were released in 2019 still have only one I2C bus?
@WhoWantsToKnow81
@WhoWantsToKnow81 4 жыл бұрын
Yes. It's how the uC chip is designed - only one I2C bus.
@nonebiz2132
@nonebiz2132 4 жыл бұрын
ESP32 chips have 2 I2C, so consider those in place of an arduino
@chistompso8754
@chistompso8754 3 жыл бұрын
Could somebody explain what the purpose of the 4 resistors is? It seems (on the surface anyway) that if you deleted those, this set-up would still work. I'm guessing it has something to do with keeping the signal clean? (Obviously I'm not an EE)
@wayland7150
@wayland7150 Жыл бұрын
The transistors in the I2C only pull down to ground. It needs something to pull it up to +3.3v when the transistors are not active. Think of the resistors like a spring and the transistors when active pull down but when not active the spring pulls up.
@EricBalcon
@EricBalcon 2 жыл бұрын
hi, your code is not available
@georgei2480
@georgei2480 4 жыл бұрын
I don't see how this will ever be an issue. I2C bus can have up to 255 addresses on one communication rail. When will you ever have more?
#148 TCA9548A I2C MULTIPLEXER (& Voltage Shifter)
38:00
Ralph S Bacon
Рет қаралды 26 М.
Arduino Multiplexor - MUX INPUTS & OUTPUTS - ANALOG and PWM
13:21
Electronoobs
Рет қаралды 100 М.
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 10 МЛН
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 4,3 МЛН
MEU IRMÃO FICOU FAMOSO
00:52
Matheus Kriwat
Рет қаралды 43 МЛН
ESP32 Guide 2024 | Choosing and Using an ESP32 Board
41:06
DroneBot Workshop
Рет қаралды 245 М.
I2C with Arduino and Raspberry Pi - Two Methods
30:13
DroneBot Workshop
Рет қаралды 201 М.
PROTOCOLS: UART - I2C - SPI - Serial communications #001
11:58
Electronoobs
Рет қаралды 1,4 МЛН
TCA9548A I2C Multiplexer Module - With Arduino and NodeMCU
9:39
Crazy Couple DIY
Рет қаралды 47 М.
Connecting Arduino with multiple I2C devices
6:22
BlueDot
Рет қаралды 190 М.
rust runs on EVERYTHING (no operating system, just Rust)
18:10
Low Level Learning
Рет қаралды 348 М.
Using EEPROM with Arduino - Internal & External
31:54
DroneBot Workshop
Рет қаралды 192 М.
Designing a simple analog kick drum from scratch
39:11
Moritz Klein
Рет қаралды 593 М.
74HC595 & 74HC165 Shift Registers with Arduino
40:38
DroneBot Workshop
Рет қаралды 392 М.
Electronic Basics #19: I2C and how to use it
6:09
GreatScott!
Рет қаралды 413 М.
I chose the biggest glass 😂👻
0:19
Ben Meryem
Рет қаралды 2,9 МЛН
Domino lego #cute #china #construction #train
0:35
construction toy
Рет қаралды 29 МЛН
Покатались на сноубордах😂
0:10
FERMACHI
Рет қаралды 2,2 МЛН
Skateboarding Down the Steps
0:11
Ryan's World
Рет қаралды 26 МЛН
Хинкали 🥟
0:35
Сан Тан
Рет қаралды 755 М.