0

I don't understand why a pull-down resistor connected to ground would prevent a pin connected to 5V through a button would not destroy the pin as the current does not need to go through the resistor to get to the pin. I've tried looking online but the question was never asked and I couldn't find any information that explained how it works.

I'm asking this in the context of something without internal resistors so it would have no protection against a short circuit/being connected straight to a source.

5

When you have a pin in INPUT mode it is high impedance. That means that to all intents and purposes, to the outside world, the pin is not connected to anything internally.

In reality it is, but that internal connection is of such a high impedance (i.e., resistance) that it is almost equivalent to an open circuit.

It's simplest to think of an input pin as a voltmeter. A pulldown resistor and button would look like this:

schematic

simulate this circuit – Schematic created using CircuitLab

When the button is opened the voltmeter reads zero, because one end is connected to ground, and the other end is connected to ground through the resistor.

However when you press the button the voltmeter reads the voltage across the resistor - that is, 5V - because one end is connected to ground and the other to 5V, with a resistor across it.

If you don't have the resistor then the voltmeter can't measure anything when the button isn't pressed - it's just waving around in the air without a clue what it's doing - and a wire waving around in the air is called an antenna...

The Arduino is that voltmeter. All it does is detect the voltage at the pin, it doesn't conduct any (or only a very very tiny amount of leakage) current through the pin.

Now the possibility of a short circuit comes when you set the pin to OUTPUT. If you drive the pin LOW then the pin is essentially connected to GND, and pressing the button will connect the 5V straight to GND through the LOW-driven IO pin.

1
  • good analogy...
    – dandavis
    Mar 5 at 20:19
0

A pullup or pulldown wire would destroy the pin because it would source or sink enough current to burn out the pin driver. But a pullup or pulldown resistor limits the current to a very small value (I = E/R = 5v/10000Ohm = .0005A or .5 ma, well within the pin driver's 20 ma limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.