Chained PCA9685 and MCP23017

If I chain PCA9685s with MCP23017 I2C GPIO expander boards using the same I2C link do I need to allocate unique ID numbers to all boards or only to multiple boards of the same type ?

Thanks

Toni

Hi Toni,

Could you draw us a diagram of how you want to set things up? Also what are you using all that GPIO for?

You’re correct in that no two devices on the same i2c bus can have the same address. There are 2 ways around this:

  • Use a multiplexer. These accept commands over i2c to determine which identical slave device you want to talk to at a given time (which one gets connected in the internals of the mux)
  • Change the slave address. Each IC has different ways of doing this like tying one pin to another, or sending a special I2C command.

Thanks James

The MCP23017 GPIOs are for sensors and the PCA9685 servo controls are for points/turnouts etc on a model railway. The whole layout is managed by a RPi linked by USB to one uno/mega for each section of the layout.

I have used an I2C connection previously with multiple PCA9685s (each with a different ‘address’) but do not know if I need to do the same for MCP23017s on the same I2C bus.

Sorry for not being clear in my previous note.

Cheers

Toni