Electronics for Building Things · Lesson 15 · The Microcontroller

How Modules Talk: I²C, SPI & UART

The three "languages" that connect your board to sensors and displays.

Most of the cool parts — temperature sensors, OLED screens, real-time clocks — aren't single components but little modules that exchange data with your board over a bus. You don't need to understand the bus deeply; you need to recognize which one a module uses and wire it correctly. Then a library does the talking.

The one win Given a sensor or display module, you can tell which bus it uses and connect the right wires.

The three buses

BusWiresBest for
UART (Serial) 2: TXRX and back Two devices, point-to-point. Also how your board talks to your computer (the Serial Monitor).
I²C 2 shared: SDA + SCL Many modules on the same two wires, each with an address. The hobby default for sensors.
SPI 4: MOSI, MISO, SCK, CS Fast data — displays, SD cards, high-rate sensors. Each device needs its own CS line.

(Sources: SparkFun I²C, SPI, Serial/UART.)

The one you'll use most: I²C

I²C wins for hobby projects because many modules share just two wires. Every device has an address, so your board can speak to each in turn. Wiring is delightfully repetitive:

Rule of thumb Reach for I²C sensors when you can — minimal wiring, many devices, tons of libraries. Use SPI when you need speed (displays, SD). UART shows up for a few specific modules (GPS, some serial sensors) and for the computer connection.

You rarely write the protocol

The beautiful part: once wired, you install a library for the module and call simple functions like sensor.readTemperature(). The library handles the bit-level conversation. Your job is correct wiring and matching voltage (3.3V vs 5V — Lesson 4 still applies on these data lines!).

This is the doorway to the sensors in Lesson 18 — many of them are I²C modules you'll connect exactly this way.

Check yourself

Read this next (primary source) SparkFun — I²C (the one to know best), with Serial Communication and SPI alongside.
I'm your teacher — ask me anything. Send me a module you want to use and I'll tell you its bus, the exact wiring, and which library to install.

See also: Glossary · Signals & buses · Rules of thumb