Module: Communication

I2C: How Sensors Talk

Wire management used to be a nightmare. Imagine running different wires for every single sensor on your robot. I2C (Inter-Integrated Circuit) solves this by letting you connect dozens of chips using just two signal wires.

The Conference Call Analogy:

"Think of I2C like a conference call. Everyone is on the same line, but only speaks when their name (address) is called by the host (Master)."

The 4 Magic Wires

1. SDA (Serial Data)

The "Talking" wire. This is where the actual data bits (0s and 1s) travel back and forth.

2. SCL (Serial Clock)

The "Metronome". It ticks rapidly to keep the sender and receiver perfectly synced in time.

3. VCC (Power)

The energy source. Usually 3.3V or 5V. Without this, the chip won't wake up.

4. GND (Ground)

The common ground. Essential to complete the circuit and give the signals a baseline.

The "Address" System

Since everyone shares the same two wires, how does the Master know who it's talking to?

Every I2C device comes from the factory with a unique Hex Address (like 0x29 or 0x68).

  • Start: Master shouts "Hey 0x29!"
  • Ack: Device 0x29 replies "I'm here!"
  • Data: They exchange data while others ignore it.
  • Stop: Master hangs up.
⚠️

Common Pitfalls

  • Pull-up Resistors: The bus needs "helper" resistors to pull the lines high. Most modules have them built-in, but bare chips don't!
FIG 1.0: THE BUS
STATUS: Ready. Click a button to start.
MASTER
SDA
0x29
DATA
0x40
DATA
SCL
SLAVE 10x29
SLAVE 20x40

Think of it like a conference call. Everyone is on the same line, but only speaks when their name is called.

Why use I2C?

ProtocolWires NeededSpeedBest For
I2C2 (Shared)MediumConnecting many sensors easily
SPI4 per deviceVery FastDisplays, SD Cards
UART2 (1-to-1)SlowGPS, Bluetooth, Debugging