vault backup: 2026-07-11 16:59:05

This commit is contained in:
John Lyon-Smith
2026-07-11 16:59:05 -07:00
parent b0318f13ae
commit ecb462a16b
82 changed files with 1970 additions and 0 deletions

74
Notes/Electronics/I2C.md Normal file
View File

@@ -0,0 +1,74 @@
---
tags:
- resource
created: 2026-03-08 20:22
---
## Summary
Notes on the I2C communication protocol.
## Notes
### Using Cat6 Cable
For the best results running I2C signals over Cat6 cable, use a **shielded Cat6 cable** and pair each signal line (SDA/SCL) with a dedicated Ground (GND) wire in the same twisted pair. Lower your clock speed (e.g., to \(100kHz) or lower), and use active terminators or bus extenders if the distance exceeds 2 meters.
Follow this configuration, optimize your signals, and use active buffers for long runs to ensure reliability.
1. Pinout and Wiring Configuration
Use one of the standard twisted-pair configurations to isolate the data lines from cross-talk and noise.
- **Pair 1:** SDA + Ground
- **Pair 2:** SCL + Ground
- **Pair 3:** \(V_{DD}\) (Power) + Ground
- **Pair 4:** Unused (Can be connected to Ground for extra shielding)
_Why this works:_ By twisting SDA and SCL with their respective Ground returns, you create a pseudo-differential pair. This guarantees noise immunity from external electromagnetic interference (EMI).
2. Signal Optimization
Because I2C was originally designed for short, PCB-level distances (<1m), using a cable introduces bus capacitance, which degrades the rising edge of your signal.
- **Reduce the Clock Speed:** Drop your I2C frequency from (400kHz to 100kHz) or (10kHz) to prevent communication dropouts.
- **Adjust Pull-Up Resistors:** Standard I2C requires pull-up resistors. Over a long cable, the higher capacitance slows down data transitions. You may need to use stronger pull-up resistors (lower resistance value, down to (approx. 1 KΩ - 2.2KΩ) depending on your bus capacitance.
- **Add Series Resistors:** Add a small resistor (100Ω) to the SDA and SCL lines on both ends of the cable to dampen signal reflections.
3. Bus Extenders for Extended Distances
If your distance exceeds 2 to 3 meters, the bus capacitance of Cat6 (typically 50pF to 52pF per meter) will exceed the I2C standard of (400pF).
For distances between 5 and 50 meters, utilize specific hardware rather than running raw I2C:
- **LTC4311:** An active terminator IC that actively pulls up and terminates the signal.
- **PCA9615 / PCA9600:** Differential I2C bus extenders that convert the signal to a differential format. This allows I2C signals to safely travel up to 100 meters.
For tips on how to correctly terminate wires inside a standard RJ-45 plug to build your extension cables:
### 4 wire
Using standard I2C over a long 4-wire twisted pair cable (like Ethernet) causes signal degradation, capacitance issues, and crosstalk. For reliable operation, use differential I2C extenders (e.g., [PCA9615 I2C Buffer](https://www.nxp.com/docs/en/data-sheet/PCA9615.pdf)). Otherwise, map standard I2C strictly as: **Pair 1** (SDA + Power/GND) and **Pair 2** (SCL + Power/GND).
Standard I2C uses non-differential, single-ended signals. Twisting the wrong wires together creates significant crosstalk and capacitive coupling. To minimize signal corruption:
- **Never twist SDA and SCL together:** Twisting your two data lines together is the fastest way to cause I2C communication failures.
- **Twist with a Return Path:** Twist the **SCL** line with a Ground (**GND**) wire, and twist the **SDA** line with a Voltage (**\(V_{CC}\)**) wire.
- **Reduce Clock Speed:** Drop the I2C clock frequency (e.g., down to \(100\text{ kHz}\) or lower) to compensate for cable capacitance and avoid signal reflections.
#### Extending I2C Long Distances (Differential Signaling)
If you need to run your I2C bus over long distances (beyond a few feet), standard I2C will fail. You should convert the single-ended I2C signal into a differential signal using a buffer IC like the **PCA9615**.
- **How it works:** It takes standard I2C and translates it into 4 differential lines.
- **Wiring:** The 4-wire twisted pair is mapped as two separate differential pairs:
1. `SCL_A` and `SCL_B` (Clock Pair)
2. `SDA_A` and `SDA_B` (Data Pair)
- **Benefit:** Differential signaling cancels out electromagnetic interference, allowing you to run I2C reliably across \(30\text{ meters}\) (\(100\text{ feet}\)) or more.
## References
- [Differential signalling with I2C](https://hackaday.com/2017/03/31/an-introduction-to-differential-i%C2%B2c/)
- [AdaFruit I2C Active Terminator](https://cdn-learn.adafruit.com/downloads/pdf/adafruit-ltc4311-i2c-extender-active-terminator.pdf)
- [How I2C Works](https://learn.sparkfun.com/tutorials/i2c/all)
- [Differential I2C](duction-to-differential-i²c/)
- [[Differential Signalling]]
- [PCA9615](https://www.nxp.com/docs/en/data-sheet/PCA9615.pdf)