I need to multiplex 16 I2C sensors which all have the same I2C address.

Can I multiplex those by multiplexing SDA signal only? And having SCL signals connected to all 16 sensors all the time time?

I have read some scattered information that it should work, but not definite answer.

Any considerations about HW? Or SW?

  • \$\begingroup\$ Perhaps you can show us the links, so everybody can comment. \$\endgroup\$ – tlfong01 Mar 27 at 6:14
  • 1
    \$\begingroup\$ Or these two Q&A's mibht help: (1) How to connect two BME280 sensors via I2C to a Raspberry Pi 3B+ - Rpi SE raspberrypi.stackexchange.com/questions/103962/… (2) How to interface more than 10x ADS1115 a raspberry pi? - Rpi SE raspberrypi.stackexchange.com/questions/104538/…. Cheers. \$\endgroup\$ – tlfong01 Mar 27 at 6:31
  • \$\begingroup\$ Which sensor? If you ask for hardware suggestions, what is the reason that you have you already decided you must switch SDA only? Sounds like an XY problem. Why would switching both SDA and SCL would not be acceptable, as it would most likely be more reliable, especially for buses with long wiring? How are the sensors connected and how long are their wires? \$\endgroup\$ – Justme Mar 27 at 8:40

Assuming your mux leaves SDA high-Z on unselected segments and you have a pull-up on each segment, the unselected targets will not see the start condition and will ignore the transaction.

Note that this all assumes that you never enable more than one segment at a time. Since each segment must be pulled up, enabling multiple segments may parallel too many pull-up resistors.

So yes, you can mux SDA and send SCL to all of your sensors.

  • \$\begingroup\$ This works. Be careful though, as the total pullup resistance on SDA line will depend on how many sensors (even none) are selected. \$\endgroup\$ – Vladimir Cravero Mar 27 at 7:28
  • \$\begingroup\$ @VladimirCravero Based on the OP’s application, I’m assume there will be ether 0 or 1 segment enabled at a time. If he plans to “broadcast” to multiple sensors by enabling multiple segments simultaneously, then yes, this becomes a problem. \$\endgroup\$ – DoxyLover Mar 27 at 7:35
  • \$\begingroup\$ @DaveTweed Yes, of course. Thanks for the correction. \$\endgroup\$ – DoxyLover Mar 27 at 14:44
  • \$\begingroup\$ Your assumption for OP might be accurate, but it is important to include this detail for other readers. As an example, it is possible to have several I2C devices on the not switched side of the bus, so that capacity of the net can get high enough that getting the proper pull up to work in all conditions can be tricky. \$\endgroup\$ – Vladimir Cravero Mar 27 at 14:48
  • \$\begingroup\$ @VladimirCravero Edited. You are correct. \$\endgroup\$ – DoxyLover Mar 27 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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