Back to Basics: Pullup Resistors for I2C

Pullup Resistor Calculation

Since there was a large interest from quite a few folks regarding the last post, thought of continuing that design series on how to select pull-up resistors for I2C. (Check images for the formulas)The lower limit of the resistor is defined by V_OL which is the maximum voltage that can be recognised as zero by your circuit. Eg. If 0.4V and below is taken as zero in the digital circuit, V_OL = 0.4V. The sink current is the current which can be taken by your gate. You can find this in your sensor’s/microcontrollers datasheet in the electrical specs section. These two values determine the minimum value needed for your I2C bus to function.

On the upper end, it’s decided by the rise time mentioned in the standard I2C spec and the bus capacitance. Rise time values(in ns) from the I2C spec sheet for different speed modes of I2C are as follows

– Standard-mode (Sm, 100Kbps) –> 1000ns

– Fast-mode (Fm, 400Kbps) –> 300ns

– Fast-mode Plus (Fm+, 1Mbps) –> 120ns

– High-speed mode (Hs-mode, 3.4Mbps) –> 80ns

So pick a value from the above list based on the speed of operation of your I2C system.

Bus capacitance is the effective capacitance shown by your I2C bus. This is specific to your PCB/breadboard implementation and will vary based on your design. The ideal goal is to have as small a capacitance as possible so that you can transfer data faster. Larger capacitance means that it takes more time for the signal to reach its logic high(larger rise times) and sometimes it might never get to logic high causing problems in the communication. The capacitance of your bus will always be higher if you have longer bus lengths, PCB-to-wire connections, and more devices connected on the bus.

There is no simple way that I know of to calculate bus capacitance in the design stage. The practical way is to build out your circuit by calculating the pullup resistor(above the lower limit) and sending I2C data on the bus. Now probe the SDA and SCL line with a scope and measure the rise time. Now using the RC time constant formula back-calculate the bus capacitance for your circuit. Now with this, you can modify your pullup resistance formula if needed. If capacitance/rise times are not problematic in your circuit always go with the highest value of resistance possible so as to minimize power loss. I2C is a power guzzler.

PS: Refer TI’s SLVA689 whitepaper to see derivation on how you got the formulas mentioned for pullup resistor designs

If you liked the post, Share it with your friends!

Laptop Teardown and Cleanup

Laptop Repair
Laptop Repair
Laptop Repair

I was opening up a laptop of mine which has been a constant workhorse clocking at least 12+ hours on average for almost every single day for the last 3yrs. Recently it started acting up with fans running full throttle even on light load. Well, the culprit it turned out was that most vents and fans were caked with dust and grime over the years. A quick clean-up of all that dust improved the situation to an extent(To get it back to normal, I would probably have to remove the heatsinks and apply the new thermal paste for better heat transfer).

What I want to stress today is not the solution but the act of finding the solution. You have to be naturally curious about the surroundings around you. Ask probing questions first. There is a skill in that. Asking the right questions is half the battle. Question anything and everything around you. Case and point, when my laptop was acting up, I was wondering what changed? Why are the fans on full throttle? What could be the reason? Is it something that I did recently? When you ask the right questions, it will open up new dimensions, finding solutions to those questions is a relatively easy task with the wealth of information at your fingertips. Start learning to ask the right questions. It will help you learn so much.

If you liked the post, Share it with your friends!
1 7 8 9 10 11 21