![]() |
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. :) |
Re: I2C Cable Length issue?
Quote:
-Danny |
Re: I2C Cable Length issue?
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. |
Re: I2C Cable Length issue?
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. |
Re: I2C Cable Length issue?
Quote:
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: Code:
Rp = (R1 * R2) / (R1 + R2)Code:
Rp = (10k * 2k) / (10k + 2k) = (20k / 12k) = 1.67k approximatelyBe 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...Rev1_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 |
| All times are GMT -5. The time now is 08:07. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi