0
\$\begingroup\$

This question already has an answer here:

I have an arduino uno and want to use a non MLX90614. I plan to used more than one sensor on the same Arduino but I don't know how to use two MLX90614 on the same I2C bus.

\$\endgroup\$

marked as duplicate by Harry Svensson, winny, RoyC, Dwayne Reid, Dmitry Grigoryev Nov 12 '18 at 13:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Read the datasheet …..there is an on board EEPROM and you can write the LSB of the SMBus address, so you can have multiple on the same SMBus without problems. \$\endgroup\$ – Jack Creasey Nov 6 '18 at 6:57
1
\$\begingroup\$

To get two identical I2C devices on a single I2C bus you need to use an additional I2C device called "I2C-bus multiplexer". Typical 2-channel device is PCA9540B. The multiplexer has its own I2C address, so you will need to add a code that programs it to switch between two "channels", and then use the same routine to access your sensor(s). Here is the typical connection:

enter image description here

As a bonus, the chip can perform level translation if you need one.

\$\endgroup\$
1
\$\begingroup\$

While the answers suggesting using I2C mux chips is good. In the case of just two overlapping devices, I’d suggest instead an I2C address translator, such as the LTC4317. Such devices let you effectively change the address of downstream devices. This was you don’t have to have the extra software to operate the mux.

This device works by rewriting the I2C address on-the-fly by XORing a byte into it. Thus, if you want to use two devices with the same address but make one with a different LSB, you’d set up the translator to XOR 0b0000001 into the bus before the second target device.

\$\endgroup\$
0
\$\begingroup\$

Probably the easiest way to do this is by using a I2C address multiplexer such as the TCA9548A 1-to-8 I2C multiplexer. This particular one will allow you to address up to 8 of the same device using a single I2C address. All you do to contact each individual sensor is write a byte to the multiplexer with the desired sensor number and then communicate with it just like a regular singular I2C device.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.