Long I2C on pcb - Page 1
Forum section: electronics / projects

author: ambrozy
author_rank: Contributor
timestamp: January 18, 2025, 11:56:55 pm
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: January 19, 2025, 12:10:18 am
content: 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.

author: langwadt
author_rank: Super Contributor
timestamp: January 19, 2025, 12:14:28 am
content: there's I2C in every HDMI/DVI/VGA cable ..

author: ambrozy
author_rank: Contributor
timestamp: January 19, 2025, 12:39:57 am
content: Ok thanks, we'll see how this goes, sorry for being paranoid

author: Hydron
author_rank: Super Contributor
timestamp: January 19, 2025, 12:52:42 am
content: Yeah you're abusing it much least than many other applications do (I've certainly done much worse myself!)

author: jbb
author_rank: Super Contributor
timestamp: January 19, 2025, 12:59:00 am
content: 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.

author: tooki
author_rank: Super Contributor
timestamp: January 19, 2025, 03:03:50 am
content: Quote from: ambrozy on January 18, 2025, 11:56:55 pmThe 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.pdfPage 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.

author: Kasper
author_rank: Frequent Contributor
timestamp: January 19, 2025, 04:26:29 am
content: Doesn't sound like you need it but I like this extender: LTC4311Quotehttps://www.adafruit.com/product/4756

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 19, 2025, 08:13:45 am
content: 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.

author: tooki
author_rank: Super Contributor
timestamp: January 19, 2025, 01:27:22 pm
content: Quote from: ambrozy on January 18, 2025, 11:56:55 pmActually 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.

author: ambrozy
author_rank: Contributor
timestamp: January 20, 2025, 02:15:39 am
content: 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.

author: ambrozy
author_rank: Contributor
timestamp: January 20, 2025, 02:20:42 am
content: Quote from: tooki on January 19, 2025, 01:27:22 pmWireless 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?

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 20, 2025, 07:36:04 am
content: Quote from: ambrozy on January 20, 2025, 02:15:39 amWhy not use an I2C IO extender like theMCP23017

author: ambrozy
author_rank: Contributor
timestamp: January 20, 2025, 05:37:33 pm
content: I need to scan 176 inputs with at least 20khz to measure timings, that's not going to work on one i2c bus

author: tooki
author_rank: Super Contributor
timestamp: January 22, 2025, 03:50:31 pm
content: Quote from: ambrozy on January 20, 2025, 02:20:42 amProbably not, but who knows! But it is fast and free. :pQuote from: ambrozy on January 20, 2025, 05:37:33 pmBut 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.

author: tooki
author_rank: Super Contributor
timestamp: January 22, 2025, 03:55:44 pm
content: Quote from: ambrozy on January 20, 2025, 02:15:39 amSince 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?