2

Being just a beginner I'm really getting confused of pull-down resistors. Please have a look at the diagram below. Here there is a 10k pull down resistor is connected to ground and the pin 2 of arduino. Whats really the purpose?

Is it really to avoid shorting between the 5v and ground?? So if there is a LED (load) in the circuit when the button is pressed do we really need the pull-down resistor?

Also if the button is connected to an external source (5v battery) do we need a pull-down resistor in that case as well??

One more question, if I have 5 buttons to pin 1-5, So do we just need a common pull down resistor say 100k for the 5 buttons?

enter image description here

Sandeep Thomas
  • 639
  • 9
  • 20

2 Answers2

5

Is it really to avoid shorting between the 5v and ground?? So if there is a LED (load) in the circuit when the button is pressed do we really need the pull-down resistor?

A pull-down or pull-up resistor is used to give a floating pin a defined potential. Sometimes it's also used as driving source for serial communications as usually controller pins are better in sinking than in sourcing.

Also if the button is connected to an external source (5v battery) do we need a pull-down resistor in that case as well??

The type of source doesn't matter.

One more question, if I have 5 buttons to pin 1-5, So do we just need a common pull down resistor say 100k for the 5 buttons?

You cannot have a common pull-down because that would mean that you have all input pins connected together, just draw the corresponding schematic and you'll see the problem.

po.pe
  • 2,548
  • 1
  • 10
  • 25
  • THanks a lot friend.. that make sense... Sorry I didnt understand clearly the answer for the first question... – Sandeep Thomas Jan 06 '20 at 10:28
  • 1
    @SandeepThomas The key fallacy beginners often fall for (in my experience at least) is that a pin not connected to anything is at 0V. Not connected to anything, so can't have any voltage on it, right? For various reasons, that's not true - if it's not connected to anything, it's actually at an *undefined* potential, which clearly causes issues if you're expecting it to be at a certain voltage. The pulldown (or pullup) resistor keeps the pin in a known state, while also having a high enough resistance so as not to cause excessive current draw. – berry120 Jan 06 '20 at 18:32
  • 1
    @berry120: A better way of explaining things may be to view such a pin as an electric field detector. If one builds a high-impedance voltage follower and attaches the input to e.g. a piece of foil, putting one's hand near the foil will often cause the detected voltage to change. A pin which is neither pulled up nor pulled down will be influenced by such fields, in ways that are likely to be neither useful nor predictable. – supercat Jan 06 '20 at 20:27
5

A pull down resistor is not to prevent a short circuit. Your diagram is quite minimal, but a pull down (or up) resistor is used in the following situations:

  1. You connect something to an input pin. When the switch is open (or no closed circuit,) the input pin will get values between 0 (GND) and e.g. 5 (VCC) volts and anything in between. With a pull down or pull up resistor, you can force it the input pin to be 0 V or 5 V. Mostly when you use a switch, you want to have a pull down resistor, so when the switch is open, the input pin gets a value of 0 V and not a 'floating' value. Without a pull down resistor, the input pin is called a so called floating pin.
  2. During the startup of the Arduino the pins are not initialized, and an output is not defined. To be sure it is 0 or 5 V, you can use a pull down or pull up resistor.

The other questions are already answered by po.pe.

Another comment about the value of the resistor. It should be strong so it is pulled down (or up) enough, but notice that when you use a pull down resistor and the switch is open, it will use a very slight amount of current/power. This might be noticeable when you use it with batteries and need many of these resistors.

JRE
  • 67,678
  • 8
  • 104
  • 179
Michel Keijzers
  • 13,867
  • 18
  • 69
  • 139
  • 1
    Thanks a lot for that information. But little confused.. because when the circuit is open how the pin gets some floating value since thats not connected to anything? – Sandeep Thomas Jan 06 '20 at 10:26
  • 1
    That's exactly the definition of a floating value, there's no such thing as "no potential" – po.pe Jan 06 '20 at 10:41
  • 1
    Like po.pe mentions, there is always a voltage on a pin. Try to put a multimeter on a floating pin (no pull up/down resistor) and check for yourself. Than try a pull down (to GND), and pull up (VCC), which a switch in between (to either 0V or VCC). – Michel Keijzers Jan 06 '20 at 11:18
  • I think it's worthwhile to mention the impedance state of the input pin, and drawing a schematic with an infinite resistance in place (or in series) of the input pin might help get the point across. A (cheap) voltmeter might actually have low enough impedance to act as a pulldown. – Brydon Gibson Jan 06 '20 at 19:05