1

Maybe this is a question for Electronics SE but I’m not a member there yet so hopefully someone will have an answer here.

I did an experiment with having some push-to-make buttons connected to my Uno. I copied the circuit from the aduino.cc website and all worked exactly as expected. Here is my schematic of the circuit as I have it now: Circuit The pins are both held LOW by the Pulldown resistor until the switch is closed, when they go HIGH. All well and good. But I’ve just been looking at the circuit and something puzzles me. I can see a direct connection from Switch 1 to Pin 2 VIA the resistors and the Ground connection – and vice versa, S2 to P1. See my pathway in Red here:

Alt Path Now, to be clear, this is NOT happening – but I just want to understand why not. Is it just that the 2 resistors in combination provide enough resistance to stop the opposite pin from going HIGH? In which case, this Pulldown resistor is actually serving 2 completely different functions in the circuit…?

2

An input pin is in what is known as high impedance mode. That is, to all intents and purposes, to the external circuit it looks like a massive resistor to ground.

This resistance can be in the millions of ohms.

So let's redraw your circuit with those input pins as big resistors:

schematic

simulate this circuit – Schematic created using CircuitLab

Now you can see how the schematic really looks (see how it's set up so +5V is at the top and GND is at the bottom - the [conventional] current flows then from top to bottom).

So with SW2 pushed (as shown) the current wants to flow from 5V (top) to GND (bottom). That goes through SW2, through R2, and down to ground. Some tiny amount also flows through R4, which represents the input pin. Since by then the current is already at ground and has reached its destination there is no reason at all for it to then flow back up through R1, and back down to ground again through R3. For current to flow through R1 the voltage at IN1 would have to be negative since current will only flow from a higher to a lower voltage. And since it isn't negative, no current can flow.

| improve this answer | |
  • This explains it the best way for me. I've marked it as the answer, thank you. So if we were to have NO R1 on this diagram, IN1 would still not go High because that would mean the current would have to flow back through R3 to get to the place where it's already managed to get...? – Lefty Feb 1 '17 at 8:29
2

Call the resistors R1 and R2, the negative terminal Ground, and the positive terminal V+. The junction of R1 and R2 is connected to Ground. This holds the resistor ends at the junction to zero volts relative to ground. Ignoring P2 for the moment, the other end of R2 is open circuit to V+ when S2 is open. Applying Ohm's law, we have a finite resistance in series with an infinite resistance, so zero volts across R2 when S2 is open. Thus one sees that voltage across R2 is not affected by voltage changes across R1.

P2 as an input is not completely an open circuit; typically its effect is similar to a multi-gigaohms resistor to some voltage between Ground and V+.

Edit: More directly, observe that the voltage at the Ground ends of R1 and R2 is zero and remains at zero no matter what S1 and S2 do. Thus, operation of S1 does not affect voltage at P2, and operation of S2 does not affect voltage at P1.

| improve this answer | |
  • Sorry, I'm failing to understand this, why would there be zero volts across R2? I assume you mean with S1 closed...? Also, if we imagine replacing the resistors with just conductors, they would presumably have a "finite" resistance as well - but then that just looks like a direct circuit connecting S1 to P2. – Lefty Jan 31 '17 at 18:43
  • @Lefty, see edit – James Waldby - jwpat7 Jan 31 '17 at 19:48
  • jwpat7 +1 but I'm obviously deficient in my understanding here so I will need to re-read your answer a few dozen more times before it starts to make sense to me. Fundamentally, I feel that, just because the ground ends of R1 and R2 are connected to ground, that doesn't mean that there is no circuit from S1 to P2. If you replace the resistors in the circuit with straight conductors, you will see that there is nothing "special" about having a connection to ground - the value of the resistors therefore MUST be important (withing reason)...? – Lefty Jan 31 '17 at 22:16
  • Well yes, there is a circuit from S1 to P2, but the resistors' junction is always at ground, thus any charge anywhere else in that circuit can flow only to that junction and ground. P2 - as an input - has "no" ability (read: very little) ability to source or sink current so with negligible current in R2 then by ohm's law, P2 must also be at ground. – JRobert Jan 31 '17 at 23:05
1

It helped me to draw an equivalent schematic to yours when S1 is closed and S2 is open. P2 is neither high nor low by itself; it is a high-impedance (which is why you need a pulldown or pullup resistor). It is pulled to ground by R2 and the fact that the junction of the two resistors is grounded. If you disconnected that junction from ground, P2 would see a 20K pullup, but as it is, the (left) end of R2 stays at ground, regardless of what you apply to the P1-R1 junction.

schematic

simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
0

A simple rule of thumb is that electricity always follows the path of least resistance. The energy going over the switch has a lower resistance path to ground through the Arduino than it does through the pull-down resistor, so it will prefer to go that way than through one - or both resistors when it is available.

| improve this answer | |
  • True - but (correct me if I'm wrong) the need for the Pulldown resistor shows that even an open circuit actually needs to be grounded to stop the pin from fluctuating - hence the need for the resistor. It seems to me that I would expect more current to flow through 2 resistors than to to flow through an open circuit..? – Lefty Jan 31 '17 at 18:12

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.