Using I2C (Inter-Integrated Circuit) in Arduino

Learn using I2C in Arduino. I2C (Inter-Integrated Circuit) is a serial protocol for two-wire interface to connect to low-speed devices like Micro-controller, EEPROMs, I/O Interfaces and other similar devices in Embedded Systems. Also, It can be said that I2C is a bus for communication between a master (or can be multiple masters) and a single or multiple slave devices.

I2C Interface

  • I2C uses only two wires SCL (Serial Clock) and SDA (Serial Data).
  • SCL: The clock line used to synchronize all data transfers over the I2C bus.
  • SDA: The Data Line used for transmitting the Data between devices.

I2C Addresses

Each I2C Slave devices have a 7-bit addressing or also can have a 10-bit addressing. Addresses need to be unique on the Bus to determine the slave that where to transmit the data. The master device needs no address since it generates the clock (using SCL) and addresses individual I2C Slave devices. The maximum number of Slave devices that can be used while using 7-bit addressing are 112 devices and the Maximum number of Slave devices used in 10-bit addressing are 1008 devices.

Working of I2C in Arduino

This shows the working of I2C in Arduino. In I2C data transfer occurs in Message Frames which are then divided into Frames of Data. A message contains the various number of Frames in which one frame contain the address of the slave, and remaining frames for data to be transmitted.

The message includes START/STOP Conditions, READ/WRITE Bits and ACK/NACK (Acknowledgement/No-acknowledgement) Bits between each data Frame. Working shown below,

  • Start Condition: The SDA line switches from high to low voltage level before SCL switches from high to low.
  • Stop Condition: The SDA line switches from low to high voltage level after SCL switches from low to high.
  • Address Frame: 7 or 10-bit sequence unique to each slave that identifies the slave when the master wants to talk.
  • Read/Write Bit: A bit specifying whether the master is sending data to the slave or requesting data from it.
  • ACK/NACK Bit: Each frame in a message follows an ack/nack bit.

Leave a Reply