# What is the purpose of the 10kΩ resistor in this circuit? [duplicate]

Below is a simple circuit involving an Arduino, a push-button, and an LED. However, I don't quite understand what the purpose of the resistor is. Wouldn't the circuit function without it? Note: Since this question is concerning the behaviour of the circuit rather than the functioning of the Arduino, I've posted this here instead of the Arduino stack exchange.

• Very nice drawing, but we prefer schematics as they are easier/faster to read. There is a built in editor on the spaces where you can write your question. – Wesley Lee Apr 22 '18 at 18:57

It's a pull down resistor, its purpose is to set the voltage of the Arduino input to 0 V when the button is open. It just set a default voltage value to the connected node.

But, why such a resistor in needed? Well, when the button is open, the voltage is not totally equals to zero due to antenna effect or surrounding component. It is then possible that the Arduino input is trigger for no reason.

Note that the value of pull up or pull down resistors use to be around 10k - 100k. If the value is to low, it's going to draw to much current when the button is close. If the value is too high, the resistor will behave as an open circuit, making the pull down resistor useless.

• Simply call it "floating" :) – Long Pham Apr 22 '18 at 15:02
• Even absent crosstalk, there's no reason that the voltage would change to zero when the switch opens. The intrinsic capacitance in the GPIO pin would tend to hold the voltage, and that will slowly drift due to non-zero leakage current. Depending on the direction of that current, it could drift down toward 0V but could also drift upwards. – Ben Voigt Apr 22 '18 at 17:22

This looks like a pull-down resistor.

a pull-[down] resistor is a resistor used to ensure a known state for a signal.

[They] are used in electronic logic circuits to ensure that inputs to the [microcontroller] settle at expected logic levels if external devices are disconnected or high-impedance. 'Just because you have nothing at all connected to an input pin doesn't mean it is a logical zero.'

[D]igital logic circuits have three logic states: high, low and floating (or high impedance). The high-impedance state occurs when the pin is not pulled to a high or low logic level, but is left “floating” instead. [...] a microcontroller might unpredictably interpret the input value as either a logical high or logical low. Pull-[down] resistors are used to solve the dilemma for the microcontroller by pulling the value to a logical [low] state

By the way, as your LED seems to lack a current limiting resistor, it will likely burn out pretty quickly, unless it has some integrated current limiting circuitry that is not visible in the drawing.

• @uhoh Except link-only answers are not so valuable on SE since links often die or change. – Todd Wilcox Apr 23 '18 at 16:41
• In my defense, I don't think anyone expects Wikipedia to go away anytime soon. But yes, it did enter my mind. Would it help if I quoted some of the key points from the links? – Dampmaskin Apr 23 '18 at 17:00
• @Dampmaskin that's the ideal answer at least, a nice concise, clear explanation together with helpful supporting links. – uhoh Apr 23 '18 at 17:10
• I have now inserted quotes/paraphasings from the sources, to increase its long term usefulness. – Dampmaskin Apr 23 '18 at 17:40

People tend to think that undefined is equal to zero. Compare it to something in a store that has no price label: customers will joke it is for free (\$ 0.00), but it is not: the price is unknown.

It is the same with voltages/potentials. If the button is not pressed (not conducting) the potential on input 7 is not defined. It is tempting to say it will be 0V, but there is no reason for it to be. By connecting it to 0V (gnd) trough a resistor it suddenly is defined: there is no current (where would the energy come from), so the voltage over the resistor must be 0V as well. 0+0=0V.

If we replace the resistor with a short circuit the voltage would be zero as well, as long as the button is not pressed (not conducting). But what would happen once you press the button? The left side of the button is at 5V, the right side at 0V (gnd). The result is a short cut: the maximum current will flow from 5V to the gnd and you still do not have a defined voltage at input 7.

• You say "shortcut". Did you mean "short circuit"? – longneck Apr 23 '18 at 14:26
• This is the clearest correct answer. – Reversed Engineer Apr 23 '18 at 16:38

Pull-down resistor in a digital circuit can be seen in the figure. A pushbutton switch is connected between the supply voltage and a microcontroller pin. In such a circuit, when the switch is closed, the micro-controller input is at a logical high value, but when the switch is open, the pull-down resistor pulls the input voltage down to ground (logical zero value), preventing an undefined state at the input. The pull-down resistor must have a larger resistance than the impedance of the logic circuit, or else it might be able to pull the voltage down by too much and the input voltage at the pin would remain at a constant logical low value – regardless of the switch position.

Taken from below site Read more http://www.resistorguide.com/pull-up-resistor_pull-down-resistor/

• The OP is asking about the pull-down resistor connected to the switch. He hasn't shown (or asked about) the required current-limiting resistor in series with the LED. – Peter Bennett Apr 22 '18 at 18:05