9
\$\begingroup\$

This question already has an answer here:

A.S. The question A question on pull up resistors answers only a part of my question as already mentioned in "EDIT" made shortly after this question was asked & answers here (below) are much detailed, in-context & easy to understand. Definitely not a duplicate; marking as duplicate for 2-3 points


I am reading a book on Arduino & I just do not understand the concept of push-up resistor, following is a quote from the book:

the circuit

Why do we need the resistor R1? R1 guarantees that the Arduino’s digital input pin 7 is connected to a constant voltage of +5V whenever the push button is not pressed. If the push button is pressed, the signal on pin 7 drops to ground (GND), at the same time the Arduino’s +5V power is connected to GND, we avoid a shorted circuit by limiting the current that can flow from +5V to GND with a resistor (1 - 10 KΩ). Also, if there was no connection from pin 7 to +5V at all, the input pin would be “floating” whenever the pushbutton is not pressed. This means that it is connected neither to GND nor to +5V, picking up electrostatic noise leading to a false triggering of the input.

Another book called it Arduino's pull-up resistance because it pulls current towards 5V, which confuses me even more - how can a resistor increase voltage, shouldn't the voltage drop?

Edit - thanks to @Golaž for pointing to helpful material at A question on pull up resistors, in comments (this edit was inserted on Mar 30 at ~6).

So, what is this whole concept? And which term push-up/pull-up is correct?

Also, with reference to that circuit above -

  1. What is floating pin?
  2. How does R1 avoid a shorted circuit? Why does it count as short cicuit & not closed circuit. After all GND is a sink.
  3. Is a short circuit serious problem at mere 5V

I have already read:

But I still don't quite grasp it.

\$\endgroup\$

marked as duplicate by Daniel Grillo, Ricardo, Rev1.0, Vladimir Cravero, Passerby Apr 5 '15 at 0:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Can you expand on #2 ? I don't understand your question \$\endgroup\$ – efox29 Mar 30 '15 at 5:49
  • 2
    \$\begingroup\$ electronics.stackexchange.com/questions/135723/… \$\endgroup\$ – Golaž Mar 30 '15 at 5:57
  • 2
    \$\begingroup\$ See also electronics.stackexchange.com/a/23647/4512 for a discussion on how to decide the pullup resistor value. \$\endgroup\$ – Olin Lathrop Mar 30 '15 at 14:32
  • 1
    \$\begingroup\$ I'm certain there must be a canonical FAQ question about this somewhere. If not, then maybe we should create one :) \$\endgroup\$ – Lundin Mar 30 '15 at 15:29
  • 3
    \$\begingroup\$ "Push-up" describes an exercise for upper body muscles. I've never heard about a "push-up" resistor. Besides such term would make as much sense as trying to push something with a rubber string. One can pull with a rubber string (up or down), but not push. \$\endgroup\$ – Nick Alexeev Mar 30 '15 at 17:03
26
\$\begingroup\$

"Pull-up" is used more often in circuit design than "push-up". But I would imagine anyone would understand you either way.

The pull-up resistor isn't increasing the voltage. It's simply connecting the 5V supply that already exists to the digital input pin of the Arduino. Digital input pins are designed to have very high internal resistance, so extremely little current will flow into the pin. If very little current is flowing through a resistor, the voltage on either side of the resistor will be about the same. So R1 will have approximately 5V on both sides of it. That means, most importantly, the voltage at the input pin will be 5V when the switch isn't being pressed.

Note: The arrows represent the current flow.

schematic

simulate this circuit – Schematic created using CircuitLab

Whenever the Arduino measures the state of the digital input pin, it can only choose one of two options: high or low. Some external device must be connected to that pin (in your case, a switch) to apply either a high voltage or a low voltage.

But what if there's nothing connected to the pin? You might be tempted to say it should read as a low voltage. Unfortunately, that's not correct. We call this condition "floating". The pin is not being actively driven high or low by an external device, so it's just floating in an unknown state. This is dangerous because the Arduino still must choose high or low when it measures the pin. It can't choose "neither" as an option. Which one will it choose? Who knows. In fact, the physical metal pin itself will act as a tiny antenna and may be affected by any nearby electrostatic field. Simply moving your hand in the vicinity of the chip may cause it to change states sporadically. Moral of the story: NEVER leave a digital input floating.

The sole job of the pull-up resistor is to prevent the pin from floating when the switch isn't being pressed.

Once the switch is actually pressed, the 5V supply has a path to ground through the pull-up resistor and the closed switch. But the resistor will limit the current to a reasonable amount, which avoids a short to ground. Using Ohm's Law, the voltage at the bottom of the resistor will now be very close to 0V. Since that's where the digital input pin is connected, the Arduino will read a low voltage. Now the firmware programmed into the Arduino can safely read the status of the digital input pin and determine when the button is being pressed.

schematic

simulate this circuit

So why don't we just connect the 5V supply directly to the digital input pin and forgo the pull-up resistor? As you indicated in your question, that will cause the 5V supply to short to ground when the switch is pressed. Depending on how big the power supply is, it could cause a massive current flow through the switch. It could damage the power supply and possibly melt the button. At the very least, the power supply will brown-out or black-out and the supply output will drop to nearly zero. If the power supply has smarts in it, it'll simply turn off. So yes, a short to ground is a serious problem at a "mere 5V".

schematic

simulate this circuit

\$\endgroup\$
  • \$\begingroup\$ i woe you a lunch/dinner! :D \$\endgroup\$ – Hilton Khadka May 10 '16 at 21:05
3
\$\begingroup\$

The correct term is pull up. I have never heard of push up, but I suppose it does mean the same thing.

  1. A floating pin is one that has no associated voltage. A piece of wire not connected to anything is floating.

  2. See below.

  3. This one is tricky. It depends on the context. And by the looks of your question a short circuit can mean that a voltage is shorted to ground. THIS is bad. Very bad. Do NOT do this. Even 1V shorted to ground is bad without a resistor.

You can think of a voltage source as a fixed voltage with varying current. Meaning that the supply will give as much current as it needs to in order to maintain that 5V.

The problem with shorting voltages to ground is that the supply wants to give some voltage (with respect to ground). But the voltage output is 0V (because its tied to ground). So what does the power supply do to get to its voltage level ? It increases the current. Current then increases, but the voltage is still 0, so it keeps increasing and increases. Other circuitry will not be able to handle this, and they heat up and blow. The PCB traces or wires you are using can't handle this, so they heat up, catch fire, or just break open.

How do you fix this problem ? Add something in between to control the current to safe value. Add a resistor (which is the answer to #2).

By adding a resistor, the supply doesn't have to give infinite current (or practically, what its limit is) because the resistor says "Hey! Slow down!".

\$\endgroup\$
  • \$\begingroup\$ I think your loose paragraphs answered #2. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 30 '15 at 6:01
  • \$\begingroup\$ @efox29 thanks for the great answer, I wish I could accept 2 answers :) \$\endgroup\$ – RinkyPinku Mar 30 '15 at 11:56
1
\$\begingroup\$

Since others have addressed the pullup resistor, I will just highlight the dangers of a mere 5v.

A while back I scraped an old sun computer, and kept the power supply for a while. It had 5v output. I accidentally shorted it. The 100+ amps flowing through the short arced eating away the contact point by about 1/8th inch before the fuses melted.

So, what happened? It was a big power supply rated for over 100 amps at 5v during normal operation. As the resistance dropped the current increased until it both started arc corrosion of the copper contact and exceeded the current rating of the power supply by a large enough margin to fail. Remember that if \$i={v\over r}\$ and \$v=5\$ then \$\lim_{r\to0}{5\over r} = \infty\$ Fortunately there are other limits on the current.

\$\endgroup\$
0
\$\begingroup\$

The simplest answer to the above question is "a pull up resistor is added just to keep the pin to one particular state rather than it to be in a floating state". This is because when the pin is floating the the marginal drift in the high impedance voltage may consider it to one particular state(either high or low). So always preferred to have a pull-up resistor for such pins.

\$\endgroup\$

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