Skip to main content Link Search Menu Expand Document (external link)

Some Important Terms and their explanation

You might be knowing these terms already but if you don’t, I welcome you to fork and commit your own edit with respect to explanation.

Table of Contents

  1. Some Important Terms and their explanation
    1. Table of Contents
    2. I2C Communication protocol
      1. DATA PROTOCOL IN I2C BUS

I2C Communication protocol

  • Also pronounced as “I squared C” or Two Wire interface
  • It is responsible for establishing a communication between multiple master devices(in our case Arduino) and multiple slave devices.
  • Only two wires are required for almost 128(112) devices when using 7-bit addressing and up to almost 1024(1008) devices when using 10 bit addressing. How is it possible?
    • Each device has a preset ID or a unique device address so the master can choose with which device we will be communicating
  • The two lines are SCL and SDA
    • SCL or Serial Clock generates clock signal to synchronize data transfer between the devices on the I2C bus and its generated by the master device.
    • SDA or Serial Data is responsible for carrying the data.

The two lines are open drain which means pull up resistors needs to be attached to them so that the lines are high, because the devices on the I2C bus are active low. Resistors range from 2k for 400 kbps (higher speed) to 10k for 100 kbps (lower speed)

DATA PROTOCOL IN I2C BUS


i2c comm protocol

Img courtesy: How to Mechatronics video on I2C

  1. Start condition occurs when data line drops low while the clock line is still high
  2. each data bit is transferred at each clock pulse
  3. 8th bit is used for indicating whether the master will write to the slave(logic low) or read from it(logic high)
  4. The next bit ‘acknowledge’ is used by the slave device to indicate whether it has successfully received the previous sequence of bits
  5. So this time the master device hands the control of the SDA line to slave device and if slave device has successfully received previous sequence it will pull the SDA line down to condition called Acknowledge. And if it doesn’t pull the SDA line down, the condition is called Not Acknowledge i.e., didn’t receive the previous sequence of bits.
    • The reasons for Not Acknowledge could be
      • Slave might be busy
      • Might not understand the received data
      • Can’t receive any more data
  6. Internal registers are locations in the slave’s memory containing various information or data
  7. After the data is completely sent, the transfer will end with a stop condition which occurs when the SDA line goes from low to high while the SCL line is high.

I2C_scanner is a simple sketch which scans the I2C bus for devices. If a device is found, it is reported to the arduino serial monitor.

SERIAL COMMUNICATION.
UART - Universal Asynchronous Receiver TransmitterSPI - Serial Peripheral Interface
UARTI2CSPI
1 to 1SimplexDuplex
AsynchronousSynchronousSynchronous
2 Wires2 wires4+ wires
20 kbps1 mpbs25 mbps
Acknowledge PinsNo AcknowledgeNo Acknowledge
Medium PowerMedium PowerLower Power
15m distance1m distance20cm distance