Decoupling caps + resistors for I2C over twisted pair - Page 1
Forum section: electronics / projects

author: Starlord
author_rank: Frequent Contributor
timestamp: February 08, 2015, 10:17:14 am
content: Hey guys,I need to communicate with some I2C LED drivers at the end of 7' and 3' (chained, so 10' in total for furthest driver) of Cat5e cable, and I was reading the spec:http://www.nxp.com/documents/user_manual/UM10204.pdfIt says on page 60 that if I twist the lines, and I don't want to pair each data line with a ground return, I can pair one with VCC and one with GND, but I need to put decoupling capacitors on both ends.Just wondering if it will make any difference if I use .1uF, 1uF or 10uF ceramic caps for this.I assume .1uF caps on there will be fine, but I don't know much about all the ways in which data can be corrupted when transmitting it long distances, so I thought I should check since the document does mention the capacitance of the line needs to be below a certain amount and I don't know how to calculate that or if this counts towards that. I don't think it does though, and I'm pretty sure I'm worrying about nothing at this distance.I'll either be communicating at 100KHz or 400KHz. My microcontroller can't do higher speeds.Oh, and do you think I should go with 4K7 pullups here, or something lower?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 08, 2015, 03:51:42 pm
content: In and of itself, the cable with bypass should be well damped. What else it connects to (at each end) matters, and can screw with this; but...The "pairs" impedance is around 100 ohms. The impedance between single wires in different pairs will be higher, maybe 150 ohms. The inductivity of free space is 1.257 uH/m at the impedance of free space (377 ohms); so the inductivity of the odd pairs should be around 0.5 uH/m. The propagation velocity of this mode is probably in the 0.8c range, due to capacitive loading, which is factored into the impedance; therefore the inductance should be higher by this, or 0.625 uH/m. So, a 10m run is about 6uH.I think that's right?So whatever bypass you use, you should want to make sure it's well damped; 0.1uF paired at either end against 6uH is an impedance of 11 ohms (the capacitors act in series; Z = sqrt(L/C)). You could put 11 ohms in series with one, but that would allow ripple; if you put 11 ohms in series with a larger capacitor (>3x the value) and connect that across the first, you can mostly dampen it. You can do this at one or both ends. The effect is to have impedance rise slightly at some crossover frequency, but having it go "thud" instead of "ding", and to have a modest to low impedance at all other frequencies.In principle, you should connect a few uH from your outside circuit to the line, so the line can be somewhat isolated from the unknown circuit. In practice, this would be a silly length to go to. I don't know what your supply looks like, but some general advice: do avoid large, low ESR caps (polymer and ceramic), going instead for tantalum (stable, controlled ESR), or ceramic with a resistor, for the bulk capacitors.As for your signals -- I2C, note that the capacitance (8.84 pF/m * 10m * 377/100 / 0.8 = ~417pF, but that's per pair, not one wire against all others, which is probably slightly more) limits how much clock speed you can run at, and, if you ever have to pass EMC, expect it to be hopelessly messy in the 0.15-10MHz range (even with ferrite beads or other filtering on the driving pins; for which I would suggest 300 ohm 0805 FBs and/or 220 ohm series resistors -- place the pull-ups before the series resistors, if you can). Let alone susceptibility, which is probably trashed for any kind of stimulus. If you must do it this way, use four conductor shielded (at least foil screened, but foil and braid is even better), and ground the shield at the enclosure (if you have a metal enclosure), or lead it down to a shielded connector on the board, with the shield connected directly to the board ground plane (it has a ground plane, right?).If anyone else is still reading... FYI, the same precautions are necessary for USB. That's why it's fully shielded in even the cheapest cables (though the way they terminate that shield might suck), and still limited on length.Tim

author: Paul Price
author_rank: Super Contributor
timestamp: February 08, 2015, 03:52:42 pm
content: Use 1K instead of 4.7K pullups, 1uF bypass caps, and use twisted pairs with power and ground pairs, should work fine. The pullups should only be required to be used on the most distant device in the chain of 10'The internal timing inherent in the I2C data sampling relative to clock should give any transients time to die out. Try first at lowest practical I2C clocks.Try the simplest approach first, but If you notice problems, try using 100-ohm series resistors at the I2C master clock and data output pins feeding the twisted pairs.

author: Starlord
author_rank: Frequent Contributor
timestamp: February 08, 2015, 05:55:15 pm
content: Quote from: Paul Price on February 08, 2015, 03:52:42 pmWill it make a difference if I have 1K pullups on each device? I'd like to keep them consistent if possible and I may have more than two, but probably never more than four in series.QuoteThis all sounds a lot like the general advice I've read elsewhere. I guess I can put some cuttable jumpers there in case I need to add resistors.

author: Starlord
author_rank: Frequent Contributor
timestamp: February 08, 2015, 06:10:30 pm
content: Quote from: T3sl4co1l on February 08, 2015, 03:51:42 pmSo if I understand you right, what you're suggesting here is that I wire a 0.1uF cap across VCC and GND at each end, AND in parallel with that, I wire, say, a 1uF cap (>3x 0.1uF) in series with an 11 ohm resistor.And this is to avoid ringing?I'd prefer to avoid tantalum caps. Expensive, flammable. When you say supply, you are referring to my 5V power supply, and not the data lines correct? I didn't ask about the supply, and you were just talking about bypass caps, so I just want to make sure we're on the same page.For the supply, I was going to have a 100uF electrolytic near where the cable leaves the board, and on each module I'd have one of those and a 10uF and 0.1uF ceramics. But the 100uF on the board is a general bulk cap for several sources. And the LEDs would be supplied by the 100uF on the boards, so I'm not sure sticking a resistor in series with that would be a good idea?QuoteI was going to just have the pull ups on the modules. Though the Atmega I believe has internal pullups which I could selectively enable. I'd like to keep the port configurable so if I need it for general IO I could use it for that, so the less stuff between the port and the microcontroller the better.

author: Paul Price
author_rank: Super Contributor
timestamp: February 08, 2015, 06:42:45 pm
content: Don't use pull-up resistors on each device or you will overload the drive capability of the I2C outputs and cause excessive voltage drop(meaning it just will won't function) if you have 100-ohm series damping resistors. Each of the module's pullup resistors are in parallel with all others on other I2C modules, and this means overload. Don't put any resistors in series with the bypass caps(1uf I have suggested, but just connect them from +V to gnd wires on each module.)

author: Starlord
author_rank: Frequent Contributor
timestamp: February 08, 2015, 07:41:11 pm
content: What if I can't guarantee the order of the modules and I'd prefer not to have a solder jumper for enabling the pull ups?As I said before I'd like to keep the modules consistent and I may have up to 4 modules. If I put 4.7K on each module that's equivalent to a bit more than 1K, and if I went to five modules that's 940 ohms, which I assume is also close enough to 1K to be fine.How good do you think my chances are for this working with just 4.7K on each module and the 1uF bypass cap?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 09, 2015, 02:41:40 am
content: 100uF electrolytic will have around 10 ohms ESR, but it won't be stable, so the supply may permit more bumps and dips at low temperatures, or on that unlucky build that was weak caps, or after 20 years and the caps go dry.Tantalum are perfectly reliable when used right; the problem is most don't, just throwing them at beefy supplies with insufficient derating.Tim

author: GK
author_rank: Super Contributor
timestamp: February 09, 2015, 05:34:43 am
content: Quote from: T3sl4co1l on February 09, 2015, 02:41:40 amWhat?An example from 1950 maybe. I just measured a run of the mill 100uF/63V Jamicon that has been sitting in the junk box for ~10 years - 0.18 ohms.

author: GK
author_rank: Super Contributor
timestamp: February 09, 2015, 05:41:35 am
content: Or perhaps you meant 1uF. Closest I have at hand is a 0.47F/50V Elna, of similar vintage (at least 10 years) - it measures 2.1 ohms.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 09, 2015, 06:56:42 am
content: Maybe I meant more like 10uF... those things are pretty weak. To be honest I haven't seen much data on 100uF class parts; they rarely give more than ripple current spec. Which is probably as good as sign as any; if the manufacturers won't say what ESR to expect, what should you?Well... let's measure some then.Offhand, I have (aluminum electrolytic unless otherwise noted, at 230kHz):25V 220uF EPCOS (a few years old), 0.205 ohm10uF 35V Panasonic (new), 1.06 ohm10uF 25V Nichicon axial (old), 1.42 ohms10uF 25V Kemet, dipped tantalum, 0.335 ohm1uF 50V Chemi-con (4mm can), 5.3 ohmsand just to be really unfair,1uF 450V Capxon, 17.9 ohms.Good call, I should measure things more often!So, since bulk caps tend to be fairly low ESR, you may want a larger "fast" bypass, so the impedance is on par with the ESR. Continuing from the earlier example, 6uH and 0.3 ohms gives C = L/Z^2 = 66uF. Which is pretty big, and a low enough impedance with or without ESR, so, hey, who cares about stacking bypass, the 100uF should be pretty close as-is.Oh also, if there's hot plugging involved, that would be a good recommendation against tantalum by the way -- but besides surge current, it will also produce overshoot, even if the supply is modestly damped like this. A TVS like a P6KExxA or SMAJxxA, rated for nominal supply voltage, would be fine. So, an xx = 5.0 device for 5V rails, etc. (Note that this doesn't really do much for rails below 5V, because avalanche diodes under 6V... aren't. You can get 3.3V TVSs but they're very soft and don't clamp to a voltage much lower than the 5V parts. Not to say they aren't still beneficial on a 3.3V supply -- just that the relative advantage isn't as great. I don't think I've ever seen TVS diodes under 3.3V, as they'd really be useless.)Tim

author: Starlord
author_rank: Frequent Contributor
timestamp: February 09, 2015, 09:58:54 am
content: So if I understand you correctly, you're saying a lone 100uF at each end of the cable across the supply should be fine? Ie, one 100uF on my main board, and one on each module which is also acting as a bulk supply for my LEDs?Of course I will still have 10uF and 100nF caps by my chips.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 09, 2015, 05:15:29 pm
content: Correct.

author: nuno
author_rank: Frequent Contributor
timestamp: February 09, 2015, 11:18:51 pm
content: I have this project, a Raspberry Pi controlling 2 power (250W each) H-Bridges over I2C. The bus is splited in 2 at the Pi, and then goes about 50cm (~19 inches) each side to each controller. It runs at 550 kbps.At the end of each bus, on the controller, there's an I2C galvanic isolator chip (from AD), which needs to be powered on both sides; therefore, the "bus" consists of the I2C signals plus Vcc (3V3) for the isolator chip. I put a 10uF ceramic at the controller's board bus Vcc/GND entry after a schottky diode in series with Vcc, plus 100nF ceramic decoupling at the isolator's power pins. The diode together with the10uF cap will work to keep the power voltage stable on the controller part of the bus.I used 3 pairs of a CAT5 ethernet cable: Vcc/GND, SDA/GND and SCL/GND. All GND wires are connected on both sides of the system (at the Pi and at the controllers), inductance will only be minimized if any current does run through the GND wires. I used an independant pair for each I2C bus to, I thought, reduce crosstalk (trying to keep them as away as possible); maybe I'm wrong here as I read above, will have to study this in more detail.No pull-ups at the controller, the entire system has only the pull-ups that are on the RaspPi (I don't know their value).Anyways, the signal looks good on the scope, no transmission errors detected so far with frequent use (messages flow between master and slaves 10+ times per second).

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2015, 01:34:08 am
content: What are the H-bridges doing? They'd better be quiet, or well grounded...Tim

author: nuno
author_rank: Frequent Contributor
timestamp: February 10, 2015, 02:01:05 am
content: They're driving upto 20A into DC motors. Power is star at the battery and the I2C communications are galvanicaly isolated.