The Inter-integrated Circuit (I²C) Protocol (pronounced I-squared-C) is a hardware serial interface (or "protocol") intended to allow multiple "slave" components to communicate with one or more "master" components. It used across many microprocessors and microcontrollers, including the Raspberry Pi.
I²C permits sensors and other IO devices to be connected to the controller (and/or each other) with only four wires (or really only two if you don't count Vcc and ground):
- 3-6V (Vcc, red)
- SDA (Serial Data Line, blue)
- SCL (Serial Clock Line, yellow)
- GND (Ground, black)
The colors listed are those used by Adafruit with their line of STEMMA Qt connectors.
The Pimoroni "Breakout Garden" set of I²C sensors also includes an "INT" (interrupt) pin, AKA "GCLK" or "GPIO4".
To View the Current I²C Devices#
To see what's connected on your Raspberry Pi, type (not including the % prompt):
% i2cdetect -y 1and you'll see something like:
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- 14 15 -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- 74 75 -- 77
Known I²C Devices#
Some well known I²C products (mostly a list of tested devices; there are thousands available). No two I²C may share the same address on an I²C bus, otherwise there will be contention.
Stock | Brand | Description | 7 bit address | Notes |
---|---|---|---|---|
1 | Pimoroni | RGB Potentiometer | 0x0E ‡ | uses Nuvoton MS51 |
1 | Pimoroni | RGB Encoder | 0x0F ‡ | uses Nuvoton MS51 |
2 | PiBorg | Thunderborg | 0x10 / 0x11 † | dual motor controller |
0 | Adafruit | VCNL4010 Proximity Sensor | 0x13 | infrared, 0-200mm range |
1 | Pimoroni | IO Expander | 0x18 ‡ | uses Nuvoton MS51 |
2 | Pimoroni | LSM303D 6DoF Motion Sensor | 0x1D / 0x1E † | |
1 | Adafruit | BH1750 Light Sensor | 0x23 / 0x5C | 16-bit Ambient Light Sensor |
1 | Pimoroni | LTR-559 Light & Proximity | 0x23 | light detection; 0-50mm range proximity detection |
3 | Pimoroni | VL53L1X Time of Flight | 0x29 | range 40mm-4m; 0x29 conflicts with BNO055 |
1 | Adafruit | BNO055 IMU Sensor | 0x28 / 0x29 † | 0x29 conflicts with VL531X |
0 | Adafruit | VL53L0X Time of Flight Distance Sensor | 0x29 | range 50-1200mm (2m on long range) |
1 | Adafruit | VL6180X Time of Flight Distance Sensor | 0x29 | range 5-100mm |
1 | PiBorg | Ultraborg | 0x36 | |
2 | Pimoroni | HT0740 10A Switch | 0x38 / 0x39 † | |
1 | Adafruit | INA260 Current Sensor | 0x40 / 0x41 / 0x44 / 0x45 † | up to 4 devices via 2 jumpers |
2 | Pimoroni | ADS1015 +/-24V ADC 3 Channel | 0x48 / 0x49 † | |
2 | Adafruit | ADS1015 12 bit ADC 4 Channel w Prog Gain | 0x48 - 0x4B † | |
1 | Adafruit | 9-DOF Orientation IMU Fusion Breakout - BNO085 (BNO080) | 0x4A | |
1 | Pimoroni | ICM20948 9-DOF Motion Sensor | 0x68 / 0x69 † | |
2 | Pimoroni | 11x7 LED Matrix | 0x75 / 0x77 † | 77 will be in conflict with 5x5 |
4 | Pimoroni | 5x5 RGB Matrix | 0x74 / 0x77 † | 77 will be in conflict with 11x7 |
0 | Adafruit | LSM9DS1 Accel Gyro Mag Temp 9-DOF | 0x1C / 0x1E Accel, 0x6A / 0x6B for Gyro | |
1 | Pimoroni | AS7262 6-channel Spectral Sensor (Spectrometer) | 0x49 | 6 spectral channels (450, 500, 550, 570, 600, 650nm) |
† jumper selectable ‡ software configurable
"Stock" is how many Murray has in his robot laboratory as part of exploratory design and development of the KR01 robot.
Links#
- I2C on Wikipedia
- Configuring I2C from AdaFruit
- I2C on SparkFun
- Adafruit's I2C Address List
- Raspberry Pi SPI and I2C Tutorial
- Pi clock-stretching bug
- Adventures in I2C: clock stretching on the Raspberry Pi, A good article about the Pi and I2C
- Raspberry Pi slave library for Arduino, Pololu's library for Pi to Arduino comms via I2c