Pull-up resistor and digital input
Give a button a definite answer
A pull-up resistor connects an input weakly to the positive supply. A digital input reads high or low voltage. Pressing the button connects the input to ground, the circuit’s 0 V reference.
EXPERIMENT BENCH
Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.
Sign in to save progress. Guest progress stays on this device.
Why it works
Ideal input takes no current; ideal switch has zero resistance. Leakage, contact bounce and undefined logic thresholds are omitted.
Released: the input equals the supply and resistor current is zero. Pressed: the input is 0 V and I = V/R flows through the resistor and switch.
Difficulty
Build · Build it
Power on at 5 V with 10 kΩ and the button released. Read an input of 5 V.
Need a hint?
5 V; 10 kΩ → 5 V
Explore · Change one thing
Keep 5 V and 10 kΩ; press the button. Read 0 V and 0.50 mA.
Need a hint?
5 V; 10 kΩ → 0 V; 0.50 mA
Solve it · Solve the challenge
With 5 V and the button pressed, reduce current to 0.100–0.125 mA.
Need a hint?
5 V; 40 kΩ → 0.125 mA
Extra reading and circuit recipes
Give a button a definite answer
A useful pattern
A larger pull-up saves current while the button is held.
Beyond this model
Without a pull-up or pull-down, an unconnected input can float: its voltage is not reliably defined.
A useful trap to avoid
High voltage here means released, not pressed. Software can invert that meaning.
You change 10 kΩ to 20 kΩ while pressed at 5 V. Current…
- halves
- doubles
- stays unchanged
Read more
The switch still holds the input at 0 V; doubling R halves V/R.