I2C

Back to Index

Related SPI, QWIIC, STEMMA, STEMMA QT, What is the difference between Stemma and Stemma QT, GPIO

WIP

I2C (eye-squared-C) or Inter-Integrated Circuit is a synchronous, multi-master, multi-slave, packet-switched, single-ended, serial communication bus invented in 1982 by Philips Semiconductors.

I2C is a serial communication protocol commonly used for sensors and other simple devices that don’t need to send or receive data quickly. I2C has become the standard for sensors - rarely see SPI over sensors anymore.

I2C uses four wires

  • power
  • ground
  • clock (SCL)
  • data (SDA)

I2C uses unique addresses for devices so it makes it possible to daisy chain multiple devices.
NOTE: if you need to use the same type of component or sensor twice, some devices allow you to set a jumper to change the default address.
Another option is to use SparkFun STEMMA QT / Qwiic TCA9548A Mux Breakout - 8 Channel

Addresses range from 0 to 128 A seven bit wide address space theoretically allows 128 I2C addresses – however, some addresses are reserved for special purposes. Thus, only 112 addresses are available with the 7 bit address scheme. 5

THe QWIIC and STEMMA QT devices exclusively communicate via I2C. STEMMA 4-pin connectors can also use I2C. Grove devices can also use I2C. If you are unsure if a device uses I2C, if you see SCL and SDA pins then it is an I2C device.

I2C is ideal for short distances and low bandwidth communication. I2C uses a client/server architecture.

I2C limitiations:

  • No hot plugging support
  • No auto device discovery
  • Addresses collisions may occur (if multiple devices use the same address)

Working with Multiple Same Address I2C Devices

I2C Ecosystems

https://blog.adafruit.com/2022/02/03/luxuriously-long-stemma-qt-cable-samples/

Quote

I2C was never meant to go 200, 300 or 400mm but we laugh in the face of death thanks to these samples we got of some looooooooong stemma qt cables. each cable has two JST SH connectors on either end and a PVC sheathed center. we were inspired by this tweet https://twitter.com/lovyan03/status/1480867328783163396 about I2C wire interleaving with power in order to avoid cross-talk for long cables (I2C is not differential so you definitely do not want to use twisted wires!) if you look closely, the cable is flat and has the red power wire between SDA and SCL instead of having them next to each other. we’re just trying it out here with our fancy new ESP32 Feather V2 which has an onboard STEMMA QT connector

I2C over the network WiFiWire is provides a Wire (i2c) protocol able to communicate over AsyncUDP. You can have your program use a Wire (i2c) sensor/device, but it is communicating over a network rather than wiring. There are server and client software.

Additional References 1. Adafruit Learn Guide: I2C devices 2. CircuitPython Basics: I2C and SPI 3. CircuitPython Basics: Digital Inputs & Outputs 4. CircuitPython Basics: Analog Inputs & Outputs 1. Adafruit Learn Guide: Working with I2C devices 5. I2C addressing

This page was last updated on 2022-05-05 16:55:07 -0500.