In the above circuit,I understand the use of a pull down resistor.
But what I do not understand is how the current is able to flow through the resistor when the button is not pressed.
When the button is not pressed,the terminals 1a and 1b shouldn't be connected.Yet the the pull down resistor is at 1b and not at 2a.
Why?
There should not be any current flow, the circuit is open. Like the outlet in your wall with nothing connected no power flows. that resistor keeps the port input a low and eliminates the floating input and the associated noise.
Pin to R to G is pulldown (or just use pinmode INPUT_PULLDOWN)
Then 5V to switch to pin.
I don't, really. What's it for? I'd leave it out and configure the pin as INPUT_PULLUP. No resistor needed.
The Arduino's input impedance/resistance is around 100 megohms. ...Infinite for all practical purposes. So with just the pulldown (or a pull-up) resistor, essentially no current flows.
And/of if you know Ohm's Law, both ends of the resistor have zero volts (or both ends have 5V with a pull-up) so there is no voltage across the resistor so no current flows through it.
When you press the button, that puts 5V across the resistor and current flows through it. When the switch is on it "overpowers" the pull-down resistor pulling the input pin up.
Just to clarify, the software command connects a pull-up resistor inside the chip. No additional-external resistor is needed.
In this case the switch is wired to ground (and to the input pin) and when the switch is on, the input is pulled down. (So normally you have to reverse the logic in your code.)
I'm not sure what that circuit really does. A simple circuit diagram would show better.
One pole of a pull-up or -down will hang on the input pin, the other one either to Vcc (pullup) or to GND (pulldown). This way the resistor connects the input pin to either a stable high or low level. The button then connects the input pin to the other power line.
The pull-down will conduct some small currents when stray charges appear on the pin, due to noise being picked up by antenna-like effects, being touched by fingers, or just from previously being connected to Vcc by the switch, due to the inherent capacitance of the wires, pin, and switch itself.
Due to the very high impedance of the avr inputs, these small charges could otherwise cause invalid readings.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.