This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Resolving I2C address conflicts - i2c sensors with the same i2c address

Hello,

I need to read data from a number of sensors with the same i2c address which cannot be changed.

Seems to me that PCA9548 would be  a good candidate. Am I wrong?

I would use arduino to control them.

Is there any example code availble?

Regards,

 

Iñigo

  • Hello Iñigo,

    The PCA9548 might work for you very well. Even if you need to adress more then 8 sensors you could use more then one PCA9548. In your case, Please make sure to enable always only one channel. (At least for reading.)

    There is a lot of source code in the internet how to use the I2C with the Arduino.

    To enable the channels of the PCA9548 it is really simple.

      I2C_start

      I2C_Adress(PCA9548-Adress) // don't forget to check the ACK

      I2C_write_Byte(2^Channel) // Channel = 0..7, with 2^Channel it is always only one channel active

      I2C_stop

    To deactivate all channels

      I2C_start

      I2C_Adress(PCA9548-Adress) // don't forget to check the ACK

      I2C_write_Byte(0)

      I2C_stop

    To read the active channel

      I2C_start

      I2C_Adress(PCA9548-Adress) // don't forget to check the ACK

      I2C_read_Byte // The active channels should come in return

      I2C_stop

    I hope this helps.

    Best Regards,

    Michael

  • Thanks Michael.

  • hello,Michael
    I have some questions to use PCA9548.
    I have already written and read from PCA9548 successfully.I selected chanel 0 ,then I pull I2C bus down to low voltage(0).But the ouputs of chanel0 didn't go down with inputs .Did I config it wrong?
  • Hello user3837919,
    Make sure you place a stop condition after you program the channel. The stop condition need to be done before what is in the loaded register is performed.
    -Francis Houde