Electronics Basics · 11 November 2026

What Does a Pull-Up Resistor Do? (And Why Your Button Reads Random Values Without One)

A pull-up resistor gives an input pin a definite voltage when nothing drives it. Why a floating pin reads garbage, what value to use, and pull-up vs pull-down.

The 60-second version · open on YouTube ↗

You wire a push button to an Arduino pin, write a sketch that prints the pin, and the serial monitor shows 1 0 0 1 1 0 1 while nobody is touching anything. The button isn’t broken. The pin is floating, and a pull-up resistor is the two-cent fix.

What is a floating input?

A digital input pin is a very high-impedance probe. It draws almost no current, which is great for measuring, but it means the pin has no opinion of its own. If nothing is connected to it, or the only thing connected is an open switch, the pin’s voltage is whatever stray charge, nearby wires and your finger’s electric field make it. The chip still has to decide “HIGH or LOW?” every time you read it, so it rounds that noise to a 1 or a 0, and you get random values.

A floating pin is not “zero”. It is undefined.

What does a pull-up resistor actually do?

A pull-up is a resistor from the input pin to the supply voltage (5 V on an Uno, 3.3 V on an ESP32). With the switch open, no current flows, so there is no voltage drop across the resistor and the pin sits at the supply voltage: a clean, definite HIGH.

Press the button and the switch connects the pin straight to ground. Now the pin reads LOW, and the resistor’s only job is to limit the current flowing from the supply to ground through the closed switch. With 10 kΩ and 5 V that is 0.5 mA, which is nothing.

So the resistor “pulls the pin up” to HIGH by default, and the button overrides it by pulling the pin down to LOW. Pressed reads 0, released reads 1. That inverted logic surprises beginners, but it’s the normal convention.

What value should a pull-up resistor be?

Anything from about 1 kΩ to 100 kΩ works; 10 kΩ is the default for good reasons:

Value Current when pressed (5 V) Trade-off
1 kΩ 5 mA Strong (noise-immune), but wastes power while held
10 kΩ 0.5 mA The usual compromise
100 kΩ 0.05 mA Low power, but slow edges on long wires and more noise pickup

A stronger pull-up (lower resistance) holds the pin HIGH more firmly against noise and charges the wire’s capacitance faster. A weaker one (higher resistance) saves power. For a button on a short wire, 10 kΩ is the answer.

Can I use the built-in pull-up instead?

Yes. Most microcontrollers have internal pull-ups you can switch on in software. On Arduino:

pinMode(2, INPUT_PULLUP);   // internal ~20–50 kΩ pull-up on pin 2
int pressed = digitalRead(2) == LOW;

The internal pull-up is weak (20–50 kΩ on the ATmega328P), so it is fine for a button on the board but less reliable on a long cable in a noisy environment. For I²C lines, which need a specific pull-up to meet timing, use external resistors (typically 4.7 kΩ).

Pull-up or pull-down: which should I use?

A pull-down is the mirror image: resistor to ground, button to the supply, pressed reads HIGH. It reads “naturally” but is less common because:

  • Built-in pull-ups are everywhere; built-in pull-downs are rarer.
  • Open-drain devices (I²C, many sensors, reset lines) can only pull down, so the resting state must be pulled up.
  • Active-low conventions (RESET, CS) are the industry default.

Use a pull-down when the logic genuinely reads better that way and you’re wiring the resistor yourself. Otherwise, pull-up.

Try it Read a pin with nothing connected and print it 20 times a second. Then touch the pin with your finger. Then add a 10 kΩ pull-up. You'll see random → wandering → steady 1.

Why the button still glitches when you press it

Once the pin is pulled up you’ll notice a second problem: one press sometimes registers as two or three. That isn’t floating any more; it’s the metal contacts bouncing for a few milliseconds. That’s the next guide: button debouncing.


Was this useful? The video version is on YouTube — a like or a comment there helps more people find it. New guides every week: subscribe to DigiCirq.

Topics: pull-up resistor · floating input · INPUT_PULLUP · pull-down resistor · Arduino button · 10k resistor

Keep going