Foundations · Lesson 6 of 11 · about 12 min
UART, I2C and SPI
How chips talk to each other
A microcontroller needs to talk to sensors, screens, memory cards and your computer. Almost everything uses one of three standard buses.
The real app, running in your browser: this lesson with its 3D preview on a simulated ESP32 DevKit (30 pins). No install, nothing to plug in.
| UART | I2C | SPI | |
|---|---|---|---|
| Wires | 2 | 2, shared | 3, plus 1 per device |
| Devices | 2 | Many, by address | Several, by select wire |
| Speed | Slow | Medium | Fast |
| Typical use | Debug messages to the computer, GPS | Sensors, small screens | SD cards, displays |
Each bus is a peripheral inside the MCU: you write a byte into its data register and the hardware sends it bit by bit. When a byte arrives, it can raise an interrupt. Same pattern as always: registers and interrupts.
Interview questions
- When would you choose SPI instead of I2C?
- Why does I2C need pull-up resistors?
- What does a NACK on the I2C bus tell you?
No answers here on purpose: try answering out loud first. In the BoardPilot app, the interview coach reads your own answer and tells you what was right, what is missing and what a senior interviewer would ask next (it uses the AI provider you choose in the app). Embedded systems interview questions →
Key terms
Peripheral Open-drain (open-collector) I2C SDA and SCL I2C address ACK and NACK SPI Chip select (CS) UART (serial port) Baud rate
In the app, the lessons come alive
The lessons have interactive demos and hands-on labs checked on your board in the app. These pages are the readable version: the demos are described in words, and the labs need the app.