I2C (Inter-Integrated Circuit), pronounced “I-squared-C,” is a synchronous, multi-master, multi-slave, packet-switched, single-ended, serial communication bus. It was developed by Philips Semiconductor (now NXP) in 1982 to allow easy communication between components on the same circuit board.
Unlike UART, I2C is synchronous, meaning it uses a dedicated clock signal to synchronize data transfer between devices. It is a bus, allowing multiple “slaves” (like sensors or EEPROMs) to connect to a single “master” (like a microcontroller).
1. Physical Wiring
I2C uses only two bidirectional lines, which are “Open-Drain” or “Open-Collector”:
- SDA (Serial Data): The line for the master and slave to send and receive data.
- SCL (Serial Clock): The line that carries the clock signal.
- Pull-up Resistors: Because the lines are open-drain, resistors (typically 4.7kΩ) must be connected to Vcc to pull the lines high when no device is asserting a signal.
2. The I2C Data Frame
Communication starts with a specific sequence of signals:
- Start Condition: SDA transitions from High to Low while SCL is High.
- Address Frame: A 7 or 10-bit sequence that identifies the specific slave.
- Read/Write Bit: Specifies if the master is sending (0) or receiving (1) data.
- ACK/NACK Bit: Every byte is followed by an Acknowledgment bit from the receiver.
- Stop Condition: SDA transitions from Low to High while SCL is High.
| Parameter | Description |
| Communication | Half-duplex (cannot send and receive simultaneously). |
| Standard Speeds | 100 kbps (Standard), 400 kbps (Fast), 3.4 Mbps (High Speed). |
| Maximum Devices | Theoretically 128 (7-bit addressing) or 1024 (10-bit). |
| Distance | Intended for short distances (on-board), typically < 1 meter. |
Pros: Only 2 wires for many devices; hardware-level addressing; supports multiple masters; extremely common for sensors.
Cons: Slower than SPI; requires pull-up resistors; complexity in handling multiple masters; half-duplex only.
