World's Cheapest I2C (I-Squared-C) Adapter





Introduction: World's Cheapest I2C (I-Squared-C) Adapter

Make a sensor interface for your computer for under a buck!

Update 6/9/08: After exploring several avenues I've concluded there is no practical manner of implementing this technique in Microsoft Windows. This is not petty OS bashing, I've really busted a nut trying! Sorry! Windows users needing I2C capabilities are best served by existing USB-based solutions.

Update 5/24/08: Linux support has been added, as well as sample code for the Nintendo Wii Nunchuk controller and the BlinkM "smart LED." See the README.txt file included with the source code for directions on compiling and setup on Linux.

I2C (short for Inter-Integrated Circuit) is a two-wire serial bus typically used in computers for low-level communication between internal components. I2C is also popular in robotics. All manner of sensors and actuators are available in an I2C-compatible form: ultrasonic rangefinders, sensors for acceleration, tilt, temperature and pressure, servo controllers, and bus expanders that provide additional general-purpose (GPIO) lines.

Most modern microcontrollers (Atmel, Microchip PIC, etc.) have support for I2C built right in. But the processing power available on microcontrollers is limited, and software development - with specialized cross-compilers and programming environments - can sometimes be a chore. With laptops and single-board computers becoming ever smaller and more affordable, it's increasingly common to see these systems used directly in robotics and electronics projects. This provides ample power for new capabilities such as vision processing and more sophisticated A.I., and it greatly expands the scope of available development tools and languages...but it also presents a new problem: interfacing these "regular" systems to peripherals is typically done through mainstream consumer-grade ports such as USB; there's no externally-available "I2C port" we can just tap into to make use of our sensors...or is there?

Step 1: Existing Options

One way of connecting I2C devices to an ordinary desktop or laptop computer is through a USB-to-I2C adapter. There are at least a dozen such options out there, ranging from do-it-yourself kits with open source software, to sophisticated commercial units with every bell and whistle.

One downside to the USB-to-I2C approach is cost. A full-featured commercial model can cost $250 or more. Even the "free" homebrew alternatives assume a collection of parts and a prior investment in a microcontroller programmer and the related knowledge to make use of it. Another downside is the relative scarcity of driver support outside the popular Windows fold. Few of these devices work natively on Macintosh or Linux computers.

Step 2: DDC Is I2C

When I said in the introduction that there's no external I2C port on most computers, I lied. Turns out there is, and it's been there all along for nearly a decade now, mostly sitting dormant.

Most modern graphics cards and monitors have support for something called Display Data Channel (DDC), a communication link within a video cable that allows the computer and display to negotiate mutually compatible resolutions and permit software control of monitor functions normally accessed with physical buttons on the display.

DDC is, in fact, simply an implementation of an I2C bus with a few established rules. By tapping into this connection between the computer and monitor (or making use of the DDC lines on an spare unused video port, such as the external monitor connection on a laptop), one can interface with some I2C devices at virtually no expense, bypassing the usual need for an adapter device entirely.

All we need to physically access this I2C bus is a hacked-up video cable...

Step 3: Dissecting the Cable

Four wires are needed for our I2C interface: +5V power, ground, serial data and serial clock. Pinouts for the various types of video ports can be found on Wikipedia or Remember if using a VGA cable to find one with the full complement of pins; some only include a subset.

Cutting back the insulation and shielding from the outside of the cable, you'll likely find two groups of wires within. Thicker wires, or bundles of wires wrapped in additional shielding, usually carry the video signal. We're not interested in these and they can be trimmed back. Thinner, unshielded wires usually carry the DDC (I2C) signals among others. A multimeter or continuity tester can help in finding the correct four wires for your cable. Using a bare connector can be advantageous here, as you just need to solder four wires to the pins of interest.

A note on the +5V power: available current is very limited; about 50 mA according to the DDC specification. Most I2C devices sip just a tiny bit of current, so it should be possible to run several at once...but if using more than one or two LEDs (or other comparatively high-current devices), external power should be provided.

Step 4: The Completed Adapter

Here's the finished adapter. That's all there is to it! I made mine extra stubby so it could fit easily in my laptop bag, and added a four-pin plug that connects directly to an I2C servo controller that I have.

Step 5: Software and Projects

Mac OS X and Linux source code for working with the adapter can be downloaded from my web site (download link is at bottom of page). It's written in C, and you'll need to have gcc installed (Linux usually includes this by default, while Mac users will need to install the developer tools that are an optional installer on your original OS disc, or downloadable free from Apple). Example code is included for reading a temperature sensor, flashing a BlinkM "smart LED," writing and verifying a serial EEPROM, reading a Nintento Wii Nunchuk controller (Linux only), and communicating with a servo controller board.

Unfortunately this adapter scheme is not compatible with all systems. Support for DDC is not mandated, so not all video cards support this capability. I've had good luck thus far with Mac systems that have ATI or Intel graphics chips, but NVIDIA-based systems are out of luck. On the Linux side I've only successfully tested an IBM ThinkPad A31p (ATI graphics), but it would not work with an Asus EeePC (Intel).

The images here show a test rig that demonstrates various I2C devices in action. The computer continually reads the ambient temperature from an I2C temperature sensor, periodically logs this data to an I2C serial EEPROM chip (yes, it could just print to a file, but this was to further demonstrate I2C applications), and then a servo (through an I2C controller) serves as a makeshift indicator dial. With the library and sample code for these devices already in place, it only took a few minutes to put together this demo (and most of that was in making the indicator dial).



    • Clocks Contest

      Clocks Contest
    • Planter Challenge

      Planter Challenge
    • Oil Contest

      Oil Contest

    We have a be nice policy.
    Please be positive and constructive.




    how about an arduino and a small bit of software on it.. then serial to PC? less than $20

    The arduino recieves commands from the PC and handles the read/write etc to the IC2?

    couldn't you use the Bus Pirate as a cheap/simple adapter?

    only if software is already on the pc.

    also i noticed they are using a vga to usb or something? may be completely different then strait from vga.

    okay i have messed with this for some time now. i have a human interface to i2c bread board made with an accelerometer on it and now i have added my monitor's eprom at i2c address 10100000 which is standard for ddc or edid. all of these things i can access now via the human interface or basically push buttons i made. i can input the 2 address and the devices will hold the data line low in an ack. what i dont get is that the hdmi has a i2c 5+v line which is used to provide power to the eprom and originally i figured that would not need to be powered cause the pc will power it, well it doesnt or at least not for more than a few micro seconds that it uses the eprom to get edid of which i am blind to. so i had to power it but the monitor's eprom responds. also i am powering the open drain i2c bus. i believe when the display adapter is on then i will no longer need to as it will. the problem is how do i turn it on in windows and use the lines? i have been looking into i2c callbacks i believe interfaced by the video port driver in it's videoprt.sys files. i can get it to compile but it does not seem to work with the actual hdmi ports i2c lines? msdn documents that all for callback routines require the HwDeviceExtension as arguments and then the 2 write routines require an additional data value that is either 1 or 0 for what to actually write the line. everything compiles however i do not have a pointer to the hwdevice extension so i just leave it empty and it compiles, however in visual stuidio it will not accept 2 arguments which is weird cause msdn says 2? now i know these are not probably supposed to be functions accessed from outside the driver in a manner that i am accessing them however my code seems to compile which it shoudnt if they were not actually accessable? i wonder now if i use vidgetassociatedriverextension(device_deviceobject) and device object the monitor currently on, could i use that device extension? i also tried holding say the clock line low and then a for looping going through integers for device extension hopping that one would actually read the line low and then stop and tell me the integer reference to the device extension but that doesnt seem to work. im not even sure if these functions are even being acccessed write from the .sys file or if they are just defaulting to something useless like it just returns my argument that i inputed?? if anyone gets further should comment as this is the best source really for this. i will try posting a youtube vid of what i have so far maybe.


    Aquarela Systems designs and manufacturers i2c adapter in USB stick.

    Do you seriously think that you can't get away without the voltage pin?

    Dormant? Quite not. It's used to get the name and supported modes of the monitor.

    hmm that's wrong.. on windows there are several options to access i2c on nvidia, amd or intel cards. For example, google for WinI2C. Also, usingi NVAPI (again, google is your friend) is possible to use I2C on any nvidia card (I coded a small program to do that!).

    I have not tried this but it looks interesting.

    When you say that it doesn't work on the Eee PC, which one are you referring to? I have the 1000HE.

    AHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!THEY DONT SELL USB TO I2C ADAPTERS HERE AND IM NOT ALLOWED TO USE LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    2 replies

    what do you mean by"IM NOT ALLOWED TO USE LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" who cares if they don't want you to use linux...setup your own in a usb thumb drive

    There are several options. First you can install Cygwin and probably with some minor tweaks in the code get it to compile and run under Cygwin. Second, you can just replace the platform specific code (which there probably isn't much of being a Linux program) with Windoze code (I'm assuming the source is OSI, MIT or some other similar license).

    do you have a schematic for this, as i was interested in making a PCB for one thanks good i'ble


    So, there is no way to do this with a macbook pro since it uses an Nvidia graphics card?

    3 replies

    will ati cards on a pc work?

    Howdy! This should work with most ATI cards if you're running Linux (I don't have any Windows code yet). If you download the source from my site ( and look in the README.txt file, there are some instructions specific to Linux (regarding 'modprobe' and whatnot) that will give a pretty good indication of whether a particular card can support this or not.

    Unfortunately no, unless it's an older (2006) ATI-based MacBook Pro. Or at least that's been my experience so far with a couple of other NVIDIA-based Macs I've tried thus far; I've not tested this exact configuration yet. Sorry!