What is I2C?
I2C (Inter-Integrated Circuit, pronounced "eye-squared-see") is a communication protocol that lets multiple devices share just 2 wires:
- SDA (Serial Data) on A4
- SCL (Serial Clock) on A5
How It Works
- One master (Arduino) controls the bus
- Multiple slaves (displays, sensors) each have a unique address
- The master sends the address of the device it wants to talk to
- Only that device responds
Common I2C Addresses
| Device | Address | |--------|---------| | SSD1306 OLED | 0x3C or 0x3D | | BME280 sensor | 0x76 or 0x77 | | PCA9685 servo | 0x40 | | EEPROM | 0x50 |
Advantages
- Only 2 wires for any number of devices
- Built-in addressing, no extra pins per device
- Well-supported by Arduino Wire library
- Standardized with a huge ecosystem of I2C devices
Wiring
All I2C devices connect to the same two wires:
Arduino A4 (SDA) ──┬── [OLED SDA] ──┬── [Sensor SDA]
│ │
Arduino A5 (SCL) ──┬── [OLED SCL] ──┬── [Sensor SCL]
Add 4.7kΩ pull-up resistors on SDA and SCL (many breakout boards include these).
Scanning for Devices
If you're not sure of a device's address, run an I2C scanner sketch to discover all connected devices.