Search code examples
labviewi2c

Dynamic addressing I2C slaves; making it plug-and-play


I'm controlling a couple of i2c slaves (PCA9505) using the I2C module of National Instruments LabVIEW. I need to improve the project so I can add new slaves to the bus without manually adjusting the address of the slaves. (pins A0 A1 A2 on PCA9505). As a consequence, hardcoding the addresses is not a option.

Also, PCA has only 3 pins, so I can add max 8 slaves. I need to go for 16.

How can I give the slaves dynamic addresses?

How can I expand to 16 slaves?

Thanks for your help!

PS: PCA9505 = 40-bit parallel input/output (I/O) port expansion for I2C-bus applications


Solution

  • Personally, I like to use a configuration file to set the parameters needed for an application. In this case, it would define the addresses for each device you need to talk to. Arrays also help a lot here for expandability.

    As far as extending your I2C bus, you can use something like a PCA9544A I2C mux. This chip allows for controlling 4 different buses. You will have to control the mux as part of your addressing of the individual chips.