# Pull up resistor and pull down resistor

Before we start, pull up resistor and pull down resistor, we should know a little bit about what is switch/button. First, we will see what is switch then we will see what is pull up resistor and pull down resistor and then how to select a value of pull up resistor and pull down resistor.

Switch/Button is an electronic device which is used for making a connection between the electrical circuit. Symbol of the switch is shown in (Fig 1) below. When the switch is not pressed means open circuited, then there is no connection between switch terminals hence there is no flow of current through an electrical circuit which is shown in (Fig 2) below. When the switch is pressed means short-circuited there is a connection between switch terminals hence there is a flow of current through an electrical circuit which is shown in (Fig 3) below. ### Why we use Pull up resistor or Pull down resistor:

Why we use Pull up resistor or Pull down resistor because while working with a microcontroller, we come to a situation, where we want to connect a switch/button to the microcontroller. But we can’t connect switch/button directly to microcontroller because when the switch is not pressed, input to a microcontroller is high Impedance state means input to a microcontroller can be either logic ‘0’ or logic ‘1’. To avoid this we use a resistor called a pull up resistor or pull down resistor.  The resistor is said to be pull up or pull down resistor depends on how we connect that resistor to switch/button and microcontroller. ### Pull up resistor:

The resistor is said to be pull up resistor when we connect one terminal of a resistor to VCC and another terminal of a resistor to a microcontroller input and switch. Pull up resistor arrangement with switch and microcontroller is shown below. When the switch is not pressed, the microcontroller will receive logic 1 at the input because the entire voltage will appear across the input pin of the microcontroller as there is no flow of current through the circuit. When the switch is pressed, the microcontroller will receive logic 0 at the input because 0 volts will appear across the input pin of the microcontroller as there is a flow of current through the circuit. ### Pull down resistor:

The resistor is said to be pull down resistor when we connect one terminal of a resistor to GND and another terminal of a resistor to a microcontroller input and switch. Pull down resistor arrangement with switch and microcontroller is shown below. When the switch is not pressed, the microcontroller will receive logic 0 at the input because 0 volts will appear across the input pin of the microcontroller as there is no flow of current through the circuit. When the switch is pressed, the microcontroller will receive logic 1 at the input because the entire voltage will appear across the input pin of the microcontroller as there is a flow of current through the circuit. Please click on the following link to know, how to select a value of pull up resistor or pull down resistor.
How to select a pull up resistor or pull down resistor