I2C stands for “Inter-Integrated Circuit/Controller”. It is a serial communication protocol that is used to connect low-speed devices for serial communication.

The I2C protocol was designed in 1980 by Philips Semiconductor. It is a master-slave communication in which we can connect and control multiple slaves from a single master in which each slave device has a particular address.

The I2C protocol supports various data rates according to versions ranging from 100 Kbps, 400 Kbps, 1 Mbps to 3.4 Mbps. It is a widely used protocol in recent times for short-distance communication. It is also known as the Two Wired Interface(TWI).

It was designed for overcoming the issues of transmitting data with the help of UART or Universal asynchronous Receiver Transmitter and Serial Peripheral Interface or SPI. The UART is an asynchronous transmission protocol while the I2C is a synchronous protocol.

Working of I2C Protocol

The I2C protocol uses two cables for communication in which one cable is used for the clock (SCL) and another cable is used for data (SDA). These two cables are required to pull up with a resistor for + Vdd. It can be used to link two I2C buses with different voltages. Practical use in this arduino based projects.

I2C protocol operates in 2 modes:-

  • Master Mode
  • Slave Mode

Each data bit is transferred on the SDA line and is synchronized by a high to the low pulse of each clock on the SCL line.

working of i2c

According to I2C protocols, the data line can change only when the clock line is low; it can not change when the clock line is high. The data transmitted is in the form of packets of 9 bits in which:-

  1. Slave Address – 8 bit
  2. Start Condition – 1 bit
  3. Acknowledge – 1 bit

Various Conditions Of I2C Protocol

Start and Stop Conditions:-

Start and Stop conditions are generated by changing the level of SDA and keeping the SCL line high. 

For generating the STOP condition SDA is changed from low to high while keeping the SCL high and for generating the START condition the SDA is changed from high to low while keeping the SCL high.

Repeated Start Condition:-

During Start and Stop conditions the control bus is considered to be busy and it can not be controlled by another master. If another master tries to initiate a new transfer and does not want to release the bus before starting the new transfer, it is considered a new START condition, and this new START condition is known as a “Repeated Start Condition”.

Read Write Bit:-

The Read/Write bit is used to determine whether the master is sending the data or receiving the data.

If the Read/Write bit is high then it is considered as the master sending the data to the slave and if the Read/Write bit is low it is considered as receiving the data from the slave. 

ACK/NACK Bit:-

The bit ACK is generally known as the “Acknowledgement bit” and the NACK is known as the “Negative Acknowledgement bit”. These bits are raised to inform about successful transmission to one another.

The ACK bit is sent to the sender by the receiver If the data frame is received successfully.

Addressing Bit:-

This bit is used to determine the slave with which the master wants to communicate.

The address of the slave with which the master wants to communicate is sent by the master to every slave connected with it, then the slave compares its own address with this address and sends ACK accordingly.

Features of I2C Communication Protocol

  1. Synchronous Communication:-

The data is transferred in the form of frames or blocks in the I2C communication protocol.

It can be configured in a multi-master communication environment. 

  1. Clock Stretching:-

It is possible to stretch the clock when the slave device is not ready to accept more data. This can be accomplished by holding the SCL line low, hence disabling the master to raise the clock line. Now the master will not be able to raise the clock line because the wires are AND wired and it will wait until the slave releases the SCL line to determine that it is ready to transfer the next bit.

  1. Half Duplex Communication Protocol:-

It is possible to carry out Bi-Directional communication in the I2C communication protocol.

  1. Arbitration:-

The I2C protocol supports the multi-master bus system but no more than one bus can be used simultaneously. 

The SDA and SCL pins are monitored by the masters. If the SDA pin is found high when it was supposed to be low then it will be noted as another master is active and using the bus. Hence it stops the transfer of data.

  1. Serial Transmission of data:-

The I2C communication Protocol uses serial transmission for the transmission of data. The data bits are transmitted bit by bit and hence It is used for low-speed communication.

Difference Between I2C and SPI Communication Protocols

I2CSPI
I2C stands for Inter-integrated controller.SPI stands for Serial Peripheral Interface.
It was developed by Philips semiconductor in 1980.It was developed by Motorola in the mid-1980.
It is a half-duplex protocol.It is a full-duplex protocol.
It supports multiple master configurations.It does not support the multiple master configuration.
It has more overhead.It has less overhead.
I2C protocol mainly uses two cables for communication which are CCL and SDA.SPI protocol uses four cables for communication which are MISO, MOSI, CS, and CLK.
I2C Protocol’s data transfer speed ranges from 100kHz to 400kHz.SPI Protocol has data transfer speed of up to 25 MHz.
I2C Protocol is a multi-master protocol.SPI Protocol is a single master protocol.

Advantage, Disadvantage & Application of I2C Communication Protocol

The I2C communication protocol is ideal for those applications which require less costly and easy implementation rather than high-speed transmission.

Some of the applications of the I2C communication protocol are as follows:-

  1. Accessing DACs and ADCs
  2. Communicating with multiple micro-controller
  3. Transmitting and controlling user-directed actions
  4. Reading hardware sensors
  5. Reading certain memory ICS

Advantage of I2C Communication Protocol:-

  1. It Can be configured in multi-master mode.
  2. It supports flexible data transmission rates.
  3. It provides long-distance communication than SPI.
  4. It increases the complexity of firmware or low-level hardware.
  5. Each device on the bus is controlled separately.
  6. It is Cost-efficient.
  7. It uses the ACK/NACK feature which it has improved error-handling capabilities.

Disadvantage of I2C Communication Protocol:-

  1. It has a Slower transmission speed.
  2. It supports a half-duplex mode of communication.
  3. It is managed by the stack.
  4. Many devices have multiple addresses saved, which can cause conflicts.
  5. The complexity of hardware increases when no. of master/slave devices is high in the circuit.

Frequently Asked Questions:-

  1. How many devices can be connected to I2C?

We can connect up to 128 devices to the I2C bus as the 7-bit can be from 0 to 127.

  1. Which bit is transmitted first by I2C?

The most Significant Bit (MSB) is transferred first. It can be a device address, register address, or data written to or read from a slave. for more

  1. What is the maximum speed of I2C?

The I2C communication protocol can be sped up to 3.4Mbps, though 400kHz is usually sufficient.

  1. What voltage is I2C?

 Voltages used are +5 V or +3.3 V, but systems with other voltages are also permitted.

Newsletter SignupLoving Our Content?

Subscribe to our weekly newsletter below and never miss any update that is most likely to blow your mind.