Embedded track
I2C, SPI and UART

I2C, SPI and UART: talk to chips

The three buses every sensor, screen and radio speaks. Scan a bus, share it, run two screens on one clock, log to SD, then read every byte on a logic analyzer.

FreeIn your browser2 courses, 13 lessons, about 9 hours
Start freeWhat a bus is, and UART between two boardsSee the course
Overview

How you will learn it

Almost every module you will ever wire, from a temperature sensor to a color screen, talks over I2C, SPI or UART. Each has its own wires, its own addressing and its own ways to fail, and knowing all three is what lets you use any part from its datasheet.

Talk to chips teaches them in one course on a simulated Uno, and puts a logic analyzer on the bus so you can see every start bit, address and acknowledge. Under the hood then bit-bangs a protocol by hand.

Outcomes

What you will learn

  • Explain how UART, I2C and SPI differ and when to use each.
  • Scan an I2C bus and share it between several devices.
  • Run several SPI devices on one clock with chip selects.
  • Decode traffic on a logic analyzer and bit-bang a protocol yourself.
Your route

The courses and lessons to take

Every lesson opens in the editor right away, signed in or not, and the simulator checks each step.

  1. Step 1 · 7 lessons · 4 h

    Talk to chips: I2C, SPI and UART

    All three buses.

    1. What a bus is, and UART between two boardsTwo Unos on one wire and a shared ground: what a bus is, how a UART frame is timed with no clock wire, and how the receiving board filters the messages it cares about.
    2. I2C: who is on the bus?Two wires, many chips: seven-bit addresses, the acknowledge bit, why I2C needs pull-up resistors, and the scanner sketch every maker runs first on a new board.
    3. SPI: two color screens, one clockFour wires and a chip select: how SPI clocks bytes out with no addresses, why a screen with no CS pin needs its own wires, and the clock modes that trip everybody up once.
    4. See the bus on the logic analyzerClip a logic analyzer on SDA and SCL and read a real I2C transfer bit by bit: START, address, ACK, data, STOP. Then meet a bus that looks like I2C and is not.
    Every lesson in the course
  2. Step 2 · 6 lessons · 5 h

    Under the hood

    A protocol bit-banged from scratch.

    1. Bit-banging a protocolDraw UART frames by hand on a plain pin with counted delays, let the Mega's real USART receiver judge them, read them on the logic analyzer, and break the baud rate on purpose.
    Every lesson in the course
Keep going

Guides and tools on the same subject

Track

Embedded track

Arduino, ESP32, Raspberry Pi Pico and STM32: pins, timing, buses, motors, WiFi, registers and debugging, every lesson checked on a simulated board.

See the whole track
Questions

Questions people ask

What is the difference between I2C and SPI?

I2C uses two shared wires and gives each device an address. SPI uses a clock, two data lines and a chip select per device, and runs much faster. The course runs both on one board.

Is UART the same as Serial?

Yes. Arduino's Serial is a UART: two wires, no clock, and both sides agree on a baud rate.

Why does my I2C device not show up?

Usually missing pull-ups, the wrong address or swapped SDA and SCL. The scan lesson shows each case.