3

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.

ocrdu
  • 8,705
  • 21
  • 30
  • 42
Noideas
  • 109
  • 7
  • What is your data rate? – Andy aka Jan 10 '23 at 13:19
  • @Andyaka 100KHz, with 80 and 60 being possible too in a pinch. – Noideas Jan 10 '23 at 15:28
  • Have you tried a single master/slave communique over that distance and at 100 kbps? The difficulty is the return message from the slave. – Andy aka Jan 10 '23 at 15:55
  • @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? – Noideas Jan 10 '23 at 16:47
  • Read [this](https://electronics.stackexchange.com/questions/372113/spi-max-distance-on-flexible-circuit/372127#372127) and/or [this](https://electronics.stackexchange.com/questions/252928/spi-design-traces-for-a-pcb/252933#252933). – Andy aka Jan 10 '23 at 16:51

1 Answers1

2

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".

Antonio51
  • 11,004
  • 1
  • 7
  • 20
  • 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. – Noideas Jan 11 '23 at 08:11
  • 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. – Antonio51 Jan 11 '23 at 09:57
  • 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$ (https://www.ti.com/product/TCA9548A#order-quality) – Noideas Jan 11 '23 at 11:24
  • Yes, of course. ? Added the PCA9615 price (obsolete, no longer manufactured). – Antonio51 Jan 11 '23 at 13:08