The resistor is a passive electronic component that is used in many electronic circuits. The main function of the resistor is to regulate or limit the flow of electrical current in a circuit. Pull-up pull-down resistor is very useful especially when giving logic to microcontrollers
Ohm’s Law
Ohm’s law states that current flowing in a circuit is directly proportional to the voltage and is inversely proportional to its resistance. When two resistors are connected in series current flowing through both the resistors is the same. Similarly when resistors are connected in parallel voltage across both the resistors are the same.
Digital logic gates, micro-controllers and IC’s contain many input and output pins. These input and output pins should be correctly set to the either HIGH or LOW state for the digital circuit to function correctly. These logic states are represented by two different voltage levels with any voltage below one level is regarded as logic “0” and any voltage above another level is regarded as logic “1”. If the input to a digital logic gate is not within the range by which it can be sensed as either logic 0 or a logic 1, then the circuit may falsely trigger and the desired result cannot be obtained.
Pull-up Resistor
Pull-up resistors are simply fixed value resistors, that are connected between the particular pin and the voltage supply. A low-value resistor is called a strong pull-up and a high-value resistor is called a weak pull-up. With a pull-up resistor, the input pin will read a high state (close to VCC) when the switch is open. When the switch is closed, it will connect the input pin directly to the ground (close to 0V).
Pull-down Resistor
Like pull-up resistors, Pull-down resistors also work in the same way but they pull the pin to a low value. They are connected between a particular pin on a microcontroller and the ground terminal. When the switch is open, the pull-down resistor pulls down the input voltage to the ground (Logic 0). When the switch is closed, the input of the microcontroller is high (logic 1).