View Full Version : I2C Cable Length issue?
Our team is using a HiTechnic color sensor made for the Lego NXT. We are able to use it with a standard NXT cable plugged into the jack on the digital sidecar.
We wanted to put the sensor somewhat farther away from the sidecar than our NXT cables could reach, so we cut an NXT cable in half and soldered PWM-gauge wires across corresponding colors. However, when we plugged it in and rebooted the robot, the cRIO reported that the sensor did not respond when it was asked for its name and manufacturer.
We are fairly certain that our solders are good and that the right cables are soldered together - we used a multimeter to check continuity, etc. Since the wiring is essentially identical to the original cable, the only thing we can think of being a problem is the high cable length interfering with the signal. Has anyone else had any problems with trying to extend NXT cables?
Also, when we tried our soldered NXT cable with an ultrasonic sensor on a real NXT, things seemed to work fine (i.e. the sensor was usable). We haven't tried a color sensor on the real NXT yet; we will when we get back to the lab on Monday.
Thanks for any advice, information or experiences anyone can share. :)
Danny Diaz
29-03-2010, 04:05
We wanted to put the sensor somewhat farther away from the sidecar than our NXT cables could reach, so we cut an NXT cable in half and soldered PWM-gauge wires across corresponding colors. However, when we plugged it in and rebooted the robot, the cRIO reported that the sensor did not respond when it was asked for its name and manufacturer.
We are fairly certain that our solders are good and that the right cables are soldered together - we used a multimeter to check continuity, etc. Since the wiring is essentially identical to the original cable, the only thing we can think of being a problem is the high cable length interfering with the signal. Has anyone else had any problems with trying to extend NXT cables?
I'm using a different I2C sensor (a compass with tilt compensation) and I am getting the same problem - though I have not yet tried to plug into an NXT since I actually need the 5v from the digital sidecar (and not 4.3v from NXT). I am using the longest NXT cable, with an end cut off and I attached about 3-4 inches of additional PWM cable to break out the power vs the I2C data/clock lines. I am also running into a problem with the cRIO where the device seems to "not respond" when asking for its address and other information. Not sure if it's the exact same problem, but it seems similar. I'm going to look into this further, and let you know what I find - I'd hope it isn't the cable length, I2C is supposed to be able to handle 10 meters of cabling (which I'm nowhere near even 1 meter).
-Danny
Matt Krass
17-01-2011, 12:52
Be aware that i2c has a limitation on maximum bus capacitance of 400pF (Source: http://en.wikipedia.org/wiki/I2c#Design) and that you may have inadvertently exceeded that with your wire splicing connections. If you don't have access to the an LCR Bridge to read the capacitance, you can get creative with some resistors and an oscilloscope to see what your cables capacitance is.
The capacitance becomes a problem because i2c relies on pull-up resistors to stabilize the bus when it's idle. Whenever a device outputs a logical 1 (or the start of a clock pulse) the line is disconnected and because of the pull-up resistor, goes to 5V (in this case, other busses may have different IO voltages). However any capacitance in the line slows that process down as it needs to build a charge, too much capacitance, the line doesn't reach a 1 state by the time something expects it to, and communications break down.
Wires running parallel to each other have some capacitance, which increases as distance increases, this is what typically causes cable length problems for i2c. I'm not sure off the top of my head because I typically use very short busses, or something more robust for my projects, but twisted pair wiring (such as that in Ethernet cabling) may be suitable for this.
I hope my explanation made sense, if not, feel free to reply to me or PM me for more information.
EricVanWyk
17-01-2011, 13:03
I'm putting my vote behind Matt's suggestion. However, just be sure to check that there aren't any shorts between the wires first.
If you have an oscope available, take a look at the wave forms. If they look a bit too curvy (as opposed to square), your RC time constant is too long. You can fix this by reducing C (shortening the cables), or reducing R.
To reduce R (increase pull up strength), the header just behind the NXT connector is a convenient place to do it. Try putting a 2k or 3k resistor in parallel to start. Check the schematic for details.
Matt Krass
17-01-2011, 20:25
I'm putting my vote behind Matt's suggestion. However, just be sure to check that there aren't any shorts between the wires first.
If you have an oscope available, take a look at the wave forms. If they look a bit too curvy (as opposed to square), your RC time constant is too long. You can fix this by reducing C (shortening the cables), or reducing R.
To reduce R (increase pull up strength), the header just behind the NXT connector is a convenient place to do it. Try putting a 2k or 3k resistor in parallel to start. Check the schematic for details.
I hadn't thought of that, clever trick.
For those not sure what Eric is referring to, putting resistors in parallel lowers the resistance of the circuit, unlike putting them in series, which adds up all the resistances.
If you have two resistors in parallel, you can calculate their resistance as:
Rp = (R1 * R2) / (R1 + R2)
This means with the 10k (I believe) pull up in the sidecar, putting a 2k in parallel with it (by connecting the resistor to the +5V and the signal line on the sidecar) you'd get:
Rp = (10k * 2k) / (10k + 2k) = (20k / 12k) = 1.67k approximately
This would give you considerably more driving power and may be enough to overcome the bus capacitance.
Be warned though, I'm not sure on the legality of this, and I'd make sure to look up the technical specs on the digital sidecar to ensure your new resistors don't exceed any maximums on the output. (I'm still catching up on the new control system, I was an IFI guy back in the day...)
EDIT:
According to section 3.4.3 Specifications in this document: http://www.usfirst.org/uploadedFiles/Community/FRC/Game_and_Season__Info/2010_Assets/3-2010FRCControlSystemComponent%20DatasheetsRev1_enc .pdf
the sidecar is capable of supply 3A continuous current nominally with a 5V supply. I would try not using all of that current on one GPIO ;) it should be more than enough to drive any reasonable resistors you pick for your i2c bus. However I'd still be wary of the rules on this, I'm not sure how it falls
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.