You are on page 1of 5

Pull-up & Pull-down Resistors

Often we want to connect a digital input line to our microcontroller. Typically this might be to allow us to monitor the on-off state of a switch. Eg.
5V

switch 0V (gnd or )

Microcontroller

At first glance this seems fine. When the switch is closed, the pin on our microcontroller is tied to 0 volt, ie. low. In contrast when the switch is open we would want the pin to be 5 volts, or high.

The input pin would tend to float high. This however isnt a true input signal, it is a very weak input and can readily switch from high to low through the slightest of electrical interference in any of the wiring.

A simple solution might appear to involve simply connecting the other end of the switch to our 5 volt supply
5V

switch 0V (gnd or )

Microcontroller

This will give us a 5 volt (high) signal on the input pin when the switch is open. When the switch is closed however we will get a short between supply and ground => zero resistance => infinite current - this is not good news.

The problem can be remedied by simply putting a resistor into the circuit. This is the pull-up resistor.

5V 10 k switch 0V (gnd or ) Microcontroller

When the switch is open, the input to the microcontroller is high. There is no direct connection to the 5v rail, however because the input impedence to the microcontroller is high, very little of the 5v is dropped over the pull up resistor. When the switch is closed current flows down through the resistor and through the closed switch to ground. The input pin is tied to ground and so will read low. This gives us what we want.

A variation on this is the pull-down resistor. This ties the input pin to ground rather than the supply voltage. ie.
5V switch Microcontroller 10 k 0V (gnd or )

You might also like