Wednesday 10 December 2014

Pull up and Pull Down Resisitors

All Arduino Pins are Inputs by Default. lets say you wanted to use pin 3 as input to the push button and the circuit will look like this
Push Button Config

if we wanted to send the logic 0 to do specific work we press the push button and it connects the digital pin3 of arduino to the ground.
what is the state of the pin3 when we dnt wanted to send the logic 0 to the circuit?
it connects to the nothing..

"If nothing is connected to the pin and your program reads the state of pin, will it be high or low?? it is difficult to tell" this phenomena is referred to as
floating.

"just because nothing is connected to the input pin doesn't mean it is a logical zero" even it is we dont want to send the logic 0 in present condition when
button is not pushed ,i.e when nothing is connected to the pin.

In this situation Pull up/down resistors are come in handy.

in the above circuit when the button is not pressed the default condition of the circuit has to be logic high(1). so if we connect the vcc to the circuit like this

Pull Up with out resistor

it will full fill our condition to make default position as logic high when button is not pressed.
But When the button is pressed the button it connects the Vcc to Ground, which is called as short, and we have to avoid short circuits. so we need to connect the
resistor between the Vcc and Ground.
Pull Up with resistor

when the button is pressed it connects the input pin directly to the ground, the current flows through the resistor to the ground.



the same scenario is work for Pull Down resistor in this case the default state is low. again the resistor in the circuit is used to avoid the short betweeen vcc and GND
Pull Down Resistor


we can find more information here and here

when to use pull up/down here

No comments:

Post a Comment