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 51Next »
Can most PC's and video cards act as an I^2*C slave?

only if software is already on the pc.

marshalcraft.3 months ago

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

marshalcraft.3 months ago

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.

geraldol16 months ago


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.
Zibri2 years 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.
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 Derin6 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 Derin6 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).
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 ( 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:
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:
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 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.
1-40 of 51Next »