Device communication is done because to relay information about environment and to share data between two devices. Arduino board communicate with other board or any systems. There are some rules for this communication. They are called arduino communication protocols. There are namely three protocols like UART, SPI and I2C.They may be different in implementation but they serve the same purpose.
1) UART PROTOCOL:
UART stands for Universal Asynchronous Reception Transmission . This protocol allows the arduino to communicate with serial devices. This protocol was developed by Gordon Bell at Digital Equipment Corporation in 1960s. This system communicates with digital pin 0, 1 with another computer via USB port. Here the data is transferred as sequential bits and one line for transmitting data (TX) where other line is for receiving data (RX). For a device to be able to communicate via UART protocol, it must have hardware like arduino uno. Devices which communicate via this portal contain additional information about starting and ending data and conforms whether the message has received correctly . It is asynchronous because it does not depend on clock between communication. Its main purpose is to transmit and receive serial data.
2) SPI PROTOCOL:
Serial Protocol Interface or SPI is a very common communication protocol used for two way communication between two devices. This was developed by Motorola in 1980s. Unlike an asynchronous serial interface, SPI is not symmetric. SPI includes clock signal.The requirement is that clock must be lower than the maximum frequency for all devices involved. There are four different SPI bus standard that all have to do with SCK signal (Serial clock- The clock pulse which synchronize data transmission generated by master). The 4 modes are broken down into two parameters, CPOL and CPHA. CPOL stands for clock polarity and designates the default value (high/low) of SCK signal when the bus is idle. CPHA stands for clock phase and determines which edge of clock data is sampled (rising/falling). SPI protocol is used to send data from microcontroller to small peripherals such as shift registers, sensors and SD cards.
3) I2C PROTOCOL:
I2C is the combination of of SPI and UARTs. I2C stands for interintegrated circuit. It was developed by Philips in early 1980s. By using I2C, we can connect multiple slaves to a single master and we can have multiple masters controlling single, or multiple slaves. This is used when one want to have more than one microcontroller sending data to single memory card or SD card or displaying text to a single LCD. This protocol only uses two wires to transmit data between devices.
With this, data is transferred in messages. Messages are broken up into frames of data. Each message has an address frame that contains binary address of slave and one or more data frames that contain the data being transmitted. Conditions like start and stop conditions, read and write bits, ACK and NACK bits are also included in each data frame of message. It is well known and widely used protocol. This is used for long distance communication whereas SPI used for short distance communication.