I2C calculations - very readable article about pullup resistor size, bus loading etc.

womai

Senior Member
Questions about I2C communications have come up frequently in the past - often regarding the choice of pullup resistors (2.2k? 4.7k?), maximum data rate for a certain bus length etc, so I thought this article should be helpful to many of you:

http://www.edn.com/article/521530-Design_calculations_for_robust_I2C_communications.php?cid=Newsletter+-+EDN+on+Embedded+Processing

It's really easy to read, gives the background info and derives the necessary equations (no fear - very basic math!) so everybody can optimize his design.

Enjoy!

Wolfgang
 
Last edited:

eggie

Member
Nice article - will study this as my work with I2C has been more luck than judgement ! Not so sure about the phrase "very basic math" though :)
 

John West

Senior Member
He's right about the math, eggie. It's just "plug and chug" stuff. Put in the values you have, then do the arithmetic (with a calculator,) to determine the result. Even I can handle it, and I have to take off my socks to count past 10. :)
 

hal8000

Member
Its a good article but a comment about total bus capacitance:

Total Bus Capacitance (CBUS)
On the SCL and SDA lines, the capacitance includes all pins, connections, PCB traces and wire. Combined, this is referred to as the bus capacitance and, for long traces and cabling, this can be significant. The open-collector topology requires the external resistor to pull the line high when released.


The article not define "long" traces and cabling.
In practical terms if two devices on an I2C network are in different rooms or separated by more than a few metres, then the capacitance of the cable will be the dominant factor in bus speed.

Even at low speeds of 800Hz CAT5 twisted pair cable has 52pF/m which is possible more than all the connections and PCB traces
combined.
http://en.wikipedia.org/wiki/Category_5_cable

Possibly if the devices were in the same enclosure, cable capacitance would be less of a problem.
Thanks for sharing the article.
 

womai

Senior Member
hal8000, your comments about cable capacitance are completely correct - and what I like about the article is that it spells out clearly what the limiting factors are; the only thing that is missing for a particular design is to fill in the numbers. Actually I would rate the "long cable" case as maybe the simplest case, because the capacitance per meter of a twisted pair or coaxial cable is pretty well defined and does not vary much for a given design, while the input capacitance of all the devices can have much more variation - possibly even from one batch to the next. So there is only one dominant factor and it is the one that is known best.

Input capacitance can still be an issue if the number of devices on the bus is large.

Apart from that, at very long distances I2C may not be the best choice anyway. Not just because it gets limited by the cable capacitance, but also because it uses single ended signaling which is sensitive to interference and ground offsets. RS-485 or similar is vastly superior in these regards.
 
Top