Circuit fundamentals
Pull-up and pull-down resistors
Also called: pull-up · pull-down · floating input · INPUT_PULLUP
Definition
A pull-up resistor connects an input pin to the supply so it reads high when nothing else drives it; a pull-down connects it to ground so it reads low.
Picture it
An unconnected input floats and picks up noise, reading random ones and zeros. A pull-up gives it a gentle default. When a button connects the pin to ground, the button wins easily because the resistor only lets a small current flow.
The maths
Current when pressed: I = V_supply / R_pull
| Quantity | Unit | Symbol |
|---|---|---|
| resistance | ohm | Ω |
| current | ampere | A |
| voltage | volt | V |
Worked example
A 10 kΩ pull-up to 3.3 V holds a button input high. How much current flows while the button is pressed?
- I = 3.3 / 10000 = 0.00033 A
- = 0.33 mA
Answer0.33 mA: tiny, so it wastes little power.
✓ The number in this answer is recomputed from scratch by an automated test.
Common misconceptions
- Misconception: A floating pin does not reliably read zero.
- Misconception: With a pull-up, pressed means low; the logic is inverted compared with what people expect.