A sensor is on the bench, a microcontroller is already chosen, and the schematic looks almost finished. Then a practical question appears: which serial interface should connect everything? The part offers UART, SPI, and I2C—sometimes all three—and each option seems plausible.
This choice affects more than a few pins. It shapes board routing, software complexity, achievable update rate, power behavior, debugging tools, and how easily the design can grow when another peripheral is added.
UART, SPI, and I2C are all widely used, mature interfaces. None is simply “best.” Their strengths come from different assumptions about wiring, device roles, speed, addressing, and reliability.
The useful question is not “Which bus is fastest?” but “What does this peripheral need, and what constraints does the whole system impose?”
🧩 Start with the Peripheral’s Actual Job
Before comparing protocols, identify what must cross the connection. A configuration register written once at startup has very different needs from a display that receives image data many times per second.
Ask four concrete questions:
- How much data moves in each transaction?
- How often must it move?
- How many devices share the connection?
- How far apart are the devices physically?
An environmental sensor usually sends short readings at modest intervals. A high-resolution ADC, external flash memory, or display may require sustained throughput. That distinction often narrows the choice immediately.
📬 UART in One Sentence
UART, short for Universal Asynchronous Receiver/Transmitter, sends a stream of bits without a shared clock line. A basic full-duplex connection uses a transmit line, a receive line, and a common ground.
Both ends agree in advance on a bit rate and framing settings. Each byte is normally transmitted with a start bit, data bits, an optional parity bit, and one or more stop bits. Because there is no clock wire, the receiver uses the start-bit transition to time its sampling.
UART describes the signaling and byte framing handled by a UART peripheral. It does not, by itself, define messages, addressing, retries, or command meanings.
⚡ SPI in One Sentence
SPI, Serial Peripheral Interface, uses a clock generated by a controller plus data lines. In the common four-wire arrangement, SCLK carries the clock, MOSI sends data from controller to peripheral, MISO returns data, and a chip-select line chooses the active peripheral.
Data timing is tied directly to the clock, which makes SPI well suited to fast, regular data transfers. It is commonly used for displays, ADCs, DACs, sensors, radio transceivers, and nonvolatile memory.
SPI is intentionally flexible rather than tightly standardized. A device datasheet defines details such as clock polarity, clock phase, bit order, command framing, and chip-select behavior.
🪢 I2C in One Sentence
I2C, often written I²C, uses two shared lines: SCL for clock and SDA for data. Devices sit on the same bus and are selected by an address sent at the start of a transaction.
Its lines are normally open-drain or open-collector: devices actively pull a line low but rely on pull-up resistors for a high level. This allows multiple devices to share the wires without one device actively driving high while another drives low.
I2C is especially convenient when several low-to-moderate-speed peripherals—such as sensors, real-time clocks, GPIO expanders, or configuration EEPROMs—must share two MCU pins.
🔌 Count Pins Before Comparing Speeds
Pin budget is frequently the first real constraint. UART typically consumes two signal pins per point-to-point link. SPI consumes at least three shared signal pins plus one chip-select pin for each independently selected peripheral. I2C needs only two shared signal pins, regardless of the number of addressed devices.
That makes I2C attractive on small microcontrollers and compact modules. However, two pins do not automatically mean lower total design effort. Address conflicts, pull-up sizing, capacitance, and fault isolation can become more significant as an I2C bus grows.
SPI becomes pin-expensive when many peripherals each require a separate chip select, though decoders, GPIO expanders, and daisy-chain-capable devices can alter that tradeoff.
🚦 Understand Throughput, Not Just Clock Rate
A quoted clock or baud rate is not the same as useful payload throughput. UART adds framing bits around each byte. I2C adds start and stop conditions, addresses, acknowledgments, and often register-address bytes. SPI can have relatively little protocol overhead, but its peripheral-specific command bytes still consume time.
For example, a device that requires a command byte and register address before every small read may spend more time on setup than on sensor data. Conversely, a long SPI transfer to a display can approach the efficiency implied by its clock frequency.
Calculate the entire transaction: protocol overhead, data bytes, update interval, and any software delays. This is more reliable than choosing an interface from a single headline speed number.
⏱️ Latency Matters Differently from Bandwidth
Bandwidth is the amount of data transferred over time. Latency is the delay before a particular transfer completes. A system can have enough average bandwidth and still miss a deadline when bus access is delayed.
On a shared I2C bus, a controller may need to finish one transaction before servicing another device. On SPI, chip-select ownership and software scheduling can create similar delays. UART streams may also wait behind buffered output.
For an interrupt-driven sensor that must be read promptly, examine the worst-case bus transaction already in progress. For a human-readable status display, a few milliseconds of variation may be inconsequential.
🧭 Know Who Controls the Conversation
UART is naturally peer-to-peer: either side can transmit whenever its hardware and higher-level rules allow. That freedom requires a protocol decision about who speaks first and what happens if data arrives unexpectedly.
SPI usually has one controller that provides the clock and selects a peripheral. I2C also has controller-initiated transactions, while supporting bus rules for more complex multi-controller arrangements. Most embedded products use one controller in practice.
These roles affect software architecture. A simple microcontroller talking to a sensor fits controller-peripheral behavior well. A computer logging messages from a modem or debugging target often fits UART’s stream-oriented model better.
🪪 Addressing Is an I2C Advantage—and a Constraint
I2C puts an address on the bus, allowing the controller to select among devices without dedicating a wire to each one. This is elegant for a board containing several different peripherals.
But two identical I2C devices may have the same fixed address. Some parts offer one or more address-select pins; others do not. If two fixed-address devices are required, possible solutions include an I2C multiplexer, a second I2C controller, or selecting a different component.
SPI avoids address collisions because chip-select wiring identifies the target. UART avoids them in a point-to-point arrangement, but connecting multiple talkers needs additional hardware or a defined multidrop scheme.
🧮 Compare the Physical Wiring
| Interface | Typical signals | Shared devices | Typical strength | Common constraint |
|---|---|---|---|---|
| UART | TX, RX, ground | Usually point-to-point | Simple asynchronous links | No built-in addressing |
| SPI | SCLK, MOSI, MISO, CS, ground | Yes, with separate CS lines | Fast peripheral transfers | More pins and routing |
| I2C | SCL, SDA, ground | Yes, addressed bus | Many compact peripherals | Capacitance and pull-up limits |
All three interfaces require a common electrical reference in ordinary single-board designs. Omitting or poorly connecting ground can cause unreliable logic-level interpretation even when the signal wires look correct.
🔄 Full Duplex Is Not Always Useful
UART has separate transmit and receive paths, so both ends can exchange bytes simultaneously. SPI also has separate MOSI and MISO lines and shifts bits in both directions on every clock cycle.
Yet many SPI peripherals are functionally half-duplex: while the controller sends a command, returned bits may be dummy values; while it reads data, it may transmit dummy bytes solely to keep clocks running. The electrical interface is full duplex, but the useful information flow may not be.
I2C uses one bidirectional data line, so it is inherently half-duplex at the bus level. For common sensor configuration and reading tasks, this is rarely a disadvantage.
🧲 Pull-Up Resistors Define I2C Signal Quality
I2C’s pull-up resistors are not optional decorations. When no device pulls SDA or SCL low, the resistor charges the line capacitance toward the supply voltage. The resulting rise time must be fast enough for the selected bus mode and wiring capacitance.
A resistor that is too large produces slow rising edges, which can cause timing failures. A resistor that is too small increases low-level current and may exceed what devices can safely sink. Several breakout boards may each include pull-ups, making the effective combined resistance unexpectedly low.
Choose values from the relevant device and bus specifications, considering supply voltage, total capacitance, and installed pull-ups. A logic analyzer can reveal rounded rising edges that a digital schematic cannot show.
📏 Bus Length Changes the Answer
These interfaces are principally intended for short connections inside equipment or across a PCB. Cable length, connector quality, ground paths, electromagnetic interference, and edge speed all influence reliable operation.
I2C is particularly sensitive to capacitance because its high level rises through resistors. SPI’s fast push-pull edges can suffer ringing and reflections on longer traces or cables. UART is often more forgiving for modest off-board links, but ordinary logic-level UART is still not the same as a robust long-distance physical layer.
For a cable leaving an enclosure or spanning noisy equipment, consider transceivers and standards designed for that environment, such as differential signaling. Do not assume an interface works over distance merely because a prototype did on a short jumper cable.
🛡️ Separate Protocol Choice from Electrical Protection
UART, SPI, and I2C describe communication behavior, not a complete protection strategy. A connector exposed to a user, another board, or a cable may need ESD protection, series resistance, filtering, level translation, or transceivers.
Voltage compatibility must also be checked in both directions. A 3.3 V microcontroller output may not satisfy a 5 V peripheral’s input-high requirement, while a 5 V output can damage an unprotected 3.3 V input.
I2C level shifting deserves special attention because its open-drain signaling differs from push-pull UART and SPI. Use a translator suitable for the bus mode and speed rather than treating every digital signal as interchangeable.
🧠 SPI Modes Cause Many First Failures
SPI devices specify a clock polarity and clock phase, commonly summarized as one of four modes. Polarity defines the clock’s idle level; phase defines which clock edge launches or samples data.
Selecting the wrong mode often produces data that looks nearly plausible but changes unpredictably, has shifted bits, or returns an incorrect device ID. Bit order and maximum clock rate must also match the datasheet.
A disciplined bring-up sequence helps: begin at a low clock rate, verify the mode, read a known register, inspect waveforms, then increase speed. Starting at the maximum speed makes signal-integrity and configuration problems harder to separate.
📣 UART Needs a Message Protocol
A UART transfers bytes but does not tell the receiver where one message ends and another begins. A robust application protocol must define framing, command structure, byte order, error detection, timeouts, and recovery after corrupted or missing bytes.
Possible framing approaches include fixed-length packets, a delimiter with escaping, a length field, or a binary packet format with a checksum or CRC. The best choice depends on whether arbitrary binary payloads are allowed and how severe a corrupted message would be.
Text commands can be convenient during development because a terminal can display them. Binary messages are often more compact and unambiguous, but they need better diagnostic tools.
✅ Acknowledgments Are Not the Same as Valid Data
I2C has an acknowledge bit after bytes, which confirms that a receiver participated in the byte transfer. It does not prove that a sensor measurement is fresh, a register value is meaningful, or an application command was accepted as intended.
SPI generally has no standardized acknowledge mechanism; its response is entirely device-specific. UART hardware may report framing or parity errors, but application-level delivery confirmation also requires an explicit protocol response.
Design the required assurance level deliberately. A configuration write that controls a harmless indicator may tolerate a simple retry. A command with safety or irreversible consequences needs clear state verification and conservative failure handling.
🧪 Choose Debugging Tools with the Interface
A USB-to-UART adapter and terminal are inexpensive ways to inspect UART traffic. They make UART especially pleasant for boot logs, command consoles, and bring-up messages.
A logic analyzer is valuable for SPI and I2C because it can decode clocked traffic, addresses, chip selects, and acknowledgments. An oscilloscope adds electrical insight: it shows overshoot, slow I2C rise times, ringing, and voltage margins that protocol decoders may hide.
Plan test pads for ground and important signals. A tiny amount of PCB space can save hours when a peripheral fails only at temperature, at a higher clock rate, or after a cable is attached.
🌡️ A Low-Rate Sensor Usually Favors I2C
Consider a hypothetical battery-powered board with a temperature sensor, pressure sensor, real-time clock, and small EEPROM. Each device transfers a few bytes occasionally, and the microcontroller has limited pins.
I2C is often a strong fit because all four devices can share two lines. Its moderate transaction overhead is negligible compared with the long interval between measurements, while the reduced pin count simplifies routing.
Check addresses before committing to the schematic. Also confirm that each device supports the voltage and bus speed you intend to use; a bus must operate within the limits of every attached component.
🖥️ A Display Often Favors SPI
Now consider a small color display receiving frequent pixel updates. Even a modest screen can require many bytes for a partial refresh, and a full update may be much larger than the configuration traffic sent to a sensor.
SPI is commonly appropriate because it can clock data quickly and uses a straightforward controller-to-display arrangement. Additional lines for data/command selection, reset, or backlight control may still be needed, so read the display controller documentation rather than counting SPI pins alone.
If refresh speed is unimportant, an I2C display can be simpler. The correct choice depends on the amount of image data and the visual responsiveness expected.
💾 External Memory Rewards Predictable Transfers
Serial flash and many other memory devices commonly use SPI or related variants. Memory access involves command opcodes, addresses, status polling, and blocks of data; SPI’s clocked transfers and high practical data rates suit this pattern.
For a data logger, calculate write time using actual page sizes, erase behavior, and worst-case busy periods—not only the SPI clock. Flash memory cannot always accept a continuous stream immediately after every command.
I2C EEPROM can be an excellent choice for small settings or calibration records. It is less attractive when the application needs frequent large writes or rapid retrieval of substantial data.
📡 UART Fits Modules and Human Interaction
Many GPS receivers, cellular modules, Bluetooth modules, and command-driven devices expose UART because their natural output is a stream of messages and because UART is easy to bridge to a PC for diagnostics.
UART is also a practical interface for firmware logs and a maintenance console. It can be kept separate from the main peripheral bus, so a malfunctioning sensor bus does not necessarily prevent diagnostic output.
Be cautious with flow control. At high data rates or when a receiver may pause, hardware flow-control signals or a carefully sized buffer can prevent lost bytes. If the module uses a proprietary message format, preserve its framing rules exactly.
🔋 Power Behavior Can Change the Decision
Communication consumes energy through switching, pull-up current, peripheral clocks, and the time the processor remains awake. The lowest-power option depends on duty cycle rather than protocol name.
I2C pull-ups draw current whenever a line is low, which matters in some low-voltage, high-duty-cycle designs. Fast SPI clocks increase switching activity but may finish a large transfer sooner, allowing the system to return to sleep. UART can wake a device on incoming activity if the hardware supports it.
Measure or estimate the complete transaction energy: wake-up, transfer, processing, and peripheral active time. A slower bus is not automatically the lower-energy bus.
🧱 Software Drivers Are Part of the Hardware Decision
A supported, well-tested driver can make an interface choice far easier. Microcontroller SDKs usually provide UART, SPI, and I2C abstractions, but their capabilities differ: DMA support, interrupt handling, transaction queues, timeout behavior, and multi-controller support can matter.
SPI drivers often require device-specific transaction settings, especially mode and maximum frequency. I2C drivers must handle acknowledgment failures, arbitration-related conditions where relevant, and bus recovery. UART drivers need buffering and framing logic above the hardware layer.
A clean design keeps protocol transport separate from device commands. This makes it easier to test a sensor driver, change a bus instance, or replace a peripheral later.
🩹 Plan Recovery Instead of Assuming Perfection
Real systems encounter brownouts, resets in the middle of a transaction, loose connections, and peripherals that start more slowly than expected. Each interface needs a recovery story.
For I2C, a device can occasionally leave SDA low after an interrupted transfer. Many controllers provide recovery features; a common approach is to generate clock pulses and then issue a stop condition, but implementation must follow the controller and device guidance. Resetting or power-cycling the affected peripheral may be necessary.
For SPI, deasserting chip select and reinitializing the peripheral can restore framing. For UART, a timeout and resynchronization rule help the receiver discard incomplete packets. Watchdogs should complement these methods, not replace thoughtful fault handling.
🚫 Avoid the “One Bus for Everything” Instinct
Using one interface everywhere can simplify a drawing, but it can also concentrate risk. A shared I2C bus that is held low may block every device on it. A heavily loaded SPI bus can delay time-critical transfers. A UART used for both logs and control can become difficult to parse when diagnostics are verbose.
Separate interfaces when timing, fault containment, security boundaries, or electrical environments justify it. For example, reserving a UART for service logs and using SPI for external memory often produces a more diagnosable product than forcing both functions through one link.
Conversely, do not split buses without a reason. Extra components, firmware paths, and pins also create cost and verification work.
📋 A Practical Selection Workflow
- List every peripheral, its data volume, update interval, voltage, and physical location.
- Check the interfaces the actual part supports, including maximum speeds and required auxiliary pins.
- Calculate transaction time and worst-case latency for time-sensitive devices.
- Map MCU pins, including chip selects, interrupts, reset lines, and debug access.
- Review electrical details: pull-ups, level compatibility, capacitance, trace length, and connector exposure.
- Prototype the riskiest connection early and inspect real waveforms before freezing the layout.
This workflow prevents a familiar mistake: selecting a protocol from convention and discovering later that an address conflict, pin shortage, or timing requirement makes the board awkward to complete.
⚠️ Common Selection Mistakes
- Choosing by maximum speed alone: short control messages rarely need SPI’s throughput, while a display may genuinely need it.
- Ignoring device addresses: two identical fixed-address I2C parts can create a late redesign.
- Forgetting protocol overhead: a bus rate does not equal useful payload rate.
- Assuming breakout boards are electrically neutral: they may add pull-ups, regulators, level shifters, and capacitance.
- Testing only on short jumpers: a finished enclosure and cable can change signal behavior.
- Skipping timeouts: firmware that waits forever turns a recoverable bus fault into a frozen product.
🧭 The Core Rule: Match Constraints to Strengths
Choose UART when a simple point-to-point byte stream, module interface, console, or asynchronous link is the natural fit. Add an application protocol whenever messages must be reliable and unambiguous.
Choose SPI when throughput, low transfer overhead, and direct controller-peripheral communication matter more than conserving pins. Verify mode, chip-select behavior, routing, and signal quality.
Choose I2C when several compatible, low-to-moderate-speed peripherals benefit from sharing two wires. Treat addressing, pull-ups, capacitance, and recovery as first-class design concerns.
The protocol is only one layer of the design. A reliable embedded system comes from matching its data needs, timing, electrical environment, firmware architecture, and maintenance requirements—not from treating any familiar interface as a default.
UART, SPI, and I2C are best chosen by the system constraints they resolve, not by habit or a single specification number. Make the tradeoffs explicit early, and the schematic, firmware, and debugging process will all become more manageable. 🔧📡🧭

