← Field Notes

Pull-up and pull-down resistors explained

Pull-up and pull-down resistors explained

Connect a push button between a logic input and ground, and you might expect the input to read "high" until you press the button. It will not, at least not reliably. When the button is open the input is connected to nothing at all, and an unconnected input drifts with every stray electric field nearby. Engineers call that a floating input.

The fix is one resistor

A pull-up resistor runs from the input to the positive supply. With the button open, the resistor holds the input high. Press the button and the input is connected straight to ground, so it reads low.

A pull-down resistor is the mirror image. The resistor runs from the input to ground and the button connects to the positive supply. Open reads low, pressed reads high.

Choosing the value

The resistor has to be small enough to hold the input firmly and large enough not to waste current when the button is pressed. 10 kΩ is the usual choice. On a 5 volt supply, that is 5 ÷ 10,000 = 0.5 mA while the button is held down, which is next to nothing.

Where you will meet them

  • On every switch and button feeding a digital chip.
  • On the reset pin of timers and microcontrollers.
  • Built into many microcontrollers, where a line of code switches an internal pull-up on.

If a digital circuit behaves randomly, or changes when you wave a hand near it, look for an input that has been left floating.

If you want the fundamentals in one place, with hand-drawn diagrams, start with Getting Started in Electronics, or browse all four books.

See the guides