Topics
Inter-Integrated Circuit

Inter-Integrated Circuit (I2C)

I2C is a communication protocol developed to transfer the data between two microcontrollers. Its simplicity makes it a widely adopted protocol for communication between microcontrollers, many onboard and external components, including sensors, displays, and other IoT devices.

I2C is a synchronous serial communication protocol which means that data is transferred one bit at a time with a fixed interval based on a reference clock.

I2C combines the best features of SPI and UARTs. With I2C, you can connect multiple peripherals to a single controller (like SPI) and have multiple controllers controlling one or more peripheral.

The SPI protocol specifies two logic signals, and devices communicating using this protocol have two pins:

  • SDA (Serial Data): The line for the controller and peripheral to send and receive data.
  • SCL (Serial Clock): The line that carries the clock signal.

I2C does not have peripheral select lines like SPI, so it needs another way to let the peripheral know that data is being sent to it. It does this using an approach called addressing. Every I2C device has an assigned address.

With I2C, data is transferred in the form of messages. Messages are broken up into frames. Each message has an address frame that contains the address of the peripheral to which the data is being sent followed by the data frames. The message also includes start and stop conditions, read/write bits, and ACK/NACK bits between each data frame.

All connected peripherals receive the message and compares the address in the message to its own address. If the address matches, it sends a low voltage ACK bit back to the controller to indicate it is receiving the data. If the address does not match, the peripheral does nothing, and the SDA line remains high, indicating it is not receiving the data.

Inter-Integrated Circuit