UART, SPI, I2C: Overview and Comparison


Universal Asynchronous Receiver Transmitter or UART is one of the oldest and most used protocols.

  1. It uses one line for transmitting data and one for receiving data. These are usually referred to as the TX and RX lines.
  2. Most often 8-bit data is transferred, as follows:
    • 1 start bit (low level),
    • 8 data bits
    • 1 stop bit(high level)
  3. The low-level start bit and high-level stop bit mean that there’s always a high to low transition at the start of the communication. This is a defining feature of UART
  4. The microcontrollers who want to communicate via UART have to agree on the transmission speed, the bit rate, as they have only the start bit’s falling edge to understand the start of the message.
  5. Communication may be simplex or half-duplex


Serial Peripheral Interface or SPI is an interface bus commonly used to send data between microcontrollers and small peripherals such as shift registers, sensors and SD cards.

  1. This uses a clock, hence synchronous
  2. It uses four lines:
    • Clock line (SCK),
    • Master Input, Slave Output(MISO) for the master to receive and slave to transmit,
    • Master Output, Slave Input(MOSI) for the master to transmit and slave to receive
    • Slave Select(SS) for selecting one among multiple slaves with which communication is desired.
  3. Note that master is defined as the micro-controller which sends the clock signal
  4. SPIĀ operates in full-duplex mode


Inter – Integrated Circuit or I2C can handle 128 slaves using just 2 lines.

  1. It uses only two lines: One for data (SDA) and one for clock (SCL)
  2. The slaves are not selected via a slave select line but via address bits.
  3. The first byte sent by the master contains a seven-bit address and a read/ write bit indicating whether the next bytes will come from the master or should come from the slave.
  4. After each byte, the receiver must send a 0 to acknowledge the reception of the byte
  5. If the master wants to receive the data, it only generates clock pulses. The slave has to make sure that the next bit is ready when the clock pulse arrives
  6. The data and clock lines are pulled up, i.e. two resistors pull the bus to a high level and the devices only send low levels. If they want to send high level, they simply release the bus.
  7. Atmel uses the word TWI (two-wire interface) which is the same as I2C, so any AVR device will not haveĀ I2C in the documentation but will have TWI. The Arduino library for I2C is appropriately called Wire.

Comparison of the protocols

Communication TypeHalf DuplexFull DuplexHalf Duplex
Number of Lines242
Type of CommunicationAsynchronousSynchronousSynchronous
Need for start/ stop bitYesNoYes (start/stop sequence required)
Slave Selection MethodSS LineAddress of the Slave

Further comparison:

  1. SPI is the fastest among the 3 protocols
  2. SPI has lower power requirements than I2C
  3. I2C requires only two pins for multiple slaves. SPI requires at least 4 pins, with one additional SS pin for each additional slave.

References and suggested reading:

  4. Wikipedia pages of the protocols are strongly recommended

Enjoyed this post? Then check out further posts related to firmware here. Also, follow IoT Espresso on Twitter to get notified about every new post.

Leave a comment

Your email address will not be published. Required fields are marked *