Tuesday, March 27, 2007 10:49 AM
BCross
When they say "Keep the cable short," they mean that
I am working on some new WiMo creations for MEDC this year. Lots of fun stuff, and so far (knock on wood) everything seems to be playing nicely for the most part. I'm playing with wheel encoders, a digital compass, and some more servos. I may even throw in an ultrasonic sensor. Yeah, I think my next code release of WiMo will be a fun one.
So, tonight was my first time playing with I2C. Not only was I learning a new protocol/concept, I was also trying to interface with a compass I just bought. Of course, it didn't work on the first try, and I went through quite a bit of time trying to figure out what it could be. Did I hook it up to the wrong port on the OOPic? Did I connect the correct pins on the compass and the OOPic? Is there a bug in my test program? Do I have a bad compass? Did the Earth lose its magnetism? aCk!
Tip #1: There are 2 ports on the OOPic-R that look the same. In fact, they are both I2C, except that one of them (labeld I2C) is ONLY for networking to other OOPics (which is pretty cool that you can do that) and the other (labelled prg) is for hooking up external components.
Tip #2: When they say not to make the wires longer than 6" when connecting I2C devices, they really mean that. This was my problem. Whenever I make my own cables, I tend to make them on the shorter side. This time i decided that i would make them longer because i didn't know where i'd end up putting the compass and i also was tired of always having my wires be too short. Well, 11" wires are just way to long I found out. After much searching for my problem, i found that that the consensus is about 6" (at least for the OOPic). I cut mine down to 4" and all of a sudden, WiMo knew which way north was (after some calibration).
I love building character :)
Anyone else have any gotchyas they'd like to share?
-- Brian