Electronic – Multiple I2C devices with the same address

diodesi2cmicrocontroller

I have multiple devices with the same address, and only one I2C bus. If I don't want to/can't use an address multiplexer, will the following arrangement work? (sorry for the messy schematic)

schematic

simulate this circuit – Schematic created using CircuitLab

SW1 and SW2 are microcontroller I/O, and are pulled low when we don't want to talk to the corresponding IC, and set to high impedance when we do want to talk to that IC. Can anyone see any problems with this, apart from with clock stretching? Assuming you choose diodes with a small voltage drop, like a schottky.

Edit:

Also assuming that the VIH and VIL all worked out with the diode drop and the VOH VOL.

The diodes could also go on the data lines instead, not sure if there would be any benefit/difference (maybe some I2C devices do something special when the clock goes low even if it's not their address? It's probably safer to not clock at all i.e. have the diodes on the clock lines.

Best Answer

I think I'd be tempted to do it this way.

schematic

simulate this circuit – Schematic created using CircuitLab

The Enables from the microcontroller basically act to enable the pull-up, though, depending on the device, the resistors could be internal to the micro, and you could turn them on and off when needed.

However, in reality, by the time you add all the diodes and resisters and route it all, a multiplexer would probably have been cheaper, would take less real estate, and require less IO pins.