Ever since I connected a button to an Arduino for the first time, I've wondered how does the resistor prevent floating input from happening? I've read several answers to similar questions, seen videos and read forum posts:
https://www.quora.com/What-is-a-floating-input-gate
"We say it's left to float, which means it's in an indeterminate state: maybe high, maybe low, maybe somewhere in the middle. Worse, it may even change depending on other conditions in the environment." This just explains what it is. Which is fair, since that is what the person asking, asked for.
https://forum.arduino.cc/index.php?topic=378402.0
Same as above.
https://www.youtube.com/watch?v=wxjerCHCEMg
This video goes into a decent amount of detail about what causes floating input, i.e. outside electrical sources, and how to solve it, but does not address why adding a resistor eliminates this noise.
Everything I read on the internet just answers the same questions over and over again. I already know why you use a pull-down resistor ( or a pull-up resistor), to eliminate floating input and to prevent a short (in the case of a button). I already know that floating input is a result of electrical noise. But if someone asked me "so why does adding a resistor make the floating input go away?", I don't know how I would explain it to them, other than "it just does".
I wasn't sure whether I should post this question here, or in physics.stackexchange. I feel like this question is well within the domain of both sites, so I just picked one.
Edit: I do not feel this is a duplicate of What is a pull up and pull down? Because even though the information I am after is within the scope of that question, it does not provide it. I am not asking what a pull up or pull down is. What I'm asking is why does a resistor in a pull up / pull down eliminate floating input.
Best Answer
It's very simple.
simulate this circuit – Schematic created using CircuitLab
Figure 1. A CMOS input and one with a pull-down resistor.