Understanding I2C: The Protocol That Connects Everything
A beginner-friendly guide to I2C communication — how it works, when to use it, and common pitfalls to avoid.

#What Is I2C?
I2C (Inter-Integrated Circuit) is a two-wire communication protocol that lets multiple devices talk to each other using just two lines: SDA (data) and SCL (clock). It's the most common way to connect sensors, displays, and other peripherals to a microcontroller.
#How It Works
One device acts as the controller (formerly "master") and initiates all communication. Other devices are targets (formerly "slaves"), each with a unique 7-bit address. The controller sends a start condition, the target address, and then reads or writes data.
#Why I2C Is Popular
Only two wires — You can connect dozens of devices with just SDA and SCL. Compare this to SPI which needs a separate chip select for each device.
Standardized addressing — Each device type has a default address. Most OLED displays are 0x3C, BMP280 pressure sensors are 0x76 or 0x77. Check the datasheet.
Built-in acknowledgment — The target acknowledges each byte, so you know if communication succeeded.
#Common Pitfalls
Missing pull-ups — I2C lines are open-drain and need pull-up resistors (typically 4.7kΩ). Without them, nothing works.
Address conflicts — Two devices with the same address on one bus will collide. Some sensors have address pins to resolve this.
Bus length — I2C is designed for short distances (under 1 meter). For longer runs, consider using an I2C buffer or switching to RS-485.
#Quick Start
Connect VCC, GND, SDA, and SCL between your microcontroller and sensor. Add 4.7kΩ pull-ups on SDA and SCL to VCC. Use a scanner sketch to verify the device is detected, then use the appropriate library to read data.