0
\$\begingroup\$

I'd like to connect two Sparkfun ESP32 dev boards (a 3.3V device) through I2C where one would act as a master and the other as a slave. Each board gets its own LIPO battery, however it is only the master that might be connected through USB; this allows for both wired and wireless operation.

Currently I have 5 common connections bridging the two boards:

  1. GND
  2. SCL
  3. SDA
  4. V-usb (5V)
  5. V-lipo (4.7V)

This is convenient because the 5 wires fit neatly into a 5 pin, micro-usb cable connection (and I'll be building a custom cable to connect both sides).

My question is this: do I need to have a common 3.3V line connection for the I2C communication to function properly between dev boards, or am I ok with just the 5 common lines detailed above?

\$\endgroup\$
  • 4
    \$\begingroup\$ I2C works over 3 wires - SDA, SCL and GND. \$\endgroup\$ – Eugene Sh. Apr 12 '17 at 13:47
  • \$\begingroup\$ You only need Data line, Clock line, and GND to work with I2C.. But a schematic may help with further issues or concerns. \$\endgroup\$ – 12Lappie Apr 12 '17 at 13:48
2
\$\begingroup\$

I2C is open Drain so source/load can be a different 3.3V but good common ground.

CMRR is rated at 60dB @1kHz 1Vpp so in noisy environments ( motors, relays solenoids) a Ferrite CM choke may be needed. (Torroid or sleeve or clamshell or other) Pullup termination R depends on cable capacitance and data rate.

Termination Versus Capacitance

Cp and Rp effectively limit the maximum data rate which can be transferred over SDA and SCL. A high Cp can be compensated with a low Rp and vice versa.

enter image description here

The following three pictures show the same part of an I2C transfer. Compared to the first one, the second picture shows the signals with a modified Rp of 2 kΩ, the third one with a lower Cp of 150 pF.

Note: Long wires increase Cp dramatically. I2C connections should always be as short as possible and connected by a suitable wiring pattern (c.f. I2C specification, section 17.3).

SDA (above) and SCL (below) with Rp = 10 kΩ and Cp = 300 pF. The SCL clock runs with 100 kHz (nominal).

enter image description here

The same transfer as above, but this time with a reduced termination resistance (Rp = 2 kΩ, Cp = 300 pF)

The same transfer as above, but this time with a reduced wire capacitance (Rp = 10 kΩ, Cp = 150 pF)

enter image description here

Note that the I2C standard limits Cp to the maximum value of 400 pF. However, with an appropriate termination resistance, it is often possible (although not recommended) to operate I2C buses with higher capacitance.

Credit Ref: http://www.i2c-bus.org

Twisted pair varies with wire type and 12pF/ft or 40pF/m is common. Shielded pair can be up to 100pF/m. You can measure rise time with R and compute cable capacitance.

\$\endgroup\$
1
\$\begingroup\$

You need a common ground reference for both integrated circuits. Otherwise those integrated circuits would not know what voltage the I2C clock and data lines are currently at.

Of course, light weight buses such as SPI and I2C were intended to run between integrated circuits usually on the same printed circuit board. They were meant to reduce the pins on the integrated circuits lowering costs and failure points. They are not meant to go any great distance. Certainly not as far as USB can travel. And absolutely not as far as 10/100/1000Base-T or RS488 can travel.

\$\endgroup\$
  • 1
    \$\begingroup\$ To be honest there are a number of issues that need to be addressed. For instance what if one of the batteries were under charged? Would you start powering the lower powered board through the pull up resistors of the fully charged board? Where do you put the pull up resistors? If instead you put them on the lower powered board will they pull up enough to allow the higher charged board enough voltage to tell the difference between a 1 and a 0? \$\endgroup\$ – st2000 Apr 12 '17 at 14:19
1
\$\begingroup\$

Warning

It may seem convenient to use USB Micro-B connectors because they happen to have 5 contacts but you are highly discouraged from doing that. At some point someone will get confused and think your setup is a normal USB connection and will try plugging to it accordingly. Of course it will not work and in the best case the person will just be confused. In the worst cast the attached USB device will get damaged or vice versa your device will get fried.

Also take note that only two pins of a typical USB cable have wires robust enough to carry any amount of current. The others are designed as signal wires. Some of the more modern "skinny" USB cables have such small conductors that even the power capable wires are going to cause a significant voltage drop across the cable.

\$\endgroup\$
  • \$\begingroup\$ I'll be building a custom cable to bridge the two halves, so I'll be sure to use wire suited for the two power lines. Also, I've designed the port so that, in cases where a user plugs in a standard USB, it will simply power the board and not cause any damage. \$\endgroup\$ – Constantino Apr 12 '17 at 15:00

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.