1

I am having trouble understanding exactly what is going on in a circuit where when a button is pressed an LED goes on. Also, I have the Arduino UNO.

The schematic can be seen at:

2:36 of this video: Arduino Tutorials: Control a LED with a Button.

Fritzing of complete circuit

So, the part that I don’t understand is, how come when the button is clicked and the current can pass through, the current doesn’t go through the pull down resistor and instead goes along the input wire?

Pull down resistor on input

I’m a beginner but do understand concepts like voltage, amps, resistors, Ohm’s law, etc. So answers don’t have to be super simple, but simple enough that I can understand them. Thanks!

closed as off-topic by Majenko Apr 16 at 14:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Arduino, within the scope defined in the help center." – Majenko
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You may have the arduino, but the question is off topic. Please ask the question at Electrical Engineering SE. – MichaelT Apr 16 at 12:19
  • The input pin has a very high resistance, so that nearly no current is flowing into it. Effectively the microcontroller is doing a voltage measurement. It measures the voltage over the pulldown resistor. – chrisl Apr 16 at 12:47
  • Some current is flowing though the pull-down resistor, but the power supply has no problem producing this little bit of current, so the voltage before the pull-down resistor will remain a stable 5 Volt. So the voltage at the Arduino input will be 5Volt while the button is pressed. Once the button is released any "stray" voltage will flow though the resistor, so the voltage at the input pin will become 0 Volt – Gerben Apr 16 at 13:06
  • Please, can you forget everything that you "learned" from that video. The explanation in that video is wrong and confusing. The way the video explains how the current flows is utter nonsense. You can start with the arduino examples, they are in the menu of the arduino program and also online: arduino.cc/en/Tutorial/BuiltInExamples Start for example with "Button" in section "2. Digital". – Jot Apr 16 at 13:08
3

So, the part that I don’t understand is, how come when the button is clicked and the current can pass through, the current doesn’t go through the pull down resistor and instead goes along the input wire?

Simple: It does go through the pull down resistor. But it also goes down the "input" wire.

For simplicity you can imagine that the input is simply a very large resistor. Say, 1MΩ.

The circuit can then be simplified as:

schematic

simulate this circuit – Schematic created using CircuitLab

Contrary to popular belief, current does not take the path of least resistance. It takes all possible paths. The quantity of current through each path is proportional to the resistance of the paths.

In this example we have two paths - one with 10kΩ and one with 1MΩ. That's a ratio of 1:100, and the current will be split accordingly.

You can calculate the current that flows through each resistor simple using Ohm's Law because the wires and switch are (in an ideal world) just not there. The 5V is directly connected across each of the resistors.

So for the 10kΩ resistor the current through is is:

     V      5
I = --- = ----- = 0.0005 = 500µA
     R    10000

And for the 1MΩ it is of course 100x smaller (I'll let you do the maths for that if you want to check), so 5µA.

The full current that the circuit takes is 505µA, with it split between the two resistors.

With the Arduino instead of the 1MΩ resistor it's exactly the same (though the current values may vary somewhat). 500µA flows through the 10kΩ resistor, and "some tiny current" flows through the Arduino.

However, with all that said, the Arduino really doesn't care about the current. All it cares about is the voltage. With the button pressed both the input and the 10kΩ resistor are connected directly to the 5V supply - so the Arduino reads that as "HIGH". When you release the button the input is now connected to ground through the 10kΩ resistor, but there's no current to flow, so there's no voltage across the resistor (the voltage across a resistor is proportional to the current flowing through the resistor - Ohm's Law), so it's as if the input is connected directly to ground - and the Arduino reads that as "LOW".

To be more technically accurate the input of the Arduino is actually more akin to a tiny capacitor. When you apply 5V to the input it charges that capacitor up. Once it reaches 60% of 5V the Arduino recognises it as a "HIGH" signal.

When you release the button that capacitor is then connected to ground through the resistor, and it discharges through that resistor. Once it drops to 30% of 5V the Arduino sees it as being "LOW".

If you don't have the pull-down resistor, when you remove the 5V from the input that capacitor is still charged. So the Arduino still sees it as a HIGH. The charge in the capacitor will slowly bleed away until it's low enough to be seen as low.

But, (and it's a big but), the capacitor is very sensitive and can be charged up again by ambient energy around the place (radio waves, static electricity, etc). It can harvest enough energy from the environment to get back up to the 60% of 5V and be seen as "HIGH" again. This is known as "Floating", and is something you do not want in your circuit. The input "flaps around" between HIGH and LOW with no control. Which is why the pull-down resistor is absolutely essential.

  • I have one question about this answer, doesn’t the voltage drop across the LED or resistors or something like that, I just watched a video and it made me confused about this answer. – BeastCoder2 Apr 17 at 13:20
  • LEDs are a special case. They are in the "non linear" category, and you shouldn't worry about them at the moment. As for "voltage drop", yes, and it is. In simple terms: Ohm's Law has three variables. At any one time two of those variables are fixed, and you are calculating the third. In the circuit above the voltage is fixed and the resistance is fixed - so the current is what you would calculate. The voltage is 5V simply because it is 5V. The resistance is 10kΩ because it's a 10kΩ resistor. The combination of those two values causes 500µA to flow. ... cont ... – Majenko Apr 17 at 13:22
  • Of course, if you knew that there was 500µA flowing through a 10kΩ resistor then you could calculate that there was 5V being dropped across it. The 5V in the circuit above is called a constant voltage supply. That is because it is always 5V (unless you overload it of course). The current that the supply gives out varies depending on the load (the values of the resistors in this example). – Majenko Apr 17 at 13:23
  • So, you are saying that the reason that it doesn’t drop is only because we already know that there are 5V? Could you please explain, sorry, I’m really trying to wrap my head around all of this. – BeastCoder2 Apr 17 at 13:26
  • It does drop. One side of the resistor is 5V. The other side is 0V (ground). The difference is 5V, and that is what is "dropped" across the resistor. The fact that the 5V is fixed in stone means that the current is determined by the resistance and the voltage in the formula I=V/R. – Majenko Apr 17 at 13:27
-2

the answer is within the question, Electrons will quite happily travel along a wire until they hit resistence as in a resistor. where there is less resistence too flow that is the path they will take. The path of least resistence you might say.

  • 1
    That seems misleading, because the current will not flow only through the path with the least resistance. Instead the current is divided between all paths relative to their resistance. – chrisl Apr 16 at 12:50
  • agreed but at that level of understanding it seemed a fair answer – Jamie Apr 16 at 12:59
  • Sorry Jamie, but you are sending a beginner down the wrong path. – Jot Apr 16 at 13:25
  • ok but please construct a clearer more concise answer – Jamie Apr 16 at 13:30
  • @Jot he's sending the user down the path of least resistance... – Majenko Apr 17 at 14:04

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