Inter-Integrated Circuit (I2C) communication is a type of serial communication that allows interfacing multiple sensors to the computer. I2C communication consists of two wires of a clock and a data line. The Raspberry Pi Zero's clock and data pins for I2C communication are GPIO 3 (SCL) and GPIO 2 (SDA), respectively. In order to communicate with multiple sensors over the same bus, sensors/actuators that communicate via I2C protocol are usually addressed by their 7-bit address. It is possible to have two or more Raspberry Pi boards talking to the same sensor on the same I2C bus. This enables building a sensor network around the Raspberry Pi.
The I2C communication lines are open drain lines; hence, they are pulled up using resistors, as shown in the following figure:
Let's review an example of I2C communication using an example.