Instructables
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
1-40 of 49Next »
geraldol123 days ago

Derin,

Aquarela Systems designs and manufacturers i2c adapter in USB stick.

Can most PC's and video cards act as an I^2*C slave?
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.
Zibri1 year ago
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.
http://www.maxim-ic.com/app-notes/index.mvp/id/3230
cyrozap5 years ago
When you say that it doesn't work on the Eee PC, which one are you referring to? I have the 1000HE.
Derin6 years ago
AHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!THEY DONT SELL USB TO I2C ADAPTERS HERE AND IM NOT ALLOWED TO USE LINUX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ReCreate Derin5 years ago
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 Derin5 years ago
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 Derin5 years ago
Why aren't you allowed to use Linux?
collard416 years ago
do you have a schematic for this, as i was interested in making a PCB for one thanks good i'ble
Ora6 years ago
So, there is no way to do this with a macbook pro since it uses an Nvidia graphics card?
Derin Ora6 years ago
will ati cards on a pc work?
pburgess (author)  Derin6 years ago
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)  Ora6 years ago
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!
Shareware version of software for windows:
http://www.nicomsoft.com/
This isnt really a robot, so why is it entered in the robot contest?
Because it is both brilliant, and robotic control related. So far, it gets my vote.
pburgess (author)  Itsgoofytime6 years ago
From the contest rules: "we're asking you to document specific parts of your robot for this contest."
ah i missed that. just realized the servo too. Hope to see more soon.
DanOverholt6 years ago
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_zen6 years ago
Any 1 got an example for windows driver source code?
loafswell6 years ago
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)  loafswell6 years ago
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.
Wire543216 years ago
were can i buy a I2C temperature sensor. Thanks for the help
pburgess (author)  Wire543216 years ago
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.
Bongmaster6 years ago
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.
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 gmoon6 years ago
A lot of PICs have hardware I2C! :)
gmoon gip_mad6 years ago
Sorry, I didn't mean to imply that they didn't. Both have several comm protocols in hardware....
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 :)
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 gmoon6 years ago
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_mad6 years ago
Great instructable! I'll test it soon, I hope to find some info on how to use the DDC in win XP.
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.
coonass6 years ago
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)  coonass6 years ago
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.
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.
1-40 of 49Next »