OTD ACADEMY
Sign in / Sign up
Library

LIBRARYSPI vs I2C vs UART.

Pick the bus by the job. UART for a simple stream, I2C when pins are short and speed does not matter, SPI when you need speed. A side-by-side comparison.

Pick the bus by the job. Reach for UART for a simple point-to-point stream, I2C when you are short on pins and speed does not matter, and SPI when you need speed and can spare a pin per device. Most boards run more than one of them at once.

The trade-off at a glance

BusWiresClockDevicesSpeed
UART2 (TX, RX)none (async)2, point to pointlow to moderate
I2C2 (SDA, SCL)sharedmany, by addressmoderate
SPI3 plus 1 per devicesharedone per chip-selecthigh

Read the table as three trade-offs. UART costs the fewest ideas but only joins two devices. I2C adds as many devices as you like on the same two wires, at a lower speed. SPI buys the highest speed and full-duplex data, and pays a chip-select pin for every peripheral.

Which bus does a part use?

You rarely choose a sensor's bus; the part chooses for you. Its datasheet's first page states the interface, and that decides how you wire it and how many pins it costs. Read that line before you commit a design to a part.

A three-column comparison of UART, I2C, and SPI by wire count, speed, and number of devices.
The three on-board buses side by side: wires, speed, and how many devices each carries.

A single One Thousand Drones board often carries all three at once: USB serial back to the host, SPI to a fast converter, and I2C to a slow housekeeping sensor, each chosen for what it connects to.

Checkpoint

Quick check

You are out of pins and the sensor is slow. Which bus fits?
You need the highest data rate to a fast ADC. Which bus fits?
Where do you find out which bus a given sensor uses?
0 / 3 correct

One Thousand Drones engineering team · verified 2026-07