Core Networking · Study deck

I2C: Transactions and Bus Design

This first route builds I2C from electrical signaling through addressed transactions and bus constraints.

Packet Pete is your guide for this deck.

wiredcomm
Packet Pete, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain I2C Architecture: Describe the two-wire bus structure with SDA and SCL, and justify why open-drain outputs require pull-up resistors
  • Calculate Pull-Up Resistor Values: Apply the RC rise-time formula to select appropriate resistor values for a given bus capacitance and speed mode
  • Distinguish I2C Addressing: Identify how 7-bit addresses map to write and read bytes, and select device addresses to avoid bus conflicts
  • Implement I2C Transactions: Explain the read and write transaction sequences (START, address frame, ACK, data, STOP) and translate them into test steps
iotclass.org

Major section

Start With Many Chips Sharing Two Wires

I2C is useful because one controller can talk to many nearby devices using only SDA and SCL.

  • A microcontroller means a small computer on one chip that starts transfers and controls the device.
  • This proves one local bus setup, not every board layout; the deeper sections explain transfers, electrical limits, timing, arbitration, and recovery.
  • The shared bus works only when addresses, pull-ups, capacitance, timing, and acknowledgements all stay inside the design limits.
iotclass.org

Major section

I2C Wiring, Addressing, and Pull-Up Resistors

"I love I2C!" said Temperature Terry. "I only need two tiny wires -- SDA for data and SCL for the clock -- to talk to Max.

  • the microcontroller explained how it works. "I am the master.
  • When I want Sammy's temperature reading, I send his address -- say 0x48 -- on the bus.
  • "The pull-up resistors are super important though," warned the LED. "The wires need them to work properly.

Why it matters

Everyone else stays quiet because it was not their address.".

iotclass.org

Major section

I2C Wiring, Addressing, and Pull-Up Resistors (continued)

And sometimes two sensors accidentally have the SAME address -- then you get conflicts.".

  • "I2C is not the fastest," admitted the battery, "only 100 to 400 kHz for most IoT work.
  • But it is incredibly simple -- just two wires for dozens of sensors!
  • Perfect for when you have a temperature sensor, a humidity sensor, a pressure sensor, and a display all connected to one microcontroller.
iotclass.org

Major section

I2C Overview

I2C (IIC, I-squared-C) is a popular multi-device communication bus developed by Philips (now NXP) in the 1980s.

  • Carry: I2C Bus Connections into characteristics; use: V CC as its limiting condition.
Physical I2C wiring: two lines (SDA and SCL) run across all devices on the bus. Pull-up resistors hold both lines HIGH by default; any device can pull a line LOW using its open-drain output.
Physical I2C wiring: two lines (SDA and SCL) run across all devices on the bus. Pull-up resistors hold both lines HIGH by default; any device can pull a line LOW using its open-drain output.
iotclass.org

Major section

I2C Write Transaction

The decision in i2c write transaction must preserve that labelled boundary.

  • Master sends slave address + write bit (0).
  • Master sends register address.
  • Master sends data byte.
I2C Write Transaction Sequence
I2C Write Transaction Sequence
iotclass.org

Major section

I2C Read Transaction

Master sends REPEATED START (restart without releasing bus).

  • Master sends slave address + read bit (1).
  • Slave sends data byte(s); master ACKs each except the last.
  • Master sends NACK on final byte (signals end of read).
I2C Read Transaction with Restart Condition
I2C Read Transaction with Restart Condition
iotclass.org

Major section

Putting Numbers to It

For I2C fast mode (400 kHz), the rise time must be under 300 ns (from 0 V to 70% of V~CC~, the I2C sampling threshold).

  • The I2C spec also requires minimum current drive capability of 3 mA at 0.4 V LOW level.
  • This gives a range of 967 Ω to 7,080 Ω for a 50 pF bus.
  • The standard 4.7 kΩ falls well within this range—which is why it works reliably for most setups.
  • With 100 pF bus capacitance (many devices or long traces), the maximum drops to ~3.5 kΩ, so 2.2 kΩ pull-ups are needed.
iotclass.org

Deck summary

Key takeaways

I2C is useful because one controller can talk to many nearby devices using only SDA and SCL.

  • "I love I2C!" said Temperature Terry. "I only need two tiny wires -- SDA for data and SCL for the clock -- to talk to Max.
  • And sometimes two sensors accidentally have the SAME address -- then you get conflicts.".
  • I2C (IIC, I-squared-C) is a popular multi-device communication bus developed by Philips (now NXP) in the 1980s.
  • The decision in i2c write transaction must preserve that labelled boundary.
iotclass.org

Retrieval practice

Recall check

Packet Pete says: answer from memory, then check your reasoning.

Q1A BME280 sensor is configured with its SDO pin tied to GND, giving it address 0x76. You want to read a register from it. What is the first byte transmitted on the SDA line after the START condition?

A0x76 — the 7-bit device address sent directly
B0xEC — the 7-bit address 0x76 shifted left by 1 with the write bit (0) appended
C0xED — the 7-bit address 0x76 shifted left by 1 with the read bit (1) appended
D0x00 — a general call address is used first to wake all devices
Show answer

Answer: B Every I2C transaction opens with a 7-bit address byte: the device address occupies bits [7:1] and the R/W flag sits in bit 0.

iotclass.org

Print reference

Answers

Answer key.

  1. B · Every I2C transaction opens with a 7-bit address byte: the device address occupies bits [7:1] and the R/W flag sits in bit 0.
iotclass.org