TCA9548 multiplexer access slave device with same address

Dear All,

I'm using TCA9548 multiplexer to control MLX90640 sensors (multiple sensors with same address). As I know, one TCA9548 can connect 8 I2C slave devices (here, my sensors, all with same address). How to access each slave device by TCA9548? Or is it possible to change the address of MLX90640?

Please help. Thanks in advance

Basically it tells you what to do in the TCA9548 data sheet. First you tell the TCA9548 what channel to use. The TCA9548 has its own address which you can set three bits of it by external pins on the TCA9548.

Then you just talk to the sensor at its own address. The signals then get switched to the corresponding sensor.

Do you really have a TCA9548 or some board that uses a TCA9548? It matters that you give correct and complete information when asking questions.

Hi Mike,

Thank you for the information. And I'm sorry that I'm not clear. I have TCA9548A 1-to-8 I2C multiplexer (https://www.adafruit.com/product/2717), MLX90640 thermal camera sensor (https://www.sparkfun.com/products/14843) and a Teensy board with me. I want to use multiple MLX90640 sensors and get the results at the same time. Is it possible that I can get the results from all these sensors at the same time? Or I can get them only one after the other?

You have to get the sensor readings one at a time. Without the multiplexer, or if you enable more than one channel of the multiplexer at the same time, it would be like several people (with identical voices) all speaking at once: you would not be able to understand what any of them are saying and even if you could, you would not be able to tell which individual you had heard.

As PaulRB says

Is it possible that I can get the results from all these sensors at the same time

No.

Or I can get them only one after the other?

Yes.

You can’t do more than one thing at the same time on an Arduino as there is only a single core in the processor.

Or is it possible to change the address of MLX90640?

Even if you could change the address you can only read them one at a time.

I think you misunderstood what multiplexing is all about. It’s full name is time division multiplexing, it gives a time slice to each device in turn. If this is done fast enough with the right sort of device, like an LED, it looks like they are all on at the same time due to your persistence of vision.

Thanks a lot PaulRB and Mike. I'm a student and didn't know much about these. I think it's more clear now. Thanks for your time..

Is there any sample code available using MLX90640 and TCA9548A anywhere?

Unlikely. But there will be separate code for each device, and example code that demonstrates the multiplexer being used with other sensors. The multiplexer is not difficult to use and many people will not bother to use a library for it (other than the Wire library, of course).