I2C (Inter-Integrated Circuit) is a serial communication bus used to connect peripherals to a microcontroller, such as the Arduino. Created by Philips Semiconductor in the 1980s, I2C allows multiple peripherals to be connected with just two wires: one for data (SDA) and one for clock (SCL).
Each device on the I2C bus has a unique address, enabling the master to communicate individually with each slave.
The I2C link is a half-duplex link, i.e. you can’t listen and send data at the same time. The I2C link has an average data rate of 100 kilo-hertz to 1 Mega-hertz.
As shown in the diagram below, the I2C link is non-exclusive, meaning that a master can talk to several slaves.
A wide range of electronic components can communicate with each other using just 2 wires:
To use I2C with an Arduino board, you need to know which pins are dedicated to I2C communication. The pins vary slightly depending on the Arduino model, but generally they are :
For the Arduino Uno board, these can be found in the image below:
To write a message on the I2C you first need to know the I2C address on which you want to send the message. Here’s the program for sending data over the I2C:
Here’s an example of how to read the Arduino board’s I2C at address 0X3C:
If you’d like to see an example of an Arduino project using I2C, take a look at our course on the RTC module.
If you’d like to learn about other communication buses, you’ve got UART and SPI.