3
\$\begingroup\$

I'm trying to solve the following problem:

enter image description here

"How to connect 3 to 8 I2C sensors with the same address over 16-20 metres in a daisy-chain with 1 cable without having to deal with address clashes or wire length limitations? RS485 is not an option."

Steps:

1. One-cable requirement was easy to fulfill using CAT5e with RJ45 connectors:

enter image description here

2. To deal with the cable length, I plan to use PCA9615 I2C buffer for differential I2C over CAT5e, allowing ~50m of cable length. According to its datasheet, PCA9615 is completely transparent to all I2C devices on the bus, and requires no data overhead.

3. To handle address clashes, I'll add TCA95462 I2c Switch with 8 pin-selectable I2C addresses (using A0,1,2 pins)

The preliminary design comes up as such: enter image description here

  • PCA9615 I2C buffer for differential I2C over CAT5e, allowing ~50m of cable length.
  • TCA95462 I2c Switch with 8 pin-selectable I2C addresses (using A0,1,2 pins) to allow "changing" of I2C address for devices that have only one available hardcoded address.
  • HTU21D temperature sensor as the test I2C device. Address 0x40, hardwired.

Red, black and blue wires are CAT5 connector pins.The diagram does not include pull-up resistors for clarity.

My understanding of its operation is :

MCU sends "Enable" command signal to the device 0x00 (example). PCA9615 carries signal over long wires to the TCA95462 switch that has the address 0x00 (left). TCA95462 now opens its channel 0 where HTU21D (address 0x40) is connected, effectively connecting it with the master. TCA95462 switch with the address 0x01 (right) will not react, and effectively physically isolates the second HTU21D (address 0x40) from being interacted with by the master.

Could anyone who has ever used these chips, or faced the similar problem provide feedback on the feasibility of this design, my understanding and its current implementation? Thank you.

P.S: Please excuse the lousy circuit diagram, I was on a work laptop.

\$\endgroup\$
5
  • \$\begingroup\$ What is your data rate? \$\endgroup\$
    – Andy aka
    Commented Jan 10, 2023 at 13:19
  • \$\begingroup\$ @Andyaka 100KHz, with 80 and 60 being possible too in a pinch. \$\endgroup\$
    – Noideas
    Commented Jan 10, 2023 at 15:28
  • \$\begingroup\$ Have you tried a single master/slave communique over that distance and at 100 kbps? The difficulty is the return message from the slave. \$\endgroup\$
    – Andy aka
    Commented Jan 10, 2023 at 15:55
  • \$\begingroup\$ @Andyaka I havent tried building it yet, but why is there a difficulty in return messages? If there is too much capacitance in the line (>400pf), shouldn't both master and slave signals get equally affected? \$\endgroup\$
    – Noideas
    Commented Jan 10, 2023 at 16:47
  • \$\begingroup\$ Read this and/or this. \$\endgroup\$
    – Andy aka
    Commented Jan 10, 2023 at 16:51

1 Answer 1

2
\$\begingroup\$

I see that you want to use some I2C sensors (slow by definition), and you are adding other components ...

I would suggest adding a "tiny microcontroller" (for each sensor) reading a flow of information from the master (containing address, command, ...).
The "concerned" tiny processor would decide ... if it is its "own address" ... execute the command ... and send the answer to the master via a "common" wire-ored line.
All slaves could receive the same command at one time and execute it.
Only one slave use the return line at one time.
Some outputs (if there are any more ...) could be used to specify a "hardware" address (change by soldering or jumpers ...) so the program of the tiny processor would be the same for all.

You need only 4 lines. 4 lines left for other "functions" and/or "signaling".

\$\endgroup\$
4
  • \$\begingroup\$ The "tiny MCUs" in question would need to communicate over rs485 or similar protocol that allows long cable lengths though. Seems like it would be basically the same design, except instead of the I2C switch, there will be an MCU, and instead for DifferentialI2C chip there would be rs485 transceiver. \$\endgroup\$
    – Noideas
    Commented Jan 11, 2023 at 8:11
  • \$\begingroup\$ I thought that RS485 was not an option (so, not usable :-) ). With a suitable hardware IC driver, one can use "long lines" matched and "quasi" as fast as "ethernet" use. \$\endgroup\$
    – Antonio51
    Commented Jan 11, 2023 at 9:57
  • \$\begingroup\$ ah, I get it. So instead of I2C switch there would be an MCU (that one can set to any address really) that will act as a switch and communicate back over I2C extender? That makes sense. What MCU can match the I2C switch's price though? The switch is 0.567$ (ti.com/product/TCA9548A#order-quality) \$\endgroup\$
    – Noideas
    Commented Jan 11, 2023 at 11:24
  • \$\begingroup\$ Yes, of course. ? Added the PCA9615 price (obsolete, no longer manufactured). \$\endgroup\$
    – Antonio51
    Commented Jan 11, 2023 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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