I2C Interface (the two wires interface)

The I2C interface is a very popular interface used by many sensors and electronic devices.  A master device (the host) uses two wires to communicate with a slave device.  The host is you Arduino board.  The Arduino will initiate all communications.


One wire is used for the clock signal (SCL) and one wire is used for the data (SDA).  To make is easier, we will always use an Orange wire for the data (SDA) and yellow wire for the clock (SCL).  Up to 127 devices can be connected on the same bus (set of wires).  This means that all SDA lines are connected together (sharing the same row on the breadboard) and all SCL lines share their own row on the breadboard.


Each device on the bus needs a unique address so the host can communicate with it.  Addresses are usually 7-bits and are expressed in Hexadecimal (a base 16 notation - we will learn Hexadecimal in another lesson).  Matrix uses the address 0x70 by default, which is the same as the number 1110000 in binary.


The clock (SCL) line is a signal generated by the host at either 100KHz or 400KHz.  This represents the speed of the data on the bus.  It is either 100,000 bits/second or 400,000 bits/second.  The smallest frame that a host can send or receive is comprised of 2 bytes - the first byte is the address and the 2nd byte is the data sent or received.


The data line is responsible for sending or receiving the data going back and forth as well as the acknowledgement from the devices back to the host.