What is I2C? How does it work? // Technology

Electrical specification

I2C is a two wire, bi-directional, multi-master, open-drain bus, which means master and slave devices can both transmit and receive.

  • SDA – data
  • SCL – clock

It can operate at 5 volts, 3.3 or down to 1.8 volts. This can make logic level shifting a bit more complicated, but these days most people use the common and cheap BSS138 MOSFET to handle this.

Since I2C has open-drain outputs that pull the lines down you will need to add pullup resistors on all devices.
Values from 1K to 10K ohms are often used.
Devices connected to this bus can sit anywhere on a 7 or 10 bit address space and operate in the same manner as MAC addresses on an Ethernet network. This means you can have up to a theoretical maximum of 1024 devices.

However, in practice you are limited by two factors; address space clashes & bus capacitance.

Address space clashes

There’s no real standard for address assignment, so you often have the scenario where device addresses will clash.

This can be resolved by bus multiplexers, but will add more complexity to your circuit.

Bus capacitance

The lower the operating voltage, the greater the effect of capacitance caused by wires and tracks resulting in signals rising and falling more slowly and also cross-talk across wires.

So, you either have to lower the clock rate or shorten your wires when using lower voltages.

This limits the practical length of an I2C bus. The theoretical maximum is 1m. However, in practice, this is much shorter.