Embedded & Electronics Toolkit
← All guides

Sizing I2C Pull-Up Resistors

"Use 4.7 kΩ" is the usual advice for I2C pull-ups, and it is right often enough to be dangerous. The correct value sits between two limits that depend on the supply voltage, the bus speed and the capacitance of the wiring. On a short 100 kHz bus the window is wide and almost anything works. At 400 kHz with a few devices and some cable, the window narrows quickly and 4.7 kΩ can fall outside it.

Why the resistor matters

I2C devices only pull the lines low. Nothing drives them high; the pull-up resistor does that by charging the capacitance of the bus. So a falling edge is fast, set by the device's output transistor, while a rising edge is an RC charging curve set by the resistor and the bus capacitance. Too large a resistor and the line rises too slowly to reach a valid high level in time. Too small and a device cannot pull the line low enough.

The lower limit: sink current

When a device holds the line low, the resistor's full current flows into its output. The I2C specification guarantees a low level of 0.4 V at a sink current of 3 mA for standard and fast mode, and at 20 mA for fast-mode plus. The smallest allowed resistor is therefore:

Rmin = (Vdd − 0.4 V) / Isink
SupplyRmin, standard and fast mode (3 mA)Rmin, fast-mode plus (20 mA)
1.8 V467 Ω70 Ω
3.3 V967 Ω145 Ω
5.0 V1.53 kΩ230 Ω

The fast-mode plus column only applies if every device on the bus is a fast-mode plus part. One ordinary 3 mA device brings the limit back to the left column.

The upper limit: rise time

The specification measures rise time between 30% and 70% of the supply voltage. For an RC charging curve, the time between those two points is:

t_rise = R × C × ln(0.7 / 0.3) = 0.8473 × R × C

The maximum rise time is 1000 ns in standard mode (100 kHz), 300 ns in fast mode (400 kHz) and 120 ns in fast-mode plus (1 MHz). Solving for the resistor:

Rmax = t_rise_max / (0.8473 × Cbus)
Bus capacitanceRmax, standard modeRmax, fast modeRmax, fast-mode plus
50 pF23.6 kΩ7.08 kΩ2.83 kΩ
100 pF11.8 kΩ3.54 kΩ1.42 kΩ
200 pF5.90 kΩ1.77 kΩ708 Ω
400 pF2.95 kΩ885 Ω354 Ω

Read this table against the common 4.7 kΩ. In standard mode it is fine up to 200 pF. In fast mode it is already too large at 100 pF, where the limit is 3.54 kΩ: the rise time comes out at 398 ns against the 300 ns allowed. And at 400 pF in fast mode the upper limit of 885 Ω is below the 967 Ω lower limit for a 3.3 V bus, so no resistor value satisfies both. That bus must be slowed down, shortened, or split with a buffer.

Estimating bus capacitance

Bus capacitance is the sum of everything connected to the line:

These are rough figures for a first estimate. A board with four devices and 15 cm of trace lands around 50 pF. Add half a metre of cable to an external sensor and the total is closer to 100 pF, which is where a 400 kHz bus stops working with 4.7 kΩ.

Choosing inside the window

Any value between Rmin and Rmax meets the specification. Within the window there is a trade:

A reasonable default is a value about half way between the limits, leaning lower if the bus leaves the board.

The hidden parallel resistors

Pull-ups on the same line are in parallel. Sensor breakout boards usually carry their own, often 4.7 kΩ or 10 kΩ. Plug three such boards into one bus and three 10 kΩ resistors become 3.33 kΩ; two 4.7 kΩ become 2.35 kΩ. This is usually harmless and sometimes helpful, but with enough modules the combined value drops below Rmin, and devices can no longer pull the line to a valid low. If a bus stops working when one more module is added, measure the resistance from SDA to Vdd with the power off before suspecting the software.

The microcontroller's internal pull-ups, typically tens of kilohms, are too weak to serve as I2C pull-ups for anything but a very short, slow bus. They are also in parallel with the external ones, where their effect is negligible.

Measuring instead of estimating

The capacitance estimate is the weakest part of the calculation, and it is easy to replace with a measurement. Put an oscilloscope probe on SCL, trigger on a rising edge, and measure the time from 30% to 70% of the supply voltage. For a 3.3 V bus those levels are 0.99 V and 2.31 V. Use a ×10 probe; a ×1 probe adds around 100 pF of its own and changes what you are measuring.

The measured rise time also gives the real bus capacitance, by turning the formula around:

Cbus = t_rise / (0.8473 × R)

A rise time of 400 ns with 4.7 kΩ pull-ups means about 100 pF. From there the tables above give the largest resistor that meets the target speed.

Symptoms of a wrong value

Run the numbers: I2C Timing & Pull-Up Resistor Calculator does this calculation for your own values.

More guides