I'm referring to the 5th circuit (see below screenshot) of the sparkfun manual came with the arduino uno. Instead of connecting all three of the (+) (-) and the digital pin to each push button, can I just connect the (-) through the resistor and the digital pin?

Also a side question, in terms of physics, you need two ends to be connected in order to create pressure for the flow of electrons, but the digital wire for each push button that goes out to the arduino board doesn't have its own ground wiring that suppose to create the pressure as a couple. How to cope with that in terms of electron flow?

enter image description here

  • You need two connections to the switch, but the pullup resistor requires a voltage source, which is a third connection. You can place the pullup either at the switch, or at the ditial pin, or somewhere in between. You may be able to use internal software-configured pullups instead. All currents have closed paths - but they may be sharing a path with a current headed elsewhere, for example, when you close a switch a small current discharges the pin capacitance, sharing the ground path with a larger one flowing through the pullup resistor. Commented Nov 28, 2015 at 19:04
  • So can i just connect the (-) with the resistor?
    – Andy
    Commented Nov 28, 2015 at 19:19
  • No, you cannot, as then you would not have any signal line. Commented Nov 28, 2015 at 19:35
  • i meant i kept the signal line, along with the resistor which connects the ground node
    – Andy
    Commented Nov 29, 2015 at 0:50
  • The resistor does not connect to ground. Commented Nov 29, 2015 at 2:49

2 Answers 2


You can use the internal pullup e.g.

pinMode(inPin, INPUT_PULLUP);

Then wire your switch between pin and Gnd.


In order for an input pin to be able to read a real value it must be connected to something - either a power source (Vcc) or to ground. If it's not connected to either of those and left "flapping in the breeze" then it's said to be floating and the input value cannot be determined.

So you need a way of switching that input pin between being connected to Vcc or being connected to GND. That is why there are three wires - the input pin and the two voltage levels that must be chosen between.

Now an input pin has a very high resistance (impedance) to ground. So when you connect it to Vcc a very tiny current will flow through it to ground, thus completing a circuit. If you add another resistance between the pin and Vcc the incredibly small amount of current that flows will only cause the smallest of voltage drops across that new resistor (see Ohms Law). So connecting the input pin to Vcc through a 10kΩ resistor (for example) will mean the voltage read at the input pin will be only fractionally below the +5V of Vcc.

Now when you introduce the pushbutton, which connects the input pin to ground when pressed, will also connect the resistor to ground. So you have the full 5V of Vcc across that resistor, and the input pin will be reading 0V.

Without the resistor in there - if you just connected the input pin to Vcc and then had the button connecting to ground - as soon as you press the button it would connect Vcc directly to ground, which is a really really bad thing to do. That's called a short circuit, and it's when batteries start to explode and wires melt.

So the input pin itself is basically a voltage detector that detects what the voltage at the input pin is. It has two thresholds known as VIH and VIL - the input logic voltage for HIGH and LOW respectively. On the Arduino those are 0.6Vcc and 0.3Vcc - or 60% of the supply voltage for high, and 30% for low. At 5V that's 3V and 1.5V respectively. If the voltage seen at the input pin is above 3V then it's seen as being HIGH. If it's below 1.3V then it's seen as being LOW.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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