Why#
An input that is connected to nothing floats: it picks up noise and reads random values. A pull-up resistor (to 3V3) makes it read 1 until something pulls it low; a pull-down (to GND) makes it read 0 until something drives it high. The resistor is weak on purpose, so a button or an output can override it easily.
Where you need one#
| Signal | Resistor |
|---|---|
| Button to GND | 10 kΩ pull-up (or the chip’s internal one) |
| I²C SDA and SCL | 4.7 kΩ pull-ups to 3V3, once per bus |
| ESP32 EN / boot strapping pins | 10 kΩ pull-ups, as the datasheet says |
| MOSFET gate driven by a GPIO | 10–100 kΩ pull-down, so the load stays off during reset |
| USB-C CC (device) | 5.1 kΩ pull-downs, see USB-C |
Choosing the value#
- Too low wastes current while the line is pulled the other way (3.3 V / 1 kΩ = 3.3 mA) and may overload the driver.
- Too high makes edges slow and the line sensitive to noise. I²C at 400 kHz needs ≤ 4.7 kΩ on a typical bus; 10 kΩ is fine for buttons.
- Internal pull-ups (30–100 kΩ) are fine for buttons on short wires, too weak for I²C on cables.
Pitfalls#
- Two I²C modules each with their own pull-ups is fine; five of them in parallel (≈1 kΩ) is too strong. Remove extras.
- A pull-up to 5 V on a pin of a 3.3 V chip feeds 5 V into it.