Pull-up and Pull-down resistors



Suppose in a microcontroller ,you have configured the GPIO functionality of a particular pin to input, and if you read the state of the pin when nothing is connected to it,will it be high(Vcc) or low(Gnd).This is difficult to tell and the state it is present is known as floating state(high impedance state).To prevent this unknown state or floating state,a pull-up or pull-down resistor will ensure that the pin is either in a high state or low state.

           A pull-up resistor is connected to 3.3V or 5V (Vcc) and the pull-down resisitor is connected to ground(GND).

      Pull-ups are often used with buttons and switches.



When the pull-up resistor is connected,the input pin will read a high state when the button is not pressed,a small amount of current will be flowing between the input pin and the VCC thus the input pin is reading to close to VCC.When the button is pressed it connects the input pin directly to the ground,the current flows through the resistor to the ground,and hence input pin reads a low state.If the resistor was not there ,then VCC is directly connected to ground,which is a bad practice.


If we choose the resistor value as large ,it is called weak pull-ups(less current flows),if we choose the resistor value as high,it is called strong pull-ups(large current flows).

The value of the pull-up resistor choosen has to satisfy two conditions:
1.The amount of current required when the button is pressed.
2.The amount of voltahe supplied to the pin when the button is not pressed

Since pull-up resistors are so commonly used,many MCUs like ATMEGA provides internal pull-ups which can be enabled or disabled







References:

1.https://learn.sparkfun.com/tutorials/pull-up-resistors/going-further

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig