1.Why should I care?
Floating inputs cause some of the strangest bugs in electronics: a machine that switches on when you wave your hand near it. A single resistor fixes it, and choosing its value is your first real electrical design trade-off.
- ◇ Explain why a button needs a pull-up resistor and what 'active low' means.
- ◇ Calculate the current through a pull-up while the button is pressed.
- ◇ Choose between a strong and a weak pull-up and justify the trade-off.
2.Predict
A pin has a resistor to 3.3 V, and a button from the pin to 0 V. What does the pin read when the button is NOT pressed?
Guess first. Being wrong here is how the surprise works.
3.Discover
Build a voltage divider: R1 is the pull-up (10 kΩ). For R2, try a very small resistance (a pressed button) and then a very large one (an open button plus the pin's huge input resistance). Watch where Vout goes each time.
Explorer 06 — Circuit fundamentals
Where the current goes, and why
A battery pushes current around a loop; resistors decide how much flows and where the voltage is used up. Change the circuit and the values, and check Ohm's law and Kirchhoff's laws for yourself.
- Current (thicker = more)
- Resistor
- Source (long plate +)
Source
Low-voltage DC only, up to 12 V
Resistors (E24 values)
- Total resistance
- 6 kΩ
- R1 + R2 + R3
- Source current
- 1.00 mA
- I = V / R
- Source power
- 6.0 mW
- P = V × I
- Sum of element powers
- 6.0 mW
- Equals source power
| Element | Value | Voltage | Current | Power |
|---|---|---|---|---|
| R1 | 1 kΩ | 1.00 V | 1.00 mA | 1.0 mW |
| R2 | 2 kΩ | 2.00 V | 1.00 mA | 2.0 mW |
| R3 | 3 kΩ | 3.00 V | 1.00 mA | 3.0 mW |
| Source | — | 6.00 V | 1.00 mA | 6.0 mW. Sum of element powers 6.0 mW. |
State
Series chain, 6.0 V source. Total resistance 6 kΩ. Source current 1.00 mA, power 6.0 mW. R1: 1.00 V, 1.00 mA; R2: 2.00 V, 1.00 mA; R3: 3.00 V, 1.00 mA. The three voltages add to 6.00 V, the source voltage (Kirchhoff's voltage law).
Series chain, 6.0 V source. Total resistance 6 kΩ. Source current 1.00 mA, power 6.0 mW. R1: 1.00 V, 1.00 mA; R2: 2.00 V, 1.00 mA; R3: 3.00 V, 1.00 mA. The three voltages add to 6.00 V, the source voltage (Kirchhoff's voltage law).
Guided experiments
Set up the circuit, predict what will happen, then make the change and compare.
01Double R2 in a series chainSeries
R1 = R2 = R3 = 1 kΩ. If you double R2, does the current halve?
+ What happens and why− What happens and why
Source current: 2.00 mA → 1.50 mA
Total resistance goes from 3 kΩ to 4 kΩ, so the current falls from 2.0 mA to 1.5 mA: smaller, but not half, because R1 and R3 did not change. R2 now takes a bigger share of the 6 V.
02Double the source voltageSeries
In a series chain, what happens to the current if you double the voltage from 3 V to 6 V?
+ What happens and why− What happens and why
Source current: 500 µA → 1.00 mA
Resistance has not changed, so by Ohm's law (I = V / R) the current doubles. Power goes up four times, because P = V × I and both doubled.
03Lower one parallel branchParallel
Two 1 kΩ resistors in parallel. If R2 drops to 100 Ω, what happens to the current through R1?
+ What happens and why− What happens and why
Current through R1: 6.00 mA → 6.00 mA
Each branch is connected straight across the ideal source, so R1 still has 6 V across it and its current stays at 6 mA. The total current rises, because R2 now takes 60 mA.
04Parallel is less than the smallestParallel
With R1 = 1 kΩ and R2 = 2 kΩ in parallel, is the total resistance above or below 1 kΩ?
+ What happens and why− What happens and why
Total resistance: 666.7 Ω → 500 Ω
Below. 1 kΩ ∥ 2 kΩ = 667 Ω: a second path always lets more current through. Making R2 equal to R1 halves the total to 500 Ω, so the source current rises.
05Load a voltage dividerDivider
A 10 kΩ / 10 kΩ divider gives half the supply. What happens to Vout if you connect a 10 kΩ load across R2?
+ What happens and why− What happens and why
Vout: 3.00 V → 2.00 V
The load sits in parallel with R2, so the bottom half becomes 5 kΩ and Vout drops from 3 V to 2 V. A divider only gives its ideal ratio when the load draws much less current than the divider itself.
06Protect the LEDLED
A red LED on 9 V with a 100 Ω resistor. Is the current safe for a typical 20 mA LED?
+ What happens and why− What happens and why
LED current: 70.0 mA → 14.9 mA
With the 2.0 V approximation, 100 Ω gives (9 − 2) / 100 = 70 mA, far too much. 470 Ω gives about 15 mA. The resistor sets the current because the LED's voltage stays roughly fixed.
07Below the forward voltageLED
A blue LED (about 3.0 V) with a 220 Ω resistor on 5 V. What happens if the supply drops to 2.5 V?
+ What happens and why− What happens and why
LED current: 9.09 mA → 0 mA
2.5 V is below the 3.0 V forward voltage, so in this model no current flows and the LED is off. A real LED fades out gradually rather than switching off at an exact voltage.
How to read this
The source pushes conventional current out of its positive terminal (the long plate), round the loop and back into the negative one. Arrows show its direction; thicker wires carry more current, and every reading is written next to its part.
Ohm's law: the voltage across a resistor is its current times its resistance (V = I × R). Kirchhoff's current law: current that splits at a junction adds back up to the same total. Kirchhoff's voltage law: the voltages round any loop add up to the source voltage. Power (P = V × I) is the rate energy is turned into heat or light; the table shows that it all adds up to what the source supplies.
Assumptions & limitations
- An idealised teaching model, not a design tool. Use it to understand the laws; check real circuits against datasheets and with a meter, and ask a teacher before building anything.
- Ideal source: it holds its voltage whatever current is drawn. Real batteries have internal resistance, so their voltage sags under load and they can get hot if shorted.
- Ideal wires with zero resistance, and exact resistor values. Real resistors have a tolerance (often ±1 % or ±5 %) and change slightly as they warm up.
- LED forward voltages (red ≈2.0 V, blue ≈3.0 V) are fixed approximations. A real LED's voltage varies between parts and rises with current, and it starts to glow gradually rather than at an exact voltage.
- Power-rating warnings use typical values (0.25 W for a small resistor, 20 mA for a small LED). Real parts vary: always check the part's own rating.
- The moving dots and their speed only show which way conventional current flows and roughly how much. Electrons actually drift the other way, very slowly.
- Low voltage only: the model refuses more than 12 V. Mains electricity is dangerous and is never something to experiment with.
Can't use the interactive? Read a description instead
In the circuits lab, a voltage divider has R1 (the pull-up) on top and R2 (the button) underneath, with Vout = Vin × R2 ÷ (R1 + R2). A tiny R2 (pressed button) gives Vout near 0 V; a huge R2 (open button) gives Vout near Vin. That is why a pull-up input reads 1 when released and 0 when pressed.
4.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
With a pull-up and a button to 0 V, which line of code means 'button pressed'?
5.Understand
The pull-up idea
A pull-up resistor connects the input to the supply. With the button open, almost no current flows (the pin barely draws any), so there is almost no voltage across the resistor and the pin sits at the supply: reads 1. Pressing the button connects the pin straight to 0 V: reads 0. The resistor stops that press from being a short circuit.
It is a voltage divider
Treat the pull-up as R1 and the button as R2 in a divider: Vout = Vin × R2 ÷ (R1 + R2). Open button: R2 is enormous, so Vout ≈ Vin. Pressed: R2 ≈ 0, so Vout ≈ 0 V. A pull-down is the mirror image: resistor to 0 V, button to the supply, so pressed = 1.
Strong or weak?
While pressed, the pull-up carries I = V ÷ R. A 10 kΩ pull-up at 3.3 V wastes 0.33 mA; a 1 kΩ one wastes 3.3 mA, which matters on a battery. But a very weak pull-up (say 1 MΩ) is easily disturbed by noise and long wires. Typical choices sit between about 4.7 kΩ and 47 kΩ, and many chips have a built-in pull-up you can switch on.
Explain it another way
A pull-up is a gentle spring holding a gate shut. The button is your hand pushing it open: much stronger than the spring, so you win, but the spring always returns it to a known position.
Internal pull-ups are typically tens of kilohms. In active-low logic, firmware tests if read(pin) == 0: for 'pressed'. Long cables add capacitance, so stronger pull-ups give faster, cleaner edges at the cost of current.
Pressed: I = V ÷ R. Open: V_pin = V × R_in ÷ (R + R_in), where R_in (often > 1 MΩ) ≫ R, so V_pin ≈ V. Power wasted while pressed: P = V² ÷ R.
Keyboard matrices, car-door switches and the reset button on most boards use pull-ups. Engineers prefer active low partly because a broken wire then reads 'not pressed' rather than 'pressed'.
Worked example 1
A 5 V system uses a 4.7 kΩ pull-up. How much current flows while the button is held, and how much power is wasted?
I = 5 V ÷ 4.7 kΩ ≈ 1.06 mA. P = V × I = 5 × 0.00106 ≈ 5.3 mW. Tiny, but on a coin cell it adds up if the button is held for hours.
Common mix-ups
- The pull-up resistor is there to limit the button's current only.
✓ It also gives the pin a defined resting voltage. Without it the input floats. - Pressed always reads 1.
✓ With a pull-up, pressed reads 0 (active low). Check the wiring before writing the if statement.
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2 · a fresh version every time
A button connects a pin to 0 V. The pin has a 4.7 kΩ pull-up resistor to 5 V. While the button is held, how much current flows through the pull-up, in milliamps?
Practice 3 · a fresh version every time
A button connects a pin to 0 V. The pin has a 10 kΩ pull-up resistor to 5 V. While the button is held, how much current flows through the pull-up, in milliamps?
Practice 4
A pull-down resistor connects the pin to 0 V and the button connects it to 3.3 V. What does a press read?
Practice 5
Why not use a 10 MΩ pull-up to save even more current?
7.Apply it
A battery-powered doorbell button may be held for a long time by a child. Compare 1 kΩ, 10 kΩ and 100 kΩ pull-ups at 3.3 V: current while held, and how robust each is to noise on a 5 m cable. Recommend one in two sentences.
8.Reflect
Concepts: Digital input and output · Voltage dividers