Understanding the I2C and SPI protocols
Connecting our sensors and devices is mostly done using two different protocols. Some devices can use both, offering you the choice. First, let’s learn about I2C.
What is I2C?
I2C (also written as I2C and IIC) is an acronym for Inter-Integrated Circuit. It is a two-wire serial communication protocol (Figure 5.31), using serial data (SDA), and serial clock (SCL) lines. It is for communicating with sensors and devices. You can tell whether the sensor or device uses the I2C protocol because it has two pins specifically for data and clock. It uses these two connections for transmitting and receiving data. The data communicated is transferred bit by bit through the SDA line.
The I2C protocol is synchronous, meaning that the output of bits is synchronized by a shared clock signal. This is shared with a microcontroller and sensor (previously called master and slave). You will still come across these terms, which...