OTD ACADEMY
Sign in / Sign up
Library

LIBRARYI2C, the two-wire bus.

I2C puts a whole bus of devices on two wires, SDA and SCL, each with an address. Why it needs pull-up resistors, and how it trades speed for pins.

I2C gets a whole bus of devices onto just two wires. A clock (SCL) and a data line (SDA) are shared by every device, and each one answers to its own address. When you have several slow sensors and few pins to spare, I2C is the bus to reach for.

Two wires, many devices

Every device hangs on the same SDA and SCL pair. The controller starts a transfer by sending the 7-bit address of the device it wants; only that device responds, and the rest stay quiet. That is how a dozen parts share one pair of wires with no extra pins.

Open-drain and the pull-ups

I2C lines are open-drain: a device can only pull a line low, never drive it high. A pull-up resistor on each line restores it to high whenever nothing is pulling it down. Leave the pull-ups off and both lines sit at an undefined level and the bus does nothing, which is the classic first I2C mistake. A 4.7 kΩ pull-up is a good starting value.

Deep dive· How fast, and the trade against SPI

I2C runs at 100 kbit/s in standard mode and 400 kbit/s in fast mode, with faster modes defined but less common (NXP UM10204). That is well below SPI, and the open-drain lines pulled up by resistors limit how fast the signals can rise back to high. The payoff is the pin count: two wires carry the whole bus no matter how many devices you add, where SPI needs another chip-select for each one. Slow and pin-thrifty is exactly the right trade for a handful of housekeeping sensors.

An I2C bus: two pull-up resistors on SDA and SCL, with several addressed devices sharing the same two lines.
One SDA/SCL pair, two pull-ups, and many devices, each reached by its address.

On a One Thousand Drones board a small I2C sensor shares its two lines with the rest of the bus and is reached by its address, so adding it costs no new microcontroller pins.

Checkpoint

Quick check

Why does I2C need pull-up resistors?
How does an I2C controller pick which device it talks to?
Compared with SPI, I2C is generally which of these?
0 / 3 correct

One Thousand Drones engineering team · verified 2026-07