Tutorials
Learn More
I2C Introduction
I2C is a two-wire serial bus protocol originally developed by Philips Semiconductors, now NXP Semiconductors. It is mainly used for short-distance communication between integrated circuits on the same PCB or within the same system.
Unlike UART, I2C is synchronous because communication is controlled using a clock signal. Unlike SPI, I2C does not require a separate chip-select line for every peripheral device. Instead, every target device has an address, and the controller selects a device by sending that address on the bus.
The two I2C lines are:
- SDA: Serial Data
- SCL: Serial Clock
Both lines are bidirectional in normal I2C operation and are pulled HIGH when the bus is idle.
Why I2C is used
I2C is useful when a controller must communicate with several peripheral devices but the available number of pins is limited. A microcontroller can connect to many I2C devices using the same SDA and SCL lines, provided that each device has a unique address.
For example, a microcontroller can communicate with an RTC, EEPROM, temperature sensor, accelerometer, ADC, and display controller using only two pins.
I2C Advantages
- It requires only two signal lines, SDA and SCL.
- Multiple devices can share the same bus.
- Each target device is selected using an address.
- It supports bidirectional communication.
- ACK/NACK bits provide basic transfer-level handshaking.
- It supports multi-controller systems through arbitration.
- The protocol is simple and well supported by many ICs and microcontrollers.
I2C Limitations
- It is slower than many SPI implementations.
- Bus speed and reliability depend on pull-up resistance and bus capacitance.
- It is mainly suitable for short-distance board-level communication.
- Address conflicts can occur when two devices have the same fixed address.
- Debugging can be harder when a device holds SDA or SCL LOW.
- Higher-speed operation requires careful electrical design.
I2C Applications
I2C is commonly used with:
- EEPROMs and small non-volatile memories
- Real-time clocks
- Temperature, pressure, humidity, and light sensors
- Accelerometers, gyroscopes, and magnetometers
- ADCs and DACs
- GPIO expanders
- Display controllers
- Audio codecs
- Power-management ICs
- Battery fuel gauges
- Touch controllers
I2C Protocol