What is I2C?

A synchronous serial bus connecting several devices on two wires, clock (SCL) and data (SDA), selecting the partner by address. The lines are open-drain with pull-ups.

Field: Embedded Systems & Firmware

Japanese name: I2C

Two open-drain wires

I2C (inter-integrated circuit) connects a controller and many target devices (also called master and slaves) with just two lines: a serial clock, SCL, and serial data, SDA. Every device drives the lines only through open-drain outputs, which can pull a line low or release it; pull-up resistors return released lines high. This wired-AND arrangement means no two devices can fight with opposite levels. The pull-up value is a trade-off: smaller resistors charge the bus capacitance faster for cleaner rising edges but waste more current when a line is held low. Common speed grades are 100 kHz standard mode, 400 kHz fast mode and 1 MHz fast mode plus.

Anatomy of a transfer

A transfer begins with a START condition, SDA falling while SCL is high; otherwise SDA may change only while SCL is low. The controller then sends a 7-bit address and a read/write bit. On the ninth clock of every byte, the receiver acknowledges by pulling SDA low (ACK); if SDA stays high, that is a NACK. Data bytes follow, each with its own acknowledge, and a STOP condition, SDA rising while SCL is high, ends the transfer. Reading a sensor register usually writes the register number first, then issues a repeated START to switch direction without releasing the bus.

Clock stretching and arbitration

Open-drain lines also let devices cooperate. A slow target can hold SCL low after a byte, known as clock stretching, and the controller waits until the line is released. When two controllers start at once, each watches SDA while transmitting; a controller that releases SDA for a 1 but sees it held at 0 knows another device is sending a 0, and it backs off. The winner's message is never corrupted. When troubleshooting, a missing ACK after the address points to a wrong address, a missing or unpowered device, or broken wiring.

Address conflicts and I2C versus SPI

Because devices are selected by address, two identical parts with the same fixed address cannot share a bus. Many parts provide address-select pins that change the low bits when tied to supply or ground; otherwise use a second I2C peripheral or an I2C multiplexer. Compared with SPI, which uses push-pull lines and a chip-select per device to reach tens of MHz, I2C is slower but needs only two wires however many devices are attached.

Try it: questions about I2C

What is a characteristic of I2C communication?

  1. AEach device needs a dedicated chip-select line
  2. BSeparate transmit and receive lines allow both directions at once
  3. CSeveral devices share two wires, clock (SCL) and data (SDA), and the partner is selected by address
Show answer and explanation

Answer: C. Several devices share two wires, clock (SCL) and data (SDA), and the partner is selected by address

I2C is synchronous serial communication that connects several devices with only two wires, SCL and SDA. The master first sends the partner's address (usually 7 bits), and only the device with that address responds. The lines are open-drain, pulled up to 1 by resistors so any device can pull them low. It suits parts where few wires matter more than speed, such as temperature and acceleration sensors and EEPROMs.

In I2C, how does the receiver of a data byte acknowledge it?

  1. AThe receiver holds a separate line at 1
  2. BDuring the ninth clock, the receiver pulls SDA low (ACK)
  3. CThe receiver echoes the same byte back
Show answer and explanation

Answer: B. During the ninth clock, the receiver pulls SDA low (ACK)

In I2C, on the ninth clock after the 8 data bits, the receiver acknowledges by pulling SDA low (ACK). If no one pulls it low, SDA stays at 1 through the pull-up, which is a NACK. If no ACK follows an address, the device may be missing, the wiring broken or the address wrong, which provides a clue when troubleshooting.

FAQ

Why does I2C need pull-up resistors?

I2C devices use open-drain outputs that can only pull a line low, so resistors are needed to bring SDA and SCL back high when no device is driving them. Without pull-ups the lines would float and the bus would not work.

How fast is I2C?

Standard mode runs at up to 100 kHz, fast mode at 400 kHz and fast mode plus at 1 MHz, with a less common high-speed mode at 3.4 MHz. Actual speed is also limited by bus capacitance and pull-up strength.

What is the difference between I2C and SPI?

I2C shares two open-drain wires among many devices and selects them by address, which saves pins but limits speed. SPI uses a clock, separate data-in and data-out lines and a chip-select per device, allowing much higher speeds at the cost of more wires.

Questions that mention I2C (2)

I2C appears in 4 practice questions across 1 topic, including Embedded Systems & Firmware.

  1. You want to connect two identical I2C temperature sensors to the same I2C bus, but both have the same address. Which is a correct solution?
  2. Which comparison of UART, SPI and I2C is correct?

Books on Embedded Systems & Firmware Ad

Learn hands-on: parts and kits

Building real circuits is a good way to check what you learned in the questions.

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary