I2C Interface Overview

I2C Communication

I2C, or Inter-Integrated Circuit, is a chip-to-chip protocol supporting two-wire communication. An i2c object represents a connection between MATLAB® and an I2C adapter board. The adapter has one or more sensor chips connected to it. MATLAB sends commands to the adapter board, which is the I2C master device, in order to communicate with the chip, which is the I2C slave device. MATLAB always has the role of I2C master and cannot be used in the slave role.

Supported adapters are the Total Phase Aardvark I2C/SPI Host Adapter and the National Instruments™ USB-845x adapter board. Some applications of this interface include communication with SPD EEPROM and NVRAM chips, communication with SMBus devices, controlling accelerometers, accessing low-speed DACs and ADCs, changing settings on color monitors using the display data channel, changing sound volume in intelligent speakers, reading hardware monitors and diagnostic sensors, visualizing data sent from an I2C sensor, and turning on or off the power supply of system components.

Use fread and fwrite to communicate with the chip. Identify I2C devices using instrhwinfo('i2c').

Supported Platforms for I2C

You need to have either a Total Phase Aardvark host adapter or a NI USB-845x adapter board installed to use the i2c interface. The following sections contain the supported platforms for each option.

Using Total Phase Aardvark

The I2C interface is supported on these platforms when used with the Aardvark host adapter:

  • Linux® – The software works with Red Hat Enterprise Linux 4 and 5 with kernel 2.6. It may also be successful with SuSE and Ubuntu distributions.

  • Microsoft® Windows® 64-bit


For R2018b and R2018a, you cannot use the Aardvark adapter for I2C or SPI interfaces on the macOS platform. You can still use it on Windows and Linux. For releases prior to R2018a, you can use it on all three platforms, including macOS.

Using NI USB-845x

The I2C interface is supported on these platforms when used with the NI USB-845x host adapter:

  • Microsoft Windows 64-bit

See Also