Pull-Up and Pull-Down Resistor

Santosh

2012/11/20

Categories: Electronics Microcontrollers Tags: pullup and pulldown resistor

Today I was visiting a group on Facebook. It is related to Microcontroller based projects. People are very friendly there. I came across a post which was related to Pull Up resistor. That post ignited me to write a small article explaining this concept. So in this article I am going to explain you the concept of Pull-Up and Pull-Down resistor, their significance and their working.

Why do we need them?

The pull up and pull down resistors are used for preventing a node from floating. Consider following images.

Floating Node

Fig 1: An Example of Floating node

Floating Node

Fig 2: Another Example of Floating Node

So lets consider Fig 1. When the switch is pressed, voltage at input pin will be equal to VCC. But when switch is open (Not pressed), state of input pin is undefined. We can’t be sure about the voltage level of the Input Pin. So we can write the states of Input Pin based on switch state as:

Switch_State Input_Pin_State
Open(Not Pressed) Undefined
Closed (Pressed) High (Equal to VCC)

Table 1

Similarly for Fig 2 we can write the table as

Switch_State Input_Pin_State
Open(Not Pressed) Undefined
Closed (Pressed) Low (Equal to GND)

Table 2

So we can see that, if we use the Switch as input device to a microcontroller in these configuration, the device is going to face some undefined states (Floating State). So it may lead to ambiguous readings from the switch. Everyone connecting a switch to a microcontroller must avoid these configuration for their switches.

Pull Down Resistor:

Pull down resistor will pull a floating node to logic level low i.e. 0. So after connecting to a Pull down resistor the Fig 1 will look like as follow:

Pull Down Resistor

Fig 3: Using a Pull Down Resistor

So now we connected a very High value resistor from the floating node to Ground. Lets see how its going to help us.

Switch_State Input_Pin_State
Open(Not Pressed) Low
Closed (Pressed) High (Equal to VCC)

Table 3

When the switch is in Open state the resistor will try to pull down the node to Ground level. Hence it is named as Pull Down Resistor.

Pull Up Resistor:

By now you must have guessed the use of pull up resistor. The pull up resistor pulls up the floating node to a High logic value. So the Fig 2 circuit using a pull up resistance will look like :

Pull Up Resistor

Fig 4 : Using Pull Up Resistor

Here the resistor R1 will serve the purpose of pulling the Input Pin high when the switch is not pressed. But now the Voltage at Input Pin will be slightly  less than VCC based on your R1 value. But as you are using it as input to a Microcontroller, so it is not going to cost you in terms of errors as for Digital Devices there is a threshold between High and Low level. Every other variation is not of much use. So the table for switch with pull up resistor will be

Switch_State Input_Pin_State
Open(Not Pressed) High(Little less than VCC)
Closed (Pressed) Low (Equal to GND)

Table 4

Can I eliminate Resistor?

No you can’t. If you are thinking of providing two different state by directly connecting the two pins of Switch to two different logic levels then believe me you are going to do a blunder. Yes, your guess is right, the Input Pin will not be in a Floating State now when the switch is not pressed. But as soon as you are going to press the switch, the VCC node will be shorted to Ground and you circuit will go down.

So what is difference in using either of them?

Not much. As you might have observed in their truth table that both configurations are opposite in Logic Level. So for Switch configuration with Pull Up resistor you have to read logic low to know when the switch is pressed. Opposite is the case with the Pull Down Configuration. In this case you have to read High logic level to know when the switch is pressed.

So I hope this article might have brought some sort of clarity. Please provide with your extremely valuable feedback.