I2C Pull-up Resistor Calculation: What Value to Use?

Circuit Design and Application Notes Advanced 11 min read Published:
I2C pull-up resistor calculation cover image: two pull-up resistors connected to the VCC rail, SDA and SCL lines and an RC rise curve

An I2C pull-up resistor is chosen between two limits. The lower limit is set by how much current the devices on the bus can sink: Rp(min) = (VCC − VOL(max)) / IOL. The upper limit is set by the total bus capacitance (Cb) and the longest allowed rise time (tr): Rp(max) = tr / (0.8473 × Cb). On a 5 V bus of 100 pF that carries a PCF8574T, a 24LC256 and an INA219, the usable range is 1.53 kΩ to 3.54 kΩ, and 2.2 kΩ is a good choice. The 4.7 kΩ that many people fit out of habit exceeds the rise-time limit given in the 24LC256 datasheet on this bus.

This article shows where the two formulas come from, which values to read from each device’s datasheet, and two worked examples step by step (5 V / 100 kHz and 3.3 V / 400 kHz). The method is based on the equations in Texas Instruments application note SLVA689; every device value comes from that device’s own datasheet.

Why does an I2C bus need pull-up resistors?

I2C is a two-wire interface (SDA for data, SCL for clock), and the outputs that pull the lines low are open-drain. An open-drain output can only pull the line to ground; there is no transistor that drives it high. In the three devices covered here, SCL is an input only, while SDA also works as an open-drain output; SCL is pulled low by the controller (usually the microcontroller). When no device pulls the line low, the external pull-up resistor brings it up to VCC. This is what lets several devices share the bus without conflict: if one pulls the line low, it is low; if none does, it stays high.

The price is a slow rising edge. When the line goes from low to high, the pull-up resistor charges the bus capacitance, and the voltage rises along an RC curve. A larger resistor makes the edge slower; a smaller one makes it faster but increases the current the device must sink while holding the line low. The right value lies between these two effects.

I2C bus connection diagram: microcontroller, PCF8574T (SCL 14, SDA 15), 24LC256 (SDA 5, SCL 6) and INA219 (SDA 3, SCL 4) connected to shared SDA and SCL lines, two pull-up resistors to VCC, bus capacitance Cb shown with a dashed line
Example I2C bus: three devices share the same SDA and SCL lines, with only one pull-up resistor per line. Cb is the sum of pin capacitances, wiring and PCB traces. Pin numbers refer to the SO16 package for the PCF8574T and the SOIC-8 package for the 24LC256 and INA219.

Lower limit: the Rp(min) formula

When a device pulls the line low, its output transistor sinks all the current flowing through the pull-up resistor to ground. Datasheets give a guarantee for this transistor: “I can sink at least IOL while the output voltage is at most VOL.” If the resistor is too small, the line cannot get below 0.4 V. Although the low-level input threshold (VIL) of these three devices is 0.3 × VCC, going outside the VOL guarantee erodes the low-level noise margin and takes the bus out of the region the datasheet guarantees. The lower limit is therefore:

Rp(min) = (VCC − VOL(max)) / IOL

According to the I2C parameter table in SLVA689, in Standard-mode and Fast-mode VOL must be at most 0.4 V while sinking 3 mA (for VCC > 2 V). So at 5 V Rp(min) = (5 − 0.4) / 3 mA ≈ 1.53 kΩ, and at 3.3 V it is (3.3 − 0.4) / 3 mA ≈ 967 Ω. However, you should base the calculation not on the standard but on the datasheet value of the weakest output that pulls the line low. One of those outputs is the microcontroller itself: it also pulls SDA low and, since SCL is input-only on the devices in this article, SCL too, so check its IOL and VOL in its own datasheet. In the examples below we assume the microcontroller can sink at least 3 mA at 0.4 V.

Upper limit: Rp(max) and the 0.8473 factor

As the pull-up resistor charges the bus capacitance Cb, the voltage follows V(t) = VCC × (1 − e−t/RC). In I2C, the rise time tr is defined as the time the line takes to go from 0.3 × VCC to 0.7 × VCC. The line reaches these two levels at RC × ln(1/0.7) and RC × ln(1/0.3) respectively; the difference is RC × ln(7/3) = 0.8473 × RC:

tr = 0.8473 × Rp × Cb  →  Rp(max) = tr(max) / (0.8473 × Cb)

For tr(max), the I2C standard sets 1000 ns in Standard-mode, 300 ns in Fast-mode and 120 ns in Fast-mode Plus. Here too, what counts is the device on the bus with the tightest tr limit. As we will see below, that limit does not always line up with the clock frequency.

RC rise curves: with 100 pF bus capacitance, rise time is 186 nanoseconds with 2.2 kilo-ohm and 398 nanoseconds with 4.7 kilo-ohm; 0.3 VCC and 0.7 VCC thresholds marked, with a note on the 300 nanosecond limit of the 24LC256
Rising edge on a 100 pF bus with two different pull-up resistors. tr is the time between 0.3 VCC and 0.7 VCC: 186 ns with 2.2 kΩ, 398 ns with 4.7 kΩ. The second value is too long for a device with a 300 ns limit.

Datasheet values that go into the calculation

The three devices in the examples do different jobs but can share one bus: the PCF8574T is an 8-bit I/O expander, the 24LC256-I/SN is a 256 kbit EEPROM, and the INA219AIDR is a current and power monitor. The pull-up calculation needs five values from each:

Parameter PCF8574T (SO16) 24LC256-I/SN (SOIC-8) INA219AIDR (SOIC-8)
Supply range 2.5 – 6 V 2.5 – 5.5 V 3 – 5.5 V
Maximum clock frequency (fSCL) 100 kHz 400 kHz (VCC ≥ 2.5 V) 400 kHz (fast mode), 2.56 MHz (high-speed mode)
SDA/SCL input capacitance 7 pF max 10 pF max 3 pF typical (no maximum given)
VOL guarantee at least 3 mA at VOL = 0.4 V 0.40 V at 3.0 mA (VCC = 4.5 V), 2.1 mA (VCC = 2.5 V) 0.4 V max while sinking 3 mA
Allowed tr 1 µs max 300 ns max (2.5 V ≤ VCC ≤ 5.5 V) for SCL: 300 ns (fast mode), 1000 ns (SCL ≤ 100 kHz)
SDA / SCL pin 15 / 14 5 / 6 3 / 4

Two important conclusions follow from the table. First, the PCF8574T datasheet gives a maximum SCL frequency of 100 kHz; if this device is on the bus, the whole bus must run in Standard-mode. Second, the AC characteristics table of the 24LC256 gives a maximum rise time of 300 ns for 2.5–5.5 V and puts no clock-frequency condition on that row. The SDA pin description of the same datasheet also suggests “typical 10 kΩ for 100 kHz, 2 kΩ for 400 kHz and 1 MHz”; however, meeting 300 ns with 10 kΩ requires Cb to stay below about 35 pF, and the 24LC256’s own pin alone can reach 10 pF. These two pieces of information do not fully agree; if you want to stay within the operating region the datasheet guarantees, taking 300 ns as the limit at 100 kHz as well is the safest approach. In addition, the 24LC256 capacitance value is determined by periodic sampling, and its tr limit is not tested on every part; the INA219 timing table is based on a sample analysis. Leaving margin in the calculation is therefore a good habit.

24LC256-I/SNMicrochip Technology · EE00521-1$1.0220 In StockView

How do you estimate the bus capacitance Cb?

Cb is the total capacitance of one line (SDA or SCL): the pin capacitance of every device on the bus, PCB traces, connectors and cables. You can add up the pin capacitances from the datasheets; the rest depends on the board layout and cable length. If you cannot measure it, start with a generous estimate and confirm it with an oscilloscope once the circuit works (measurement steps are below). The Cb values used in the examples are assumptions; your own board will differ.

The pin capacitances of the three devices add up to 7 + 10 + 3 = 20 pF (the first two are the datasheet maximums, the INA219 value is typical). Assuming 10 pF for the microcontroller’s SDA/SCL pin and 70 pF for the board and wiring gives Cb ≈ 100 pF. If there are a few tens of centimeters of cable between boards, raise this estimate.

Example 1: 5 V, 100 kHz, three devices on one bus

The bus carries a PCF8574T, a 24LC256 and an INA219; the supply is 5 V, and we assume Cb = 100 pF.

  1. Clock frequency: since the PCF8574T is limited to 100 kHz, the bus runs at 100 kHz.
  2. tr limit: the PCF8574T allows 1 µs, the INA219 1000 ns at 100 kHz, and the 24LC256 datasheet gives 300 ns. To stay within the datasheet guarantee we take the tightest one, 300 ns.
  3. Rp(max): 300 ns / (0.8473 × 100 pF) ≈ 3.54 kΩ.
  4. Rp(min): the PCF8574T can sink at least 3 mA at 0.4 V; the 24LC256 gives this value at a 4.5 V supply, and the INA219 at 3.3 V and 25 °C. Assuming 3 mA for the microcontroller as well: (5 − 0.4) / 3 mA ≈ 1.53 kΩ.
  5. Choice: 2.2 kΩ as a standard value in the 1.53 – 3.54 kΩ range. The rise time becomes 0.8473 × 2.2 kΩ × 100 pF ≈ 186 ns. While the line is low, the current per resistor is at most 5 V / 2.2 kΩ ≈ 2.3 mA, which stays below the 3 mA limit.

Margin check: with 2.2 kΩ, the 300 ns limit is reached at Cb = 300 ns / (0.8473 × 2.2 kΩ) ≈ 161 pF. Even if the real capacitance turns out 60% higher than estimated, the bus stays within the limit. Even the highest value of a 5% resistor (2.31 kΩ) only raises tr to about 196 ns.

Had 4.7 kΩ been fitted on the same bus, tr would be ≈ 398 ns. That is no problem for the PCF8574T and INA219 (with only those two, Rp(max) would be 1000 ns / (0.8473 × 100 pF) ≈ 11.8 kΩ), but it exceeds the 300 ns limit of the 24LC256. Such a bus often works on the bench; the failure shows up when the cable gets longer, the temperature changes or a new module is added.

Pull-up resistor selection window chart: bus capacitance from 0 to 400 picofarads on the horizontal axis, resistance on the vertical axis; Rp(max) curves for 300 and 1000 nanoseconds, Rp(min) lines for 5 volts and 3.3 volts, and two example points
Selection window: the usable resistor must sit above the Rp(min) line and below the relevant tr curve. The window narrows as Cb grows; at 3.3 V, with the conservative 2.1 mA assumption, it closes at about 256 pF.

Example 2: 3.3 V, 400 kHz, sensor board on a long cable

This time the bus carries only the 24LC256 and the INA219 (the PCF8574T cannot run at 400 kHz), the supply is 3.3 V, and because the INA219 sits on a separate board we assume Cb = 200 pF.

  1. tr limit: both devices allow 300 ns in fast mode.
  2. Rp(max): 300 ns / (0.8473 × 200 pF) ≈ 1.77 kΩ.
  3. Rp(min): the INA219 can sink 3 mA at 0.4 V. The 24LC256 datasheet gives the 3 mA guarantee at a 4.5 V supply and the 2.1 mA guarantee at 2.5 V; there is no separate value for 3.3 V. The conservative approach is to use 2.1 mA: (3.3 − 0.4) / 2.1 mA ≈ 1.38 kΩ.
  4. Choice: 1.5 kΩ in the 1.38 – 1.77 kΩ range. tr ≈ 0.8473 × 1.5 kΩ × 200 pF ≈ 254 ns. At the ends of a 5% tolerance, the resistor stays between 1.43 and 1.58 kΩ, and both limits hold.

Note how narrow the window has become: if the cable gets a little longer and Cb passes about 256 pF, Rp(max) drops below Rp(min) and no resistor value meets both conditions. At that point, lowering the clock frequency does not change the 300 ns limit given in the 24LC256 datasheet either. You need to shorten the cable, split the bus or use an I2C bus buffer.

The trade-off between speed and power

Any value inside the window works; which one you pick depends on your priority. A smaller resistor speeds up the edges and gives a high level that is more robust against noise. A larger resistor reduces the current drawn while the line is low. At 5 V, 2.2 kΩ draws about 2.3 mA while the line is low and 10 kΩ draws 0.5 mA; in a battery-powered device that communicates rarely, this difference can matter. While the bus is idle (both lines high), no current flows through the pull-up resistors.

Common mistakes

  • Fitting the same value on every bus. 4.7 kΩ or 10 kΩ works on many short, low-capacitance buses, but a value picked without calculation can silently exceed a device’s tr limit, as in Example 1.
  • Forgetting the pull-ups on module boards. Many ready-made module boards come with their own pull-up resistors. With three 4.7 kΩ modules on the same bus, the parallel equivalent is about 1.57 kΩ; a fourth module brings it down to 1.18 kΩ, below the 1.53 kΩ lower limit at 5 V. Keep only one pair of pull-ups on the bus.
  • Connecting the pull-ups to the wrong voltage. All three devices require VIH ≥ 0.7 × VCC for a high level. For a PCF8574T powered from 5 V that is 3.5 V; a pull-up to 3.3 V does not meet this threshold. The pull-up voltage must be compatible with the supply voltage of the devices on the bus.
  • Not fitting pull-ups at all. If you plan to rely on the microcontroller’s internal pull-up, read its value in that microcontroller’s datasheet and check it against the same window; in most designs, external resistors chosen by calculation are the safer path.
  • Putting a resistor on SDA only. SCL is also an open-drain line; both lines need their own pull-up resistor.

Measuring rise time and Cb with an oscilloscope

The most reliable way to check the calculation is to measure the edge. For lab work, you can follow these steps:

  1. Connect the probe in 10× mode to the SCL line; the probe’s own capacitance is added to the bus, so note it.
  2. Trigger the oscilloscope on the rising edge and place the cursors at 0.3 × VCC and 0.7 × VCC (1.5 V and 3.5 V at 5 V).
  3. The time between the two cursors is tr. Compare it with the tightest tr limit on the bus.
  4. Back-calculate the real bus capacitance: Cb = tr / (0.8473 × Rp). For example, if you measured 150 ns with 2.2 kΩ, Cb ≈ 80 pF.
  5. Recalculate Rp(max) with the Cb you found and confirm that your resistor stays inside the window.

If the edge looks stepped instead of a smooth RC curve, the cause may be pull-ups connected to different voltages, a level shifter or reflections on a long cable.

INA219AIDRTexas Instruments · ETS6597903104$2.46Lead timeView

Frequently asked questions

Should I use 4.7 kΩ or 10 kΩ for I2C?

Each is right only under certain conditions. The value is set by the bus capacitance and the tightest rise-time limit. On a 100 pF bus with a 300 ns limit, the upper limit is about 3.54 kΩ, and both values are too high. On a very short bus with a few devices and a 1000 ns limit, 10 kΩ can work.

Do I need a pull-up resistor on every module?

No. One pull-up resistor per line is enough, usually on the main board close to the microcontroller. The resistors on modules end up in parallel and can pull the total resistance below the lower limit.

Does dropping the bus to 100 kHz fix a rise-time problem?

It often does, because the tr limit in Standard-mode is 1000 ns. However, some datasheets put no frequency condition on the rise-time limit: the 24LC256 AC table gives 300 ns for 2.5–5.5 V. If such a device is on the bus and you want to stay within the datasheet guarantee, lowering the speed alone is not enough.

Where does the 0.8473 factor come from?

The voltage of an RC circuit reaches 0.3 × VCC after RC × ln(1/0.7) and 0.7 × VCC after RC × ln(1/0.3). The difference is RC × ln(7/3) = 0.8473 × RC, which is exactly the interval used by the I2C definition of tr.

Conclusion

An I2C pull-up resistor is chosen from the window between Rp(min) = (VCC − VOL) / IOL and Rp(max) = tr / (0.8473 × Cb). Both limits should be read from the datasheets of the devices on the bus, not from the standard’s table: the PCF8574T limits the bus speed to 100 kHz, while the 24LC256 datasheet gives a 300 ns rise-time limit for 2.5–5.5 V. In the 5 V, 100 pF example 2.2 kΩ met these conditions, and in the 3.3 V, 200 pF example 1.5 kΩ did. You can find the PCF8574T, 24LC256-I/SN and INA219AIDR used in the examples on their product pages, and browse similar parts in the I/O expanders, memory ICs and current management ICs categories. For another use of a pull-up resistor on an open-drain output, see our comparator hysteresis calculation article, and for another way to add outputs to a microcontroller, see our 74HC595 article.

References

Ask Claude or ChatGPT about the parts in this article and their alternatives: your assistant brings them from our catalog with stock and prices.

How do I connect?

Products in this article

More from Circuit Design and Application Notes

For AI assistants

Search our catalog with Claude or ChatGPT

You came here from an AI assistant. Connect Claude or ChatGPT to Entegreci once, and it searches our catalog for the parts you ask about and brings back products with their availability, current price and a link.

“Is the 1N5819 in stock, and what could I use instead?”

Free for members. The assistant only reads the catalog; it can't place orders or see your account details.