This page (revision-21) was last changed on 2021-11-21 04:33 by Murray Altheim

This page was created on 2019-12-26 08:51 by Murray Altheim

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
21 2021-11-21 04:33 6 KB Murray Altheim to previous

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 changed 68 lines
The __Inter-integrated Circuit (I%%sup 2%%​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].
I2C 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)
# __SDA__ (Serial Data Line)
# __SCL__ (Serial Clock Line)
# __GND__ (Ground)
The Pimoroni "Breakout Garden" set of I2C sensors also includes an "__{{{INT}}}__" (interrupt) pin, ''AKA'' "{{{GCLK}}}" or "{{{GPIO4}}}".
!! To View the Current I2C Devices
To see what's connected on your Raspberry Pi, type (not including the {{{%}}} prompt):
{{{
% i2cdetect -y 1
}}}
and 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 I2C Devices
Some well known I2C products. No two I2C may share the same address on an I2C bus, otherwise there will be contention.
|| Stock || Brand || Description || 7 bit address || Notes
| 1 | Pimoroni | LTR-559 Light & Proximity | 0x23 |
| 3 | Pimoroni | VL53L1X Time of Flight (ToF) | 0x29 | range 40mm-4m
| 1 | Adafruit | VL6180X Time of Flight Distance Sensor | 0x29 | range 5-100mm
| 2 | Pimoroni | 11x7 LED Matrix #1 | 0x75 |
| 2 | Pimoroni | 11x7 LED Matrix #2 | 0x77 |
| 4 | Pimoroni | 5x5 RGB Matrix | 0x74 / 0x77 | 77 will be in conflict with 11x7 #2
| 2 | Pimoroni | [ADS1015 +/-24V ADC 3 Channel|Ads1015AnalogDigitalConverter] | 0x48 / 0x49 |
| 2 | Adafruit | ADS1015 12 bit ADC 4 Channel w Prog Gain | 0x48 - 0x4B (jumpers) |
| 2 | PiBorg | Thunderborg | 0x10 / 0x11 |
| 1 | PiBorg | Ultraborg | 0x36 |
| 1 | Pimoroni | ICM20948 9-DOF Motion Sensor | 0x68 / 0x69 |
| 1 | Adafruit | [BNO055 IMU Sensor|BNO055ImuSensor] | 0x28 / 0x29 |
| 0 | Adafruit | VCNL4010 Proximity Sensor | 0x13 |
| 0 | Adafruit | LSM9DS1 Accel Gyro Mag Temp 9-DOF | 0x1C / 0x1E Accel, 0x6A / 0x6B for Gyro |
| 0 | Adafruit | VL53L0X Time of Flight Distance Sensor | 0x29 | range 50-1200mm (2m on long range)
"Stock" is how many [Murray] has in his robot laboratory as part of exploratory design and development of the [KR01] robot.
!! Links
* [I2C|https://en.wikipedia.org/wiki/I%C2%B2C] on Wikipedia
* [Configuring I2C|https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c] from AdaFruit
* [I2C|https://learn.sparkfun.com/tutorials/i2c] on SparkFun
* [Raspberry Pi SPI and I2C Tutorial|https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all]
* [Pi clock-stretching bug|https://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html]
* [Adventures in I2C: clock stretching on the Raspberry Pi|https://www.recantha.co.uk/blog/?p=19880], A good article about the Pi and I2C
* [Raspberry Pi slave library for Arduino|https://github.com/pololu/pololu-rpi-slave-arduino-library], Pololu's library for Pi to Arduino comms via I2c
----
[{Tag Hardware}]
[{SET alias='I²C'}]