</>EmbeddedInterview

Why does I2C need pull-up resistors, and how do you size them?

MediumCommunication Protocols

Short answer: Both I2C lines are open-drain: devices can only pull them low, so resistors pull them high when nobody drives them. A smaller resistor gives faster rising edges but more current when the line is low; a larger resistor saves current but makes edges too slow for the speed mode. Size it between Rmin = (VDD − VOL(max)) / IOL and Rmax ≈ t_r / (0.8473 × Cbus).

Formulas (from the I2C specification)

  • Rp(min) = (VDD − 0.4 V) / 3 mA for standard/fast mode (devices must sink 3 mA at 0.4 V).
  • Rp(max) = t_r / (0.8473 × C_b), where t_r is the maximum rise time (1000 ns at 100 kHz, 300 ns at 400 kHz, 120 ns at 1 MHz Fast-mode Plus) and C_b the total bus capacitance (≤ 400 pF).

Worked example (3.3 V, 400 kHz, 100 pF bus)

  • Rp(min) = (3.3 − 0.4) / 0.003 ≈ 967 Ω
  • Rp(max) = 300 ns / (0.8473 × 100 pF) ≈ 3.5 kΩ
  • Choose 2.2 kΩ (common for 400 kHz). At 100 kHz with the same bus, Rp(max) ≈ 11.8 kΩ, so 4.7 kΩ or 10 kΩ work.

Practical notes

  • Each device's input adds capacitance (≈ 5–10 pF), plus traces and connectors; long cables need lower resistor values, bus buffers (PCA9515) or differential extenders.
  • Only one set of pull-ups per bus segment; many breakout boards each add their own, and too many in parallel make the value too small.
  • Internal MCU pull-ups (20–50 kΩ) are too weak for anything but very slow, short buses.
  • Mixed voltages (3.3 V and 5 V devices) need a level shifter (e.g. a MOSFET-based bidirectional shifter).
  • The 0.8473 factor comes from the time to rise from 30% to 70% of VDD in an RC circuit: t = RC × ln(0.7/0.3).