From Deskthority wiki
Jump to navigation Jump to search

I²C is a serial interface for communication between electronic components. An I²C bus has a microcontroller as master and one or more slaves components, of which there are many types.

I²C is often used for connecting left and right sides of a split ergonomic keyboard. It requires two data lines (SDA = serial data, and SCLK = serial clock), plus DC power. A keyboard interconnect with I²C therefore needs four wires. Different devices support 3.3V or 5V operation, and many work with both.


The protocol is controlled by the master microcontroller. The master is clocking the bus on the SCLK line, and either device is sending a bit on the SDA line on each clock depending on that particular slave device's protocol.

Each transaction begins with the master sending a START bit, followed by an address byte with the address to the slave device to receive the transaction. If the higher bits of the first byte is 1-1-1-1, the address is instead in encoded in two bytes. Only the slave with the matching address should act on a transaction. Multiple more bytes can then follow, followed by a STOP bit.

Values are sent most-significant-bit first (multi-byte values are thus sent in big-endian byte order).

Slave devices

Many chips supporting I²C have higher bits of the address fixed, and lower bits configurable through one or more pins.

Class Device Address byte Notes
Trackball PIM447 0 0 0 0 1 0 1 A  Could be added to mini keyboards
Other hand Pro Micro 0 0 1 1 0 0 1 R/W Slave hand (left or right) on many split kit keyboards using QMK firmware. Unless overridden, the MCU makes itself slave if it does not detect VBUS.
I/O Expander MCP23018 0 1 0 0 A2 A1 A0 R/W ErgoDox
I/O Expander MCP23017 0 1 0 0 A2 A1 A0 R/W Functionally equivalent to MCP23018 but electrically less robust
OLED display SSD1306 0 1 1 1 1 0 A0 R/W Lily58 and others
EEPROM Atmel AT24C16C 1 0 1 0 B2 B1 B0 R/W Modified ErgoDoxen and Kinesis Advantage. Not recommended for new devices.
EEPROM Atmel AT24C164 1 A2 A1 A0 B2 B1 B0 R/W A1 is inverted so that A2-A1-A0 is 0-1-0 if all three address pins are connected to GND. B2-B2-B1 selects 256-byte block.
EEPROM Microchip 24LC64 1 0 1 0 A2 A1 A0 R/W Not compatible with Atmel AT24C16x above
LED matrix ISSI IS31FL3733 1 0 1 A3 A2 A1 A0 R/W Input Club K-Type (RGB) and others. 192 LEDs (64 RGB)
LED matrix ISSI IS31FL3731 1 1 1 0 1 A1 A0 R/W Input Club Infinity60 and others. 144 charlieplexed LEDs.



A TRRS plug is a type of 3.5 mm phone connector used by many split ergonomic keyboards as interconnect. It is not considered very reliable for digital signals, but is inexpensive, common and relatively small.

"TRRS" stands for "Tip-Ring-Ring-Sleeve", indicating that is has four contacts. It was defined in the Japanese standard JEITA/EIAJ RC-5325A, "4-Pole miniature concentric plugs and jacks", originally published in 1993.

Keyboard Tip Ring Ring Sleeve

JST SH, JST PH and Grove

Several vendors of microcontroller and sensor boards have made mostly-compatible cabling systems for connecting them with I²C and power without requiring soldering. A number of cables and adaptor cables are available with different connectors.

Sparkfun's Qwiic uses compact four-pin JST SH connectors, always for I²C. Voltage is 3.3V.

Seeed Studio's Grove uses four-pin JST PH-like connectors for various purposes, of which some boards use them for I²C. The first two pins are always for power (3.3V or 5V) with the other two for signals.

Adafruit's STEMMA system uses four-pin JST PH connectors, always for I²C, and the connectors are similar enough so at to fit those used by Grove in either direction.
STEMMA QT uses the compact four-pin JST SH-connectors, in compatible pinout with Qwiic. However, STEMMA and STEMMA QT allow voltages between 3 and 5V, like Grove. The system also contains three-pin JST PH connectors for other purposes.

Note that Sparkfun Qwiic is always 3.3V, but the others use either 3.3V or 5V. STEMMA boards from Adafruit are supposed to work with the full range of 3-5V.

Cables are coloured:

Pin Qwiic/STEMMA QT STEMMA Grove Use
1 Black Black Black GND
2 Red Red Red VCC
3 Blue White White SDA
4 Yellow Green Yellow SCL

External links