Author Topic: Long I2C on pcb  (Read 2092 times)

0 Members and 1 Guest are viewing this topic.

Offline ambrozyTopic starter

  • Contributor
  • Posts: 40
  • Country: pl
Long I2C on pcb
« on: January 18, 2025, 11:56:55 pm »
I want to connect 9 ESP32 boards via I2C, the boards will be connected as shown in the picture, and the distance between the first and last ESP32 will be more than 1m. This is just a prototype, and I assume it can be made to work (I don't have the boards yet), but is this a good solution for the final product? In what other way could such communication be realized, preferably without additional hardware? I think I need at least 50kbps.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 7176
  • Country: de
Re: Long I2C on pcb
« Reply #1 on: January 19, 2025, 12:10:18 am »
Looks nice.
I don't see a problem, it's not as if it is 1000M Ethernet. Think about I2C running through a complete TV chassis, that's about the same length.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 5787
  • Country: dk
Re: Long I2C on pcb
« Reply #2 on: January 19, 2025, 12:14:28 am »
there's I2C in every HDMI/DVI/VGA cable ..
 

Offline ambrozyTopic starter

  • Contributor
  • Posts: 40
  • Country: pl
Re: Long I2C on pcb
« Reply #3 on: January 19, 2025, 12:39:57 am »
Ok thanks, we'll see how this goes, sorry for being paranoid ;D
 

Offline Hydron

  • Super Contributor
  • ***
  • Posts: 1618
  • Country: gb
Re: Long I2C on pcb
« Reply #4 on: January 19, 2025, 12:52:42 am »
Yeah you're abusing it much least than many other applications do (I've certainly done much worse myself!)
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1335
  • Country: nz
Re: Long I2C on pcb
« Reply #5 on: January 19, 2025, 12:59:00 am »
It might well be just fine.  The real proof of the design is probing it with an oscilloscope to check out the waveform shapes.

Those traces will add some capacitance to the bus, so you might need a lower value pull-up resistor and/or slower I2C clock rate.

I suggest you cut the I2C bus in the middle and put some 0R jumper resistors. That way if you get weird behaviour you can make the I2C bus a bit shorter to see if it helps.
 

Online tooki

  • Super Contributor
  • ***
  • Posts: 15938
  • Country: ch
Re: Long I2C on pcb
« Reply #6 on: January 19, 2025, 03:03:50 am »
I want to connect 9 ESP32 boards via I2C, the boards will be connected as shown in the picture, and the distance between the first and last ESP32 will be more than 1m. This is just a prototype, and I assume it can be made to work (I don't have the boards yet), but is this a good solution for the final product? In what other way could such communication be realized, preferably without additional hardware? I think I need at least 50kbps.
The length won’t be a problem, but you should follow the instructions in the I2C spec/user guide: https://www.nxp.com/docs/en/user-guide/UM10204.pdf

Page 54 gives specific guidance, but the upshot is: for traces/cables >10cm, you want to run ground and power trades/wires between the I2C lines to reduce crosstalk.
 
The following users thanked this post: ambrozy

Offline Kasper

  • Frequent Contributor
  • **
  • Posts: 966
  • Country: ca
Re: Long I2C on pcb
« Reply #7 on: January 19, 2025, 04:26:29 am »
Doesn't sound like you need it but I like this extender: LTC4311


Quote
We ran a 400 KHz OLED over 3 meters of phone wire with ease. With a 100KHz signal, we even ran a BME680 over 100 feet of Ethernet (about 3000pF round trip!), and had an OLED display the sensor details.
https://www.adafruit.com/product/4756

 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 6104
  • Country: nl
Re: Long I2C on pcb
« Reply #8 on: January 19, 2025, 08:13:45 am »
Like tooki wrote, the layout needs some work.

Best to add a ground plane underneath the section between the two connectors on either side of the board. Then I would rotate the ESP32 board such that the I2C connections are near the bottom, where the inter board connections for the I2C are. This way the spurs to the MCU are much shorter.

I don't see any provision for the needed pullups. You can of course use a terminating connector on the last board or add pads on each board to allow for the pullups to be placed.

Online tooki

  • Super Contributor
  • ***
  • Posts: 15938
  • Country: ch
Re: Long I2C on pcb
« Reply #9 on: January 19, 2025, 01:27:22 pm »
In what other way could such communication be realized, preferably without additional hardware? I think I need at least 50kbps.
Actually one other thought: you could use ESP-NOW wireless.

I recently used it for the first time and it’s quite easy. It handles over 500kbps real-world, so should be more than fast enough. Under 2ms latency in my testing.
 

Offline ambrozyTopic starter

  • Contributor
  • Posts: 40
  • Country: pl
Re: Long I2C on pcb
« Reply #10 on: January 20, 2025, 02:15:39 am »
I ran out of gpio pins, so I chopped the thing into more smaller boards and designed them with those things in mind.
Resistors will be on last board which is different.
 

Offline ambrozyTopic starter

  • Contributor
  • Posts: 40
  • Country: pl
Re: Long I2C on pcb
« Reply #11 on: January 20, 2025, 02:20:42 am »
In what other way could such communication be realized, preferably without additional hardware? I think I need at least 50kbps.
Actually one other thought: you could use ESP-NOW wireless.

I recently used it for the first time and it’s quite easy. It handles over 500kbps real-world, so should be more than fast enough. Under 2ms latency in my testing.

Wireless communication inside the device lol, why not for prototyping but for the final product? is there any device on the market that uses this kind of communication internally?
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 6104
  • Country: nl
Re: Long I2C on pcb
« Reply #12 on: January 20, 2025, 07:36:04 am »
I ran out of gpio pins, so I chopped the thing into more smaller boards and designed them with those things in mind.

Why not use an I2C IO extender like the MCP23017

Offline ambrozyTopic starter

  • Contributor
  • Posts: 40
  • Country: pl
Re: Long I2C on pcb
« Reply #13 on: January 20, 2025, 05:37:33 pm »
I need to scan 176 inputs with at least 20khz to measure timings, that's not going to work on one i2c bus
 

Online tooki

  • Super Contributor
  • ***
  • Posts: 15938
  • Country: ch
Re: Long I2C on pcb
« Reply #14 on: January 22, 2025, 03:50:31 pm »
In what other way could such communication be realized, preferably without additional hardware? I think I need at least 50kbps.
Actually one other thought: you could use ESP-NOW wireless.

I recently used it for the first time and it’s quite easy. It handles over 500kbps real-world, so should be more than fast enough. Under 2ms latency in my testing.

Wireless communication inside the device lol, why not for prototyping but for the final product? is there any device on the market that uses this kind of communication internally?
Probably not, but who knows! But it is fast and free. :p

I need to scan 176 inputs with at least 20khz to measure timings, that's not going to work on one i2c bus
But SPI probably could without issue. Are we talking about just reading the state of a bunch of digital inputs?

Out of curiosity, what is it you’re building?



I love the ESP32 series for many things, but probably the series’ biggest weakness is no models with huge numbers of GPIOs. :(

 

Online tooki

  • Super Contributor
  • ***
  • Posts: 15938
  • Country: ch
Re: Long I2C on pcb
« Reply #15 on: January 22, 2025, 03:55:44 pm »
I ran out of gpio pins, so I chopped the thing into more smaller boards and designed them with those things in mind.
Resistors will be on last board which is different.
Since you are running power and I2C over the same cable and PCB traces, any reason why you didn’t follow the recommendation to run BOTH ground and power between the SDA and SCL lines?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->