1

I am new to all of this and was trying to figure out what was happening with pull-up/pull-down circuits. I think I understand what happens when the board handles the pull-up/pull-down but I wanted to try to build the circuits. I got help from another forum. Once I made the circuits, I found that I don't understand the path that the voltage is traveling. I have 2 examples with multimeters attached.

Pull Up

I understand the press of the button connect circuit to ground. But why does the voltage everywhere go down to zero when it is connected to ground? Does it have something to do with the multimeter can't read the voltage because the current is taking the path of least resistance - which I have read is a myth? Pull Up Circuit

Pull Down

When compared to the Pull Up, why does the voltage go to 5 before the yellow wire when the button is pushed? Isn't it connected to the ground again which seems like it should cause the same scenario as the Pull Up where they all read zero. Or does the resistor before ground have something to do with this. Pull Down Circuit

I know nothing about electronics. Some information and links where I could find more information would be great. Thanks.

All the gifs are screen recordings from circuits I built with circuits.io. I want to get into making somethings but wanted to practice first before I spent any money.

3

It's very hard to read your circuit, because there are wires everywhere. However this is effectively what a switch and a pull-up resistor looks like:

Pull-up resistor

Due to the pull-up, pin 8 on the Arduino (which the switch is connected to) is normally pulled-up to 5V if the switch is open.

When you close the switch pin 8 becomes 0V, thus your meter reads 0V.


On the other hand, with a pull-down resistor, the circuit looks like this:

Pull-down resistor

Now pin 8 is normally zero volts with the switch open, and when closed pin 8 is connected to 5V to pin 8 becomes 5V.


See my tutorial on switches for more details.


What happens with the flow of current and the resistor to make one example read high and the other low.

Imagine a door with a spring on it to close it. The spring is like a pull-up (or pull-down) resistor (depending on whether you are trying to keep the door closed or open).

The spring gently pulls the door shut. However if you barge out of it with a handful of pizzas in your hand your override the spring. In the absence of the spring the door would just flap in the breeze, sometimes opening and sometimes closing.

The point is, a person is strong enough to force the door open, despite the spring. Similarly if you close the switch you override the pull-up (or pull-down) resistor.


Where does the 5V go when the switch is closed.

It flows through the resistor to ground (or 5V depending on which one you are talking about).


When the switch is open in the pull up example - is voltage going through the resistor? From what I'm reading online, in the pull up case voltage isn't traveling through the resistor until the button is pressed.

Voltage doesn't "go through" a resistor, current does.


With the switch open, effectively a tiny amount of current goes through the resistor to pin 8. It is a "high impedance" input which means it puts a very small load on the input. Thus there is a very small voltage drop over the 10k resistor, and almost the full 5V is presented to the input pin for reading.

To work out the exact amount, we can look at the datasheet which says that the maximum leakage current through an I/O pin at 5V is 1 µA. Now using Ohm's Law we can find the voltage drop over the 10k resistor:

V = I * R
V = 0.000001 * 10000
V = 0.01 V

Thus with 5V at the 5V pin of the processor, and a (maximum of) 1 µA consumed at pin 8, it will therefore have 4.99 V at the pin, which therefore reads HIGH.


With the switch closed, then we use Ohm's Law to calculate the flow through the resistor:

I = V / R
I = 5 / 10000
I = 0.0005 A

Thus 0.5 mA flows through the resistor with the switch closed. This is not enough to damage the resistor, or make a significant load on the 5V line.


I think you are getting confused (as I did when I was young) that a big resistance (like 10k) must "resist" a lot of voltage. It is easy to think that after going through 10k resistance there can't be much "voltage" left.

The fact is, though, that the voltage on the other end of a resistor is proportional to not only the resistance (R) but also the current (I). This is Ohms's Law (V = I * R)

So, if the current is very small (as is the case with an input pin) then the voltage drop over a resistor - even a large one - is very small.

So, the idea of a pull-up resistor is, that with no external influences (like a switch) then after passing through 10k resistance, there is still 5V at the other side.

Let me issue you with a challenge. Find a voltage source (eg. a battery). Measure it with your multimeter. Let's say you have a 5V source which is the Arduino 5V pin. Now get a 10k resistor. Put it in series with the 5V source. Now measure it on the other side of the resistor. Depending on the quality of the meter (and thus how much current it takes to measure a voltage) you will get very close to the same voltage reading. In my case I had 5V on one side of the resistor, and 4.99V on the other side. This is exactly what my calculations above predicted.

  • Thanks for the diagrams. Maybe this is very basic, but can you explain why the pin takes current from the path without the resistor? Like for the pull up, once the switch closes the pin is still connected to the 5v pin, but why does it use the ground pin to get a voltage of zero. And if I put a multimeter on the section between ground and the switch, why would it read zero instead of 5? – Brian Jul 3 '16 at 0:30
  • What pin? In both diagrams pin 8 is connected to a resistor. In one it pulls the pin high (a pull-up) and in the other it pulls it low (a pull-down). – Nick Gammon Jul 3 '16 at 7:08
  • Sorry, I should have been more descriptive. Yes, pin 8. When the switch is closed in both examples pin 8 is connected to both ground and 5V. What happens with the flow of current and the resistor to make one example read high and the other low. Like in the pull up, all three pins are connected so what property or law of electricity makes it switch from 5V to 0V when it is still connected to the 5V. Where does the 5V go when the switch is closed. Path of least resistance comes to mind but I have read that that statement is a myth. Thanks. – Brian Jul 3 '16 at 9:17
  • See my amended answer. – Nick Gammon Jul 3 '16 at 9:28
  • Thanks for working me through this. When the switch is open in the pull up example - is voltage going through the resistor? From what I'm reading online, in the pull up case voltage isn't traveling through the resistor until the button is pressed. If this is the case, why does the input pin read 5V when the button is up if the voltage has to travel through the resistor from the 5V pin. – Brian Jul 3 '16 at 12:55

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.