I2C (Inter-Integrated Circuit)

The Two-Wire Interface (TWI) invented by Philips. It is the most common bus for sensors, EEPROMs, and RTCs.

Why I2C? - Reducing the Wire Mess

I2C (Inter-Integrated Circuit) was invented by Philips Semiconductor (now NXP) in 1982. At the time, PCBs inside TVs and Audio systems were becoming nightmares of routing. If you had 10 chips to control using SPI, you needed 10 separate Chip Select lines plus the data lines.

The Addressable Solution

  • 2 Wires Total: I2C allows you to connect 100+ sensors on just SDA (Data) and SCL (Clock).
  • In-Band Addressing: Instead of physical wires for selection, I2C sends the "Target Address" as the first byte of data.
  • Multi-Master: Unlike UART or SPI, I2C supports multiple masters (e.g., CPU and separate DMA controller) on the same bus.

Open Drain & Pull-ups

Why Open Drain?

Normally, a digital output drives High (1) or Low (0). In I2C, devices can only "Drive Low" or "Float".

  • Everyone releases the line = Voltage pulled HIGH by resistor (1).
  • Anyone pulls down = Line goes LOW (0).

This allows for "Wired-AND" logic, enabling features like Clock Stretching and Arbitration without short circuits.

I2C Bus Structure

      VCC      VCC
       |        |
      [R]      [R]  <-- Pull-up Resistors
       |        |
       +-----------------------------+-----------------------------+-----------------------------SDA Line
       |                  |
       +-----------------------------+-----------------------------+-----------------------------SCL Line
       |        |         |        |
    +-----------------------------+  +-----------------------------+   +-----------------------------+  +-----------------------------+
    | M1  |  | M2  |   | S1  |  | S2  |
    +-----------------------------+  +-----------------------------+   +-----------------------------+  +-----------------------------+