Pull up & pull-down resistors
-
Upload
prathik -
Category
Technology
-
view
3.519 -
download
4
Transcript of Pull up & pull-down resistors
Pull-up & Pull-down Resistors
Often we want to connect a digital input line to our microcontroller. Typically this might be to allow us to monitor the on-off state of a switch.
Eg.
At first glance this seems fine.
When the switch is closed, the pin on our microcontroller is tied to 0 volt, ie. low.
In contrast when the switch is open we would want the pin to be 5 volts, or high.
switch
0 V(gnd or )
5 V
Microcontroller
The input pin would tend to “float” high. This however isn’t a true input signal, it is a very weak input and can readily switch from high to low through the slightest of electrical interference in any of the wiring.
A simple solution might appear to involve simply connecting the other end of the switch to our 5 volt supply
This will give us a 5 volt (high) signal on the input pin when the switch is open. When the switch is closed however we will get a short between supply and ground => zero resistance => infinite current - this is not good news.
switch
0 V(gnd or )
5 V
Microcontroller
The problem can be remedied by simply putting a resistor into the circuit. This is the pull-up resistor.
When the switch is open, the input to the microcontroller is high. There is no direct connection to the 5v rail, however because the input impedence to the microcontroller is high, very little of the 5v is dropped over the pull up resistor.
When the switch is closed current flows down through the resistor and through the closed switch to ground. The input pin is tied to ground and so will read low.
This gives us what we want.
switch
0 V(gnd or )
5 V
Microcontroller
10 k
A variation on this is the pull-down resistor. This ties the input pin to ground rather than the supply voltage.
ie.
switch
0 V(gnd or )
5 V
Microcontroller
10 k