What are pull-up and pull-down resistors?
Short answer: A pull-up resistor connects a signal to the supply so the line reads a defined high when nothing actively drives it; a pull-down connects it to ground for a defined low. Without one, an unconnected (floating) CMOS input picks up noise, reads random values and can draw extra current because the input stage sits halfway between levels. Typical values are 4.7 kΩ–100 kΩ; lower values give faster edges and better noise immunity but waste more current when the line is driven to the opposite level. Most MCUs have selectable internal pulls of roughly 30–50 kΩ.
Where they are needed
| Situation | Typical choice |
|---|---|
| Button to ground | pull-up (internal is fine), button pulls low |
| Open-drain buses (I2C, 1-Wire, interrupt lines shared by several devices) | external pull-up, sized for rise time |
| Reset lines (nRST) | pull-up so the device runs by default |
| Boot-mode/strap pins | pull-up or pull-down to select the boot mode at reset |
| Chip selects | pull-up so devices stay deselected while the MCU is in reset |
| MOSFET gates | pull-down (or pull-up for P-channel) so loads stay off while the MCU boots |
Choosing a value: balance rise time (R × C of the line: 10 kΩ with 50 pF gives τ = 0.5 µs) against current when the line is low (V/R) and the strength of the driving device; weak pulls (100 kΩ+) are sensitive to leakage and noise.
Firmware note: internal pull-ups are configured in the GPIO registers and take effect only after the code runs; anything that must be defined during reset (enables, gates, boot pins) needs external resistors.