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

 by pburgess
Featured
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?
 
Remove these adsRemove these ads by Signing Up

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.
1-40 of 47Next »
VirtualBoxer says: Apr 13, 2013. 9:08 PM
Do you seriously think that you can't get away without the voltage pin?
VirtualBoxer says: Apr 13, 2013. 8:43 PM
Dormant? Quite not. It's used to get the name and supported modes of the monitor.
Zibri says: Jan 6, 2013. 8:56 AM
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!).
Computothought says: Apr 4, 2011. 12:03 PM
I have not tried this but it looks interesting.
http://www.maxim-ic.com/app-notes/index.mvp/id/3230
cyrozap says: Jun 17, 2009. 9:42 AM
When you say that it doesn't work on the Eee PC, which one are you referring to? I have the 1000HE.
Derin says: Aug 16, 2008. 3:41 AM
AHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!THEY DONT SELL USB TO I2C ADAPTERS HERE AND IM NOT ALLOWED TO USE LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ReCreate in reply to DerinFeb 4, 2009. 1:30 PM
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
soshimo in reply to DerinDec 16, 2008. 6:02 PM
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).
Gavabc123 in reply to DerinOct 23, 2008. 1:54 AM
Why aren't you allowed to use Linux?
collard41 says: Aug 13, 2008. 2:40 AM
do you have a schematic for this, as i was interested in making a PCB for one thanks good i'ble
Ora says: May 7, 2008. 5:51 PM
So, there is no way to do this with a macbook pro since it uses an Nvidia graphics card?
Derin in reply to OraJun 22, 2008. 9:26 AM
will ati cards on a pc work?
pburgess (author) in reply to DerinJun 22, 2008. 3:57 PM
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 (www.paintyourdragon.com/uc/i2c) 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.
pburgess (author) in reply to OraMay 7, 2008. 6:23 PM
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!
infoATcruysen.nl says: May 17, 2008. 3:21 AM
infoATcruysen.nl says: May 17, 2008. 2:59 AM
Shareware version of software for windows:
http://www.nicomsoft.com/
Itsgoofytime says: Apr 23, 2008. 5:59 PM
This isnt really a robot, so why is it entered in the robot contest?
_soapy_ in reply to ItsgoofytimeMay 17, 2008. 1:59 AM
Because it is both brilliant, and robotic control related. So far, it gets my vote.
pburgess (author) in reply to ItsgoofytimeApr 23, 2008. 7:06 PM
From the contest rules: "we're asking you to document specific parts of your robot for this contest."
Itsgoofytime in reply to pburgessApr 24, 2008. 3:14 PM
ah i missed that. just realized the servo too. Hope to see more soon.
DanOverholt says: May 14, 2008. 4:05 PM
Great stuff! you should definitely get a wiimote, tear it apart, and look into getting your code to talk directly to the wiimote's camera module, which speaks I2C - doing this increases the tracking rate to 200Hz: http://procrastineering.blogspot.com/2008/03/tracking-multiple-laser-pointers-200hz.html
moris_zen says: Apr 29, 2008. 1:19 PM
Any 1 got an example for windows driver source code?
loafswell says: Apr 28, 2008. 7:38 AM
I did some googling around and it appears that nvidia does have a ddc bus and that it can be configured in x configuration, this is in linux. Why do you say that it can't be done with nvidia cards?
pburgess (author) in reply to loafswellApr 28, 2008. 8:40 AM
Greetings! My "doesn't work with NVIDIA" remarks were intended to be specific to Mac OS X. I'm sure the situation will be different on other platforms, just haven't delved deeply enough on the Linux or XP sides to be able to quantify this yet. The pointers are appreciated. I'll have a look at the X server code for ideas when I have time to get this going in Linux.
Wire54321 says: Apr 27, 2008. 12:53 PM
were can i buy a I2C temperature sensor. Thanks for the help
pburgess (author) in reply to Wire54321Apr 28, 2008. 12:09 AM
The example temperature program uses a Microchip TCN75A, which I ordered from the manufacturer at Microchip Direct (mind you, this particular sensor is only available in a surface-mount version, so if you're going to use it on a prototyping board, for instance, you'll have to add "spider legs" or use a socketed adapter). If you're persistent, sometimes components turn up from time to time on eBay.
Bongmaster says: Apr 23, 2008. 6:09 AM
there appears to be an arduino clone that has a USB bootloader that can connect direct to the usb with no ftdi chip or usb to ttl board. its on the arduino.cc forums somewhere.
gmoon in reply to BongmasterApr 23, 2008. 6:38 AM
There are AVR USB hacks (probably converted for use with the Arduino), but they have sever limitations: USB 1.1 only, they need a specific xtal (so they are useless if you need a different clock source), sometimes require "overclocking" the AVR, take up valuable programming memory, IRQs, etc. There are a couple USB-capable AVRs, but PIC seems to do USB better. But the i2c interface is directly supported by the AVR hardware (it's hardwired logic, not software.)
gip_mad in reply to gmoonApr 23, 2008. 7:37 AM
A lot of PICs have hardware I2C! :)
gmoon in reply to gip_madApr 23, 2008. 8:14 AM
Sorry, I didn't mean to imply that they didn't. Both have several comm protocols in hardware....
Bongmaster in reply to gmoonApr 23, 2008. 9:31 AM
i have only just heard of i2c. i already knew that the atmega168 and 8 had ttl serial, but this i2c is something i am gonna look into :)
gmoon in reply to BongmasterApr 23, 2008. 6:07 PM
Atmel calls i2c a "two-wire serial interface." I guess they didn't want to pay for licensing the "i2c" name or technology--just create a compatible version. Could be why you hadn't heard of it....
sumguysr in reply to gmoonApr 26, 2008. 9:56 PM
i2c has a thousand names as phillips didn't actually patent it but only holds the trademark. It's probably not a matter of cost but rather ability, from what I've heard phillips is pretty picky about who they let in on their licensing of i2c. 2wire is a pretty common name for it though that tends to show up anywhere the other names are mentioned.
gip_mad says: Apr 23, 2008. 10:20 AM
Great instructable! I'll test it soon, I hope to find some info on how to use the DDC in win XP.
ScottSEA in reply to gip_madApr 26, 2008. 7:45 PM
Let me know when you make any progress with the I2C adapter on XP - I too have an XP and would love to try this, but I'm busy on another project right now.
coonass says: Apr 26, 2008. 4:30 AM
what's the bandwidth on this port? I ask because I'd like to consider using this as an oscilloscope channel, but I'd like to know what the top end of the frequency range is that I'd be able to measure. I can handle voltage scaling by putting in my own external opamp.
pburgess (author) in reply to coonassApr 26, 2008. 9:42 AM
Howdy! It's either 100 or 400 KHz; I've read contradictory figures online, and unfortunately the official DDC specification costs a fair chunk of change. The bandwidth I'm seeing when reading/writing an I2C serial EEPROM leads me to believe it's the 100 KHz figure.
coonass in reply to pburgessApr 26, 2008. 11:53 AM
Thanks! I appreciate your prompt reply. 100 KHz could be helpful in some apps (I'm not working in RF just now, and more important to me just now is audio and logic pulses in automotive electronics systems - I need more than anything else to be able to sort signal from noise. Looks like that bandwidth might be of real help. Cheers again.
bobulator says: Apr 26, 2008. 2:05 AM
niiice. now I just have to look behind my PC to see if it has one of these DV thingys. does it work on Lunix?
pburgess (author) in reply to bobulatorApr 26, 2008. 2:27 AM
In theory this could work on just about any video port; doesn't need to be DVI, both VGA and HDMI ports can support this capability as well. Haven't adapted the code to Linux yet, but that's something I'd like to do with it at some point. This recent rash of mini laptops like the Eee PC might make great and affordable 'bot brains.
1-40 of 47Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!