Professional Documents
Culture Documents
I2C
Introducing I2C
I2C is a popular master-slave, multi-drop communication protocol used to exchange
information between devices over very short distances, typically on the same printed
circuit board. One of the attractive features of this bus is the low number of wires needed
to interconnect devices. Only two lines are involved: the Serial Data line (SDA) and the
Serial Clock line (SCL).
Note: You will nd I2C also written as I2C and also IIC. It is referred to as I
squared C or I two C or I-I-C. It all comes from 'Inter-Integrated Circuit' as in
communication between two integrated circuit boards.
Connections
The following gure shows a network with one master and three slaves.
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 1/6
9/29/2018 I2C | 2.2 Talking to each other in the IoT | IOT2x Courseware | edX
Img Src: By Gareth Halfacree [CC BY-SA 2.0 ], via Wikimedia Commons, By Andrzej Barabasz
(Chepry) [GFDL or CC BY-SA 3.0], from Wikimedia Commons By © Raimond Spekking / By
oomlout (ARDU-04) [CC BY-SA 2.0], via Wikimedia Commons
To expand this system, all that is needed is to connect additional devices to the common
lines, just like the ones already connected.
Clock mechanism
In I2C communication, each device takes a designated role: either a master, or a slave.
The master device pulses the clock for each transmitted bit, and the slave has to follow
this speed. It is possible for a slave to hold down the clock line to pause communication
until it is ready to continue. This mechanism is referred to as clock stretching and
ensures that a slave device has the ability to protect itself from being overwhelmed.
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 2/6
9/29/2018 I2C | 2.2 Talking to each other in the IoT | IOT2x Courseware | edX
Combined messages, where a master issues at least two reads and/or writes to one
or more slaves.
A HIGH to LOW transition on the SDA line while SCL is HIGH indicates a START condition.
This is always initiated by the Master.
A LOW to HIGH transition on the SDA line while SCL is HIGH de nes a STOP condition. See
the following timing diagram.
Devices are identi ed with a 7-bit address, therefore, at least theoretically, up to 128
devices can be connected on the same bus. In practice however, some addresses are
reserved for special purposes and only 112 are available. The following timing diagram
shows the transmission of one byte.
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 3/6
9/29/2018 I2C | 2.2 Talking to each other in the IoT | IOT2x Courseware | edX
Question 1
0 points possible (ungraded)
What are the names of the two wires involved in I2C communication?
Submit
Question 2
0 points possible (ungraded)
Which device pulses the clock for each transmitted bit to set the speed?
Master
Slave
An arbiter
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 4/6
9/29/2018 I2C | 2.2 Talking to each other in the IoT | IOT2x Courseware | edX
Submit
Question 3
0 points possible (ungraded)
A start condition is indicated by:
A low to high transition on the SDA line, while the SCL is high
A high to low transition on the SDA line, while the SCL is high
A high to low transition on the SCL line, while the SDA is low
A low to high transition on the SCL line, while the SDA is low
Submit
Question 3
0 points possible (ungraded)
How many devices can be connected on the same I2C bus in practicality, after reserving
addresses for special purposes?
121
128
112
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 5/6
9/29/2018 I2C | 2.2 Talking to each other in the IoT | IOT2x Courseware | edX
Submit
https://courses.edx.org/courses/course-v1:CurtinX+IOT2x+3T2018/courseware/be685d7eeb504746a165c57f2d2b6d65/712a098fed4d47278cdb4aa65… 6/6