The Pull up and Pull down resistors are used to solve the floating point issues. As we know in Arduino boards the pins can only read two values which are High and Low. We can also use 1 for High and 0 Low and due to this floating point issue we will get random values of 0 and 1. This can be resolved using pull-up and Pull-down resistors which are available on Arduino boards.
What is Resistor
Resistors are passive current-limiting devices used for controlling or restricting the flow of current through them.
The unit of resistance is ohm with a sign of Ω. There are different types of resistance, in today’s article, we are going to discuss pull-up and pull-down resistors.
What is Pull Up Resistors
The Pull-up resistors are used in logical circuits to ensure a well-defined logical level at a pin under all circumstances. As we know that digital logic circuits consist of three logic states which are :
- High
- Low
- Floating or High impedance
The high-impedance state occurs when the pin is not pulled to a high or low logic level but is left “floating” instead.
To understand this let us assume that there is an unconnected input pin of a microcontroller. It is neither in a high logic state nor low logic state, and the microcontroller might unpredictably interpret the input value as either a logical high or logical low. Pull-up resistors are used to solve this dilemma for the microcontroller by pulling the value to a logically high state. It is used to ensure that a wire is pulled to a high logical level in the absence of an input signal.
It helps in ensuring that the inputs or outputs of microcontrollers function correctly and provide the expected switching condition.
The pull-up resistor is then paired with a switch to ensure that the voltage between Ground and VCC is actively controlled when the switch is open. If we do not use pull-up resistors it will result in a short circuit because the pin cannot be directly shorted to the ground or VCC.
Pull-up resistors are not a special kind of resistor, they are fixed-value resistors connected between the voltage supply and the appropriate pin which defines the input or output voltage in the absence of a driving signal. A typical pull-up resistor has a value of 4.7Ω but it can vary according to the need.
What is Pull Down Resistor
The Pull-down resistors are also used in logical circuits to ensure a well-defined logical level at a pin under all circumstances. The only difference between the Pull-up and Pull-down resistor is that It is used to ensure that a wire is pulled to a low logical level instead of a high logical value in the absence of an input signal.
The pull-down resistor is then paired between the Ground and the appropriate pin on a device when the switch is open.
A switch is connected between the supply voltage and a microcontroller pin. When the switch is closed, the microcontroller input is at a logically high value, but when the switch is open, the pull-down resistor pulls the input voltage down to a logic zero value, preventing an unwanted state at the input.
Also, the value of the pull-down resistor must have larger resistance than the impedance of the circuit to be able to pull the voltage down by the required value.
Difference Between Pull-up and Pull-down Resistors:-
Pull-Up Resistors | Pull-Down Resistors |
Connect between the I/O pin and +supply voltage, with an open switch | Connect between an I/O pin and ground, with an open switch |
connected between I/O and ground. Keeps the input “High” | connected between I/O and +Supply.Keeps the input “Low” |
Most commonly used | Less commonly used |
Pull-up and Pull-down Resistor Values
The actual value for the pull-up or pull-down resistor is determined by two factors.
- The first factor is power dissipation. If the resistance value is too low, a high value of current will flow through the pull-up resistor, which causes heating of the device and uses up an unnecessary amount of power when the switch is closed. This condition is called “Strong Pull-Up” and this condition is avoided when low power consumption is required.
- The second factor is pin voltage when the switch is open.
If the pull-up resistance value is very high and there is a large leakage current of the input pin, the input voltage will become insufficient when the switch is open. This condition is known as “Weak Pull-up”.
Note:- The actual value of the pull-up resistance is dependent on the impedance of the input pin, which is related to the pin’s sink current.
How To Calculate The Actual Value of Pull-up and Pull-down Resistors
The actual value of the Pull-up resistor and Pull-down resistor can be determined by ohm’s law, which gives:-
V = I x R
R = V/I
In the case of the Pull-up resistor, the V will be representing the source voltage – the minimum voltage accepted as High, and the current will be the maximum.
So,
Rpull-up = (Vsupply – VH(min)) / Isink
Where:-
Vsupply is the supply voltage
VH(min) is the minimum accepted voltage as a High
Isink is the maximum current sinked by the digital pin.
In the case of a Pull-down resistor
Rpull-up = (VL(max) – 0) / Isource
Where:-
(VL(max) the maximum voltage is accepted as logic Low.
Isource is the maximum current sourced by the digital pin.
Now, let us take an example:-
Let us assume that we have a logic circuit in which the Supply source is 3.3V and the acceptable logic high voltage is 3V, and we could sink a current maximum of 30uA. In this case, we can use a Pull-up resistor and then:-
Now, let us assume an example for a Pull-down resistor:-
The circuit discussed above now accepts 1V as the maximum logic Low voltage and could source up to 200uA of current. In this type case, we will use Pull-down resistors and then:-
Applications Of Pull-up and Pull-down Resistors
The Pull-up and Pull-down resistors are used when we need to interface a switch or some other input with a microcontroller or other digital gates.
Most microcontrollers have built-in programmable pull-up and pull-down resistors, so it needs fewer external components. Pull-up resistors are used more often than pull-down resistors, however, some microcontroller families have both pull-up and pull-downs available.
They are used to provide a controlled current flow. Another application of Pull-up and Pull-down resistors is the I2C protocol bus, in which the pull-up resistors are used to enable a single pin to act as an input or an output.
When not connected to a bus, the pin floats in a high-impedance state.
Frequently Asked Questions:-
- What is the purpose of a pull-up and pull-down resistor?
A pull-up resistor is used to control the current flow from the supply voltage source to the digital input pins, while the pull-down resistors could effectively control the current flow from digital pins to the ground. example Relay
- Where should a pull-up resistor be placed?
Pull-up resistors may be placed at logic outputs where the logic device cannot source current such as open-collector TTL logic devices. for more
- Do pull-up resistors consume power?
The pull-up or pull-down resistors do not consume power regularly; it only consumes current while they are being overridden by an external switch.