Electronic – Why does a pull-up resistor not stop current flowing to the input pin when the switch is open

currentpulldownpullupresistors

Sorry this is such a silly question, but I can't seem to understand this. In the third diagram here it shows a pull-up resistor.

enter image description here

I understand that when the switch S1 is closed, current is pulled down to ground and assumes a value of 0. This doesn't short because of the resistor limiting the current.

My question is: When the switch is open and the current is flowing into the input pin of the device, how does it pick up that this is a high value and not a low value? Wouldn't the resistor limit it to the extent that it would be .0005 A and so it would barely register with the device?

EDIT: Also, I am just looking at the pull-down resistor case on the same page. Why does the first switch not short when it is directly connected to VCC, there is no resistor, and the switch is open? Isn't this a no-no? I can't really grasp what is going on with the pull-down resistor.

Best Answer

The input is high-impedance and as such hardly draws any current. But let's, for sake of argument, pretend there flows a (rather large) current of 1\$\mu\$A. This current will flow through the 10k\$\Omega\$ pull-up resistor causing a 10mV (1\$\mu\$A \$\times\$ 10k\$\Omega\$) voltage drop across it. So in this case the voltage on the input pin will be \$V_{CC}\$ - 10mV, probably 5V - 10mV = 4.99V. That will be still recognized as a high level, so no problems here.
The 10k\$\Omega\$ is a typical value for pull-up resistors for this reason: even if there's a small leakage current the voltage drop is negligible. Don't be tempted to increase it to 1M\$\Omega\$, though it will decrease the current when the switch is closed. At 1\$\mu\$A leakage current the voltage drop will be 1\$\mu\$A \$\times\$ 1M\$\Omega\$ = 1V, and then the 5V will drop to 4V. For a 5V supply this will still be OK, but for a 3.3V supply the resulting 2.3V may be too low to be always seen as a high level.

For the pull-down the story is about the same. There doesn't flow any current in the input; you can't say that it would be connected to ground (in which case closing the switch would indeed cause a short-circuit). As such the input takes the voltage you apply to it. If the switch is closed this is \$V_{CC}\$. If the switch is open it's ground (through the pull-down resistor). If there's no current flowing (ideal world) then there's no voltage drop across the resistor either, and the input will be at \$GND\$ level. In a real world situation it may be a few mV.