ring0 » blog

I2C VGA Adapter

tags: debian, i2c, vga, hdmi, dvi, hardware, electronics, logic level converter, linux 2012-07-07 08:41 by sre

For one of my projects I’m making heavy use of I²C devices. For development it would be nice to connect them to my notebook and develop and debug the sourcecode natively.

Luckily I remembered that all common display connection standards (VGA, HDMI, DVI) have an I²C control channel. In the linux kernel these pins are exported as I²C device by the graphic card driver. For example my intel driver exports 8 I²C devices.

So the only hardware needed to use an I²C device on my notebook is a cheap VGA cable. After cutting it in half we have two I²C adapters. I decided to create one cable for 5V I²C devices. This one is already done after cutting the cable in half. I soldered a jumper wire connector on the four needed wires and removed the others.

Driving 3.3V I²C sensors with 5V might destroy them, so some more work is needed for the second cable. For the logic parts (SDA and SCL) Sparkfun’s Logic Level Converter can be used (I can be bought for ca. 1.50€). It does need a 3.3V reference voltage, though. An external power supply can be avoided by using a low dropout voltage regulator, e.g. a LM1117-3.3 (ca. 1.00€).

You can see how easy the setup is by viewing the schematics.

On the software side it is enough to load the i2c-dev kernel module, which exports I²C devices to userland as /dev/i2c-<number>. Then one can try to find the correct device by using i2cdetect -l to find the correct device.

Documentation how to work with the device can be found in the kernel documentation.