I2CDriver is an easy-to-use, open source tool for controlling I2C devices. It works with Windows, Mac, and Linux, and has a built-in color screen that shows a live “dashboard” of all the I2C activity. It uses a standard FTDI USB serial chip to talk to the PC, so no special drivers need to be installed. The board includes a separate 3.3 V supply with voltage and current monitoring.

It is available from Amazon, in the Excamera Store, from Crowd Supply, and from UK distributor Cool Components.

Contents

Getting Started

When you first connect I2CDriver to the USB port, the display blinks white for a moment then shows something like this:

Connect the three sets of colored hookup wires as shown, following the same sequence as on the colored label:

GND black
VCC red
SDA blue
SCL yellow

The top two signals carry power, the VCC line supplies 3.3 volts.

Across the top of the display I2CDriver continuously measures the USB bus voltage and the current output.

Software installation

The source for all the I2CDriver software is the repository. Available are:

Installation of the GUI and command-line utilities varies by platform.

Windows

This installer contains the GUI and command-line utilities.

The GUI shortcut is installed on the desktop:

launching it brings up the control window:

If there is only one serial device, the I2CDriver device should be automatically selected. If there is more than one device, select its COM port from the pulldown menu at the top. Once connected, you can select a connected I2C device and write and read data.

The command line utility i2ccl is also installed. For example to display status information:

c:\>"c:\Program Files\Excamera Labs\I2CDriver\i2ccl.exe" COM6 i
uptime 8991  4.957 V  30 mA  25.8 C SDA=1 SCL=1 speed=100 kHz

See below for more information on the command-line syntax.

Linux

For the command-line tool, clone the repository , then do:

cd i2cdriver/c
make -f linux/Makefile
sudo make -f linux/Makefile install
i2ccl /dev/ttyUSB0 i

and you should see something like:

uptime 1651  4.971 V  0 mA  21.2 C SDA=1 SCL=1 speed=100 kHz

MacOS

For the command-line tool, clone the repository , then do:

cd i2cdriver/c
make -f linux/Makefile
sudo make -f linux/Makefile install
i2ccl /dev/cu.usbserial-DO00QS8D i

(substituting your actual I2CDriver's ID for DO00QS8D) and you should see something like:

uptime 1651  4.971 V  5 mA  21.2 C SDA=1 SCL=1 speed=100 kHz

Note that the port to use is /dev/cu.usbserial-XXXXXXXX, as explained here.

Python 2 and 3

The I2CDriver bindings can be installed with pip like this:

pip install i2cdriver

then from Python you can read an LM75B temperature sensor with:

>>> import i2cdriver
>>> i2c = i2cdriver.I2CDriver("/dev/ttyUSB0")   # or something like COM16 for Windows
>>> d=i2cdriver.EDS.Temp(i2c)
>>> d.read()
17.875
>>> d.read()
18.0

You can print a bus scan with:

>>> i2c.scan()
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- 1C -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
48 -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
68 -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
[28, 72, 104]

The Python GUI (which uses wxPython) can be run with:

python i2cgui.py

which depending on your distribution looks something like this:

There are more examples in the samples folder in the repository.

help(i2cdriver) shows the documentation for the module.

C/C++

I2CDriver is contained in a single source file with a single header. Both are in this subdirectory. Usage follows the Python API and is fairly self-explanatory.

The command-line tool i2ccl

i2ccl is the same on all platforms.

The first parameter to the command is the serial port, which depends on your operating system. All following parameters are control commands. These are:

i display status information (uptime, voltage, current, temperature)
d device scan
w dev <bytes> write bytes to I2C device dev
p send a STOP
r dev N read N bytes from I2C device dev, then STOP
m enter I2C bus monitor mode

For example the command:

i2ccl /dev/ttyUSB0 r 0x48 2

reads two bytes from the I2C device at address 0x48. So with an LM75B temperature sensor connected you might see output like:

0x16,0x20

which indicates a temperature of about 22 degrees C.

I2C devices usually have multiple registers. To read register 3 of the LM75B, you first write the register address 3, then read two bytes as before:

i2ccl /dev/ttyUSB0 w 0x48 3 r 0x48 2
0x50,0x00

Which shows that register 3 has the value 0x5000.

The display

The main display on the screen has three sections. The top section is a heat-map showing all 112 legal I2C addresses. Devices that are currently active are white. Inactive devices fade to yellow, purple and finally blue. The middle section is a symbolic interpretation of current I2C traffic. Details on this are below. The bottom two lines show a representation of the SDA (blue) and SCL (yellow) signals.