Skip to content

General hardware communication protocols

Serial (UART)

Serial communication is the most widely used method protocol to transfer information between processors and peripherals in embedded systems and IoT devices alike.

It just needs two wires:

uart

(Image source: circuitbasics.com)

In serial communication, data is in the form of bits or binary pulses. The transmission modes are classified as Simplex, Half Duplex and Full Duplex.

Simplex Method:

In simplex method, if the sender is transmitting the data then receiver can only accept and vice versa. So simplex method is one-way communication technique. In other words, either of the devices that is, the sender or receiver can be active at a time.

Half Duplex Method:

In half duplex method, if the sender is transmitting then receiver can accept but cannot send and similarly, vice versa. Here, both the sender and receiver can be active but not at the same time.

Full Duplex Method:

In full duplex method, both receiver and transmitter can send data to each other at the same time. In other words, both the devices are senders and receivers.

SPI

SPI or Serial Peripheral Interface is a protocol used to communicate between one master and one or more than one slaves. Unlike Serial, SPI is a synchoronous protocol, which means it uses a clock pin to sync up the data being sent. SPI is ideal for communication between microcontrollers and sensors where large amounts of high speed data don’t need to be transferred.

When data is sent from the master, it's sent out on the line called MOSI, for "Master Out / Slave In" and the slave sends data in in MOSI, for "Master In / Slave out". Through whichever line the data is being sent, master sets the clock.

Pins required for SPI communication: * SCLK - Serial Clock * MOSI - Master Out / Slave In * MISO - Master In/ Slave out * SS (slave select pin)

SPI

(Image source: circuitbasics.com)

I2C

I2C or Inter-Integrated Circuit circuit is also a communication protocol used for short distance communications and it supports more than one master and slaves. Communication is done using 8 bits, where each slave has a unique 7 bit address, making it able to support more than a thousand slave devices.

Pins required for I2C communication:

  • SDA (Serial Data) – The line for the master and slave to send and receive data.
  • SCL (Serial Clock) – The line that carries the clock signal.

SPI

(Image source: circuitbasics.com)