Basics of the I2C Communication Protocol

Summary of Basics of the I2C Communication Protocol


This article introduces the Inter-Integrated Circuit (I2C) communication protocol, highlighting its use in projects with OLED displays, pressure sensors, and accelerometers. It explains that I2C uses two wires for data and clock signals, supports multiple masters and slaves, and operates synchronously like SPI but efficiently like UART.

Parts used in the I2C Communication Project:

  • OLED displays
  • Barometric pressure sensors
  • Gyroscope/accelerometer modules
  • Microcontrollers
  • Memory card
  • LCD
  • SDA line
  • SCL line

So far, we’ve talked about the basics of SPI communication and UART communication, so now let’s go into the final protocol of this series, the Inter-Integrated Circuit, or I2C.

You’ll probably find yourself using I2C if you ever build projects that use OLED displays, barometric pressure sensors, or gyroscope/accelerometer modules.

I2C combines the best features of SPI and UARTs. With I2C, you can connect multiple slaves to a single master (like SPI) and you can have multiple masters controlling single, or multiple slaves. This is really useful when you want to have more than one microcontrollers logging data to a single memory card or displaying text to a single LCD.

Like UART communication, I2C only uses two wires to transmit data between devices:

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.

Basics of the I2C Communication Protocol

 

I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (the SDA line).

Like SPI, I2C is synchronous, so the output of bits is synchronized to the sampling of bits by a clock signal shared between the master and the slave. The clock signal is always controlled by the master.

How I2C Works

With I2C, data is transferred in messages. Messages are broken up into frames of data. Each message has an address frame that contains the binary address of the slave, and one or more data frames that contain the data being transmitted.

For More Details: Basics of the I2C Communication Protocol

Quick Solutions to Questions related to I2C Communication Project:

  • When will you likely use I2C?
    You will probably find yourself using I2C if you ever build projects that use OLED displays, barometric pressure sensors, or gyroscope/accelerometer modules.
  • What features does I2C combine from SPI and UARTs?
    I2C combines the ability to connect multiple slaves to a single master like SPI and the capability for multiple masters controlling single or multiple slaves.
  • How many wires does I2C use to transmit data?
    I2C only uses two wires to transmit data between devices.
  • What is the function of the SDA line?
    The SDA line is the Serial Data line for the master and slave to send and receive data.
  • What is the function of the SCL line?
    The SCL line carries the clock signal.
  • Is I2C synchronous or asynchronous?
    I2C is synchronous, meaning the output of bits is synchronized to the sampling of bits by a clock signal shared between the master and the slave.
  • Who controls the clock signal in I2C?
    The clock signal is always controlled by the master.
  • How is data transferred in I2C?
    Data is transferred in messages broken up into frames of data, where each message has an address frame containing the binary address of the slave.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter