I2C is the "Local Area Network" for the robot's sensory organs. Unlike point-to-point UART, I2C is a Shared Bus architecture that allows the ESP32 Controller to communicate with multiple peripherals using just two wires.
Core Role: Orchestrating the sensor suite, including IMUs (MPU6050), OLED displays, and Servo drivers.
I2C is a synchronous protocol. It uses a dedicated Clock (SCL) wire to synchronize data sampling on the Data (SDA) wire. This allows for reliable communication without baud-rate sensitivity.
โ Strengths
Multi-Device: Connect up to 127 devices on 2 wires.
Hardware ACK: Built-in confirmation of data receipt.
Simplicity: No complex baud-rate syncing required.
โ ๏ธ Weaknesses
Half-Duplex: Cannot send and receive simultaneously.
Address Limits: Some sensors share hardcoded addresses.
Capacitance: Speed drops as more devices are added.
๐ฆ The I2C Packet Sequence
Communication is always initiated by the Master (ESP32) through a bit-handshake:
START
ADDR (7-bit)
R/W Bit
ACK
DATA (8-bit)
ACK
STOP
๐งช Experimental Design: Pull-ups & Scanning
I2C lines are "Open-Drain" and cannot pull signals HIGH independently:
Pull-up Resistors: We use 4.7kฮฉ resistors to return signals to 3.3V.