← Back to blog

I2C, SPI and UART: what they are and when to use each bus

Inside almost any electronic product, chips need to talk to each other: the microcontroller reads a sensor, drives a display or stores data in a memory. That conversation happens over serial communication buses, and the three most common are UART, SPI and I2C. Choosing the right one affects pin count, speed, power and firmware complexity.

MCU UART · 2 wires (TX/RX) Peripheral SPI · 4 wires (MOSI/MISO/SCK/CS) Peripheral I2C · 2 wires (SDA/SCL) Peripheral
The three most used serial buses to connect a microcontroller with its peripherals.

UART: the simplest serial bus

UART (Universal Asynchronous Receiver-Transmitter) connects two devices point to point with just two lines: TX (transmit) and RX (receive). It's asynchronous: there's no clock line, so both ends must agree on the speed beforehand (the baud rate, e.g. 115200 bps).

  • Pros: very simple, only 2 wires, ideal for one-to-one links.
  • Limits: connects only two devices, moderate speed and error-prone if clocks don't match.
  • When to use it: debug console, GPS, Bluetooth/WiFi modules, communication with a PC.

SPI: the fastest

SPI (Serial Peripheral Interface) is a high-speed synchronous master-slave bus with four lines: MOSI, MISO, SCK (clock) and CS (chip select). It's full-duplex: it sends and receives at the same time. Each slave needs its own CS line, so more devices mean more pins.

  • Pros: very fast (tens of MHz), full-duplex, no addressing.
  • Limits: many pins (one CS per device), meant for short on-board distances.
  • When to use it: displays, flash memories, fast ADCs, SD cards, high-data-rate sensors.

I2C: many devices, only two wires

I2C (Inter-Integrated Circuit) is an addressable synchronous bus that connects many devices over just two shared lines: SDA (data) and SCL (clock). Each device has a unique address, and both lines need pull-up resistors.

  • Pros: only 2 wires for many devices, built-in addressing, saves pins.
  • Limits: slower than SPI, half-duplex, requires pull-ups and careful design on long buses.
  • When to use it: sensors (temperature, IMU, pressure), EEPROM, I/O expanders, RTC.

Comparison table: I2C vs SPI vs UART

FeatureUARTSPII2C
Wires2 (TX, RX)4 (MOSI, MISO, SCK, CS)2 (SDA, SCL)
ClockNo (asynchronous)Yes (synchronous)Yes (synchronous)
Typical speedLow-mediumVery high (tens of MHz)Medium (100k–3.4M)
Number of devices2 (point to point)Several (1 CS per slave)Many (by address)
DuplexFull-duplexFull-duplexHalf-duplex
Best for1-to-1 links, debuggingSpeed and data throughputMany sensors with few pins

How to choose and common mistakes

  • If you need speed (display, memory), pick SPI. If you need to connect many sensors while saving pins, pick I2C. For a simple one-to-one link or debugging, UART.
  • In I2C, don't forget the pull-up resistors on SDA and SCL: it's the most common mistake.
  • Watch out for voltage levels (3.3 V vs 5 V): a mismatch can damage the chip or break communication.
  • SPI and I2C are for short distances on the board; for long runs or between units, consider RS-485 or CAN.

Conclusion

UART, SPI and I2C solve different problems: simplicity, speed, or many devices with few pins. Choosing well from the start avoids board respins and firmware headaches. At Regular Solids we integrate and debug I2C, SPI, UART, CAN and RS-485 buses every day, between sensors, peripherals and embedded systems. If you have a product with several chips that must understand each other, let's talk.