#148 TCA9548A I2C MULTIPLEXER (& Voltage Shifter)

preview_player
Показать описание
You want to use multiple fixed I2C hex addresses on your device? You need this!

LCSC China's Leading Electronic Components Distributor
More Asian Brands, Lower Prices
4 Hours Ready for Shipping

So you have multiple devices with the same I2C hex address but want to use them on the same bus?

All this information plus MORE at my GitHub:

Impossible! Or is it? Using this TCA9548A I2C multiplexer you can do it with no problem and minimal coding. Just one extra line of code in your Arduino sketch and you'll be able to use up to 8 devices with the same hex address.

And there's more! The devices you hang off this multiplexer can be at a different voltage to the µController voltage (which is the same voltage you will be supplying to this device). In fact, each device can be a different voltage. How's that for flexibility?

I show you exactly how to scan for your I2C devices (in case you don't know the hex address of the devices) and then show how I can update two LCD units with the same 0x3F address.

LINKS!
Some links may be affiliate links from which I earn commission or which help my channel in other ways.

TCA9548A device from Adatafruit:

TCA9548A Clone Boards (not Adafruit) at around $1 each (have a look around, many sellers, most with free shipping):

The bare chip for integration into your own PCB:

Adafruit's Trinket M0 (as shown at the end of the video) for microPython:

Looking for a cheap source of transistors?
200Pcs Transistor Assortment Kit BC337 BC327 2N2222 2N2907 2N3904 2N3906 and more!

Amazon Prime 30-day Free Trial:
What is Amazon Prime?

For an annual fee of £79, Amazon Prime members can:

Get unlimited, FREE One-Day Delivery on millions of items
Watch over 15,000 movies and TV episodes with unlimited instant streaming
Borrow from thousands of titles from the Kindle Owners' Lending Library
Secure, unlimited photo storage with anywhere access
Listen to over 2 million songs on Prime Music

---

If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey

My channel and blog are here:
------------------------------------------------------------------
------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

Excellent explanation as always.
Love the way you explain things, and mixed with a bit of serious humour.

digihz_data
Автор

The process of converting a channel number to a bit position implies that the chip can be configured to send the same information to multiple downstream devices. The best example I can think of is a cash register where you want to show the same information on both the operator and customer sides. The data sheet confirms that the chip will do this. Overall, a fascinating video about a problem (ID clash) that I’ve never had to deal with but which raises all kinds of possibilities. Thanks.

phillkelley
Автор

Ralph, thanks again for another informative video.

tseckwr
Автор

Thanks for video I found this device from a member of MERG and as I wanted to use 2 x 128 x 32 Oleds on a Headboard on a Signal Gantry it was just the job as address is same on each Oled, just waiting for PCB from our favourite JLCPCB to arrive so I can build using a Nano and a switch case sketch as I need just a "P, B and T" on each Oled when certain points and signals are triggered ...Cheers John

johnmarshall
Автор

I just watched #28 and #30 and did a quick count: Congrats with 150 video's !!

bollie
Автор

Thanks Ralph! Just bought 1 from AliExpress for 92p so so so cheap! No idea when I'll get time to use it but I know I'll have it to use. Great video btw

wiresauto
Автор

Good video. Worth staying to the end for the bit manipulation explanation.

BaronVonBiffo
Автор

Another great and informational video. I looked at I2C in the past for placing some sensors around the house and quickly found that the length of the I2C bus is very limited. It gets very complicated but I usually limit my wire lengths to 1 meter,

williammiller
Автор

Fantastic Video!!! I'm also very pleased to see some code written in something other than Arduino's Sketch, which is very inefficient, especially for Port I/O. I use Atmel Studio myself, which is a FREE customized version of Microsoft's Visual Studio.

montpierce
Автор

Great video as always! I did not know this chip, already ordered one to keep at hand. Thanks!

borayurt
Автор

Another great video Ralph. Might be worth noting that I2C requires a common ground - not a problem for this set up, but if using say multiple Arduino's then ground must be connected between them. Keep up the good work!

mrroobarb
Автор

Great video on how to use the TCA9548A I2C multiplexer, If I had a need to use one of these it'd be a real time-saver and explains everything in such straightforward terms. This is one of the best written tutorial videos I've ever seen.

But seriously, what is it with firmware engineers and their love of confusing the starting index between 1 and 0.

So when setting the bitmask at 27:27, "((1 << 0) == 1)" you set bit 1 to talk to channel zero, why the inconsistency :( I know that it saves an if-test if zero is passed in and subtracting 1 would cause an underflow on zero, or perhaps sending the zero byte has some special I2C significance, but why label it channel zero at all. This has been the cause of so many bugs over my years of development work, and I can't believe that firmware engineers still think this is somehow acceptable (to just use 0 sometimes then randomly use 1 - usually when they realize they need a NULL sentinel). Just chose one, either it starts at zero, or it starts at 1, then just stay consistent throughout your product. Am I the only one who this really bothers as an API user? If they love adding and subtracting 1 all the time, then I think it should be kept in their own code, and present a consistent API where Channel 0 is always channel 0

CharGorilla
Автор

Great video Ralph, think I got most of that. Keep up the good work, thank a lot.

georgestewart
Автор

Merci beaucoup pour cette vidéo ! J'ai reproduit les 2 sketchs qui fonctionnent à merveille et même si j'ai eu du mal à adapter le second, j'y suis parvenu ! Mais ça ne vient pas de vous, je suis juste débutant avec Arduino !

yohannsalsero
Автор

Great video as usual Ralph, I'm looking at one of these for my multi-input battery charger where each input has its own LCD showing power, etc, six in total.

tonyeezi
Автор

Nice Component
Thanks for sharing this :-)

avejst
Автор

Interesting little thing, good find and great explanation, thank you.

flemmingchristiansen
Автор

26:00
I'd love to hear more about the nuts and bolts of what you're able to do with eclipse in order to decipher how a library works. Seriously! I've spent the last 3 days trying to get a cheap little display running.
A Chinese store is selling a little ST7565 based display for less than $1.50 each. Someone posted a list of basic register commands, and the seller posted pictures of the working device along with the LCD ribbon pinout with SPI connection. I ordered a few, etched a couple boards, and figured I would take on a challenge. A challenge I'm well aware, is way over my head. I have several library examples that work with ST7565 controllers and a few other working ST7565 based displays to mess with. The biggest difference is that the mystery display is smaller in size than the typical 128x64. I have spent quite awhile trying to understand Oliver's U8G2 Arduino graphics library since he supports several ST7565 implementations and has readable commented code. However I'm not super familiar with Cpp and could really use a solid example and better methodology for dissecting a complex library. I'm sure it would greatly improve my understanding.
You are the king of breaking down code like this in a practical and useful way.
...anyways...it's just a suggestion from a single subscriber/viewer. I'm sure you have a long list of projects to film and don't have time for random content suggestions. I don't take such things personally. I was simply intrigued by the hint of a better methodology for achieving my current goals :-)
Thanks for the upload.
-Jake

UpcycleElectronics
Автор

Great video. Now I think I understand.:)

michaelhyde
Автор

I do love LCSC, such a range of components, at decent prices too, just need to remember that they shutdown for all Chinese Holidays 😣

almostanengineer