element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
WorkBench Wednesdays
  • Challenges & Projects
  • element14 presents
  • WorkBench Wednesdays
  • More
  • Cancel
WorkBench Wednesdays
Documents If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join WorkBench Wednesdays to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: tariq.ahmad
  • Date Created: 5 Mar 2024 5:12 PM Date Created
  • Last Updated Last Updated: 5 Mar 2024 5:25 PM
  • Views 5663 views
  • Likes 4 likes
  • Comments 7 comments
Related
Recommended

If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83

How do you pick I2C pull-up resistor values? The common response is to choose anything between 1 kOhm and 10 kOhm. But, still, how do you know the best value? The answer is related to the maximum number of devices you can have without using a repeater, switch, or multiplexer on an I2C bus. Many people would answer a number like 127 since that is how many 7-bit addresses are available. However, creating an I2C bus with more than 20 or so devices is nearly impossible. Why? Because the bus capacitance matters most–which is also the key to determining I2C pull-up resistor values! 

Watch the Video:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Downloads & Links | Bill of Material | Discussion

image

James was looking for application notes about picking I2C pull-up resistor values. One that caught his attention was from Texas Instruments. I2C Bus Pullup Resistor Calculation (SLVA689) covers calculating the maximum and minimum pull-up values. It also clearly shows the math for the rise time calculation and bus capacitance. James created an online spreadsheet with pre-configured equations to make things easier for you. 

Application notes from many other vendors and tutorials on the web have a similar example as the TI app note. It comes up with the ridiculous range of 966.667 to 1770 ohms. As James says in the video, the only sane value in that range is 1 kOhm. (Although there are a couple of other E12 and E24 values too!) But if that's the usable range, how do other I2C devices use 2.2, 4.7, or 10 kOhm kOhm work?!  

Key I2C Numbers to Know 

We need to know some key information about the I2C specification. James uses a DesignCon 2003 presentation, but these numbers are also available in the full I2C spec. The two most common speeds for I2C are 100 kbit/s and 400 kbit/s. Later in the video, James uses an OLED screen running at 400 kbits/s, so most of the video centers around the faster speed. 

 image

The maximum bus capacitance allowed on I2C for both speeds is 400 picofarads. The maximum rise time of the bus is limited to 1000 nanoseconds and 300 nanoseconds, respectively, depending on the bus speed. Last, it is essential to know that the spec uses the 30% and 70% points of the edge to determine rise time.  

 image

I2C devices need a pull-up resistor because they use an open-drain (or open-collector) architecture. This setup means a device only drives the bus to ground, effectively letting it float when it wants to represent a logic high. When the bus goes high, the pull-up resistor and the bus capacitance limit the signal's rise time. We see sloped edges on the rise and sharp edges on the fall of I2C waveforms because the two components form an RC network! 

Measuring I2C Bus Capacitance 

Estimating I2C bus capacitance has a few issues. Not all I2C devices define their input capacitance. And you need a good model for the interconnects. A far simpler method is to measure it on an actual circuit. James uses an Arduino Uno and an SSD1306-based OLED on a breadboard connected with wires as an example. 

 image

On the back of these OLEDs are 4.7 kOhm pull-up resistors on both the SDA and SCL lines. 

James assumed that SCL and SDA should look very similar, so most measurements only look at SCL. The initial rise time measurement is 534 nanoseconds! The display works, but this value is way outside of the I2C's spec of 300 nanoseconds for a 400 kHz bus. However, most oscilloscopes default to the 10-90 points of the rise time. After changing the reference levels to use 30-70, the rise time comes out to be 193 nanoseconds.  

 image

Using the 4.7 kOhm pull-up resistor value and the 193 nanosecond rise time, James shows how to calculate the effective bus capacitance using the equations in the TI app note. This math is where the spreadsheet comes in handy! It turns out the bus capacitance is 48 picofarads. 

image 

For most designs, this verification step is the endpoint. Both the rise time and bus capacitance are well below the I2C spec! We have verified this bus is in compliance and could move on. However, James points out that we did ignore one other resistor on the bus: the Arduino's internal pull-up! 

Arduino Internal Pull-Ups 

Nearly all microcontroller GPIO pins offer an internal pull-up resistor. The values of these resistors are usually in the 20 to 50 kilohm range. (They are not actual resistors on the silicon. They're the resistance of a MOSFET's drain-to-source channel. But that's a topic for a different video.)  

The Arduino's I2C library, also called "Wire" or "Two-Wire Interface (TWI), enables the internal pull-ups for the I2C pins. James did not consider the internal pull-up when he showed the rise time calculations. An interesting side-effect of a 5V Arduino Uno using its internal pull-up resistor is that it makes the bus compatible with a 3.3 volt device. 

image 

A quick simulation shows what happens when the internal pull-up connects to 5 volts, and the external pull-up connects to 3.3 volts. The effective high voltage on the I2C bus becomes about 3.4 volts! 

Regarding bus capacitance and rise time, the 50 kOhm resistor has a minimal effect since a smaller external resistor has significantly more pull. But that did leave James to wonder, what if you didn't use external pull-up resistors at all? 

How Much Pull-Up is Too Much? 

James removed the 4.7 kOhm surface mount resistors from the OLED module. After that change, the OLED no longer worked! On the oscilloscope, James showed the rise time is over 900 nanoseconds now! No wonder this 400 kbit/s device is not responding. 

image

The 50 kOhm internal pull-up is too much resistance. Next, James used an external 10 kOhm resistor to see the performance. And with 10 kOhm, the OLED worked and had rise times around 200 nanoseconds. The 50 kOhm internal pull-up is probably strong enough for 100 kbit/s devices. However, it seems far too weak for faster I2C devices. 

Going the other direction, what is the smallest value you can use? Why not just use something like 100 ohms to be safe? Remember, I2C devices have to sink the bus's current. So, the pull-up resistor value must be large enough to limit the current to a safe value, which for most I2C devices is 3 milliamps. 

image 

The 3 mA limit is where the TI app note came up with the approximate 966.6666666666667 ohm resistor!  

But What VALUE Do You Pick?! 

After going through these measurement and math exercises, you might still wonder: what value is the right one to pick? Like most engineering answers, the answer depends on your application.  

 image

Strong pull-up resistors are small values because they allow more current. Weak pull-up resistors are large values because they allow less current. So, 1 kOhm is very strong, and 10 kOhm is somewhat weak. Meanwhile, the internal pull-up at 50 kOhm is very weak. 

If your application is battery-powered, you will want to use weaker pull-ups to limit the amount of energy wasted. And if you are putting the circuit into a noisy environment, you probably want a solid value for increased noise immunity. 

Regardless of your pick, the vital thing to do is make a rise time measurement and determine if you violate the I2C spec! For example, James recommends starting at 4.7 kOhm, measuring the rising edge of SCL, and adjusting the value if your rise time is too slow. 

Downloads & Links:

  • Bald Engineer's I2C Pull-Up Calcatron
  • TI I2C Bus Pullup Resistor Calculation App Note
  • I2C Manual (AN10216)
  •  Triggering And Decoding Serial Protocols On An Oscilloscope - Workbench Wednesdays 34  

Bill of Material:

Product Name Manufacturer Quantity Buy Kit
Arduino Uno Arduino 1 Buy Now
3100 piece resistor kit with E6 values, metal film, 1% Multicomp Pro 1 Buy Now
 

 

Workbench Wednesday
element14 presents  |  About James |  Workbench Wednesdays 

  • tutorial
  • i2c
  • Pull-Up
  • Bus Capacitance
  • resistor
  • electronics
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • koudelad
    koudelad over 1 year ago +1
    This video is absolutely fantastic. True gold. Seriously. I have heard and seen so many questions about pull-ups and you are the only one on the internet who offered both theory and practical approach…
  • dougw
    dougw over 1 year ago

    Good topic, well done. We just had an internal discussion about this when we had an I2C failure. (although it turned out to be a BGA connection problem - another possible topic)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 1 year ago

    Very good overview of the I2C lines.

    Thanks James.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • cstanton
    cstanton over 1 year ago in reply to koudelad

    Noted, we should featured wednesday episodes a lot better Slight smile

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 1 year ago in reply to koudelad

    Thank you for the kind words.

    I have wanted to cover this topic for a long time, but I struggled with finding the right approach.

    When I started looking for application notes, I was shocked that they ALL mentioned "...using the bus capacitance..." but none explained how to figure it out.

    It is one of the few topics I have covered where the demo I planned worked exactly as I intended! (Usually, I realize some major mistake in my expectations and have to re-think everything.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • koudelad
    koudelad over 1 year ago

     cstanton Pretty please, feature this video on the main page. "Ever wondered how to choose I2C pull-up resistors" or something similar would be great. There are not many videos on internet like this one. A meta analysis with practical measurements, Solving real-life problems. Many professional developers and 99 % of amateurs have on idea why are they using a specific resistor value in their designs.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • koudelad
    koudelad over 1 year ago

    This video is absolutely fantastic. True gold. Seriously.

    I have heard and seen so many questions about pull-ups and you are the only one on the internet who offered both theory and practical approach - calculations and measurement (because for some reason, IC manufacturers often omit certain critical details of their devices).

    I hope this gets referenced to all the places like Arduino and Rapsberry Pi forums, hardware stack overflow, reddit and other.

    Thank you for making this available to general public. Keep up the good work.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 1 year ago

    The “resistors” in the thumbnail are pillows my mother crocheted. I sent her enlarged pictures of a 1 kOhm (or 220 ohm?). 

    She picked up on a lot of minor details without me mentioning them!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube