← How-Tos
electronics May 7, 2026 ◑ 1 views ◯ 1 min read

I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols

i2cspiuartserialcommunicationprotocolarduinoesp32wiresensorselectronics

Introduction

Every microcontroller project eventually needs to talk to something else — sensors, displays, memory chips, wireless modules, or another microcontroller. I2C, SPI, and UART are the three universal serial communication protocols that make this possible. Each has distinct strengths: I2C uses just two wires and supports multiple devices, SPI is blazing fast with full-duplex transfers, and UART is simple, universal, and works over long distances. This guide explains how each protocol works electrically, when to choose one over the others, how to wire them correctly, and complete Arduino and ESP32 code examples for real sensors and displays.

Quick Comparison

FeatureI2CSPIUART Wires2 (SDA, SCL) + GND4 (MOSI, MISO, SCK, CS) + GND2 (TX, RX) + GND SpeedUp to 3.4 Mbps (Fast Mode+)Up to 50+ MbpsUp to 1 Mbps (typical: 9600-115200 bps) DevicesUp to 127 on one busOne per CS pin (limited by GPIO)Point-to-point (1-to-1) DirectionHalf-duplexFull-duplexFull-duplex ComplexityMediumLowLowest DistanceShort (