Detecting Multiple Switches/Buttons

I am using an Arduino Uno R3 with a 12v power supply funning a 12v motor. I have eight switches that don’t do anything, they are just either off or on and I need to be able to tell which ones are on at any given moment. I have found numerous discussions about various configurations with one resistor, eight resistors or even a different value resistor for each switch. Cautions about where to but the resistors - power side, ground side, before the pin, after the pin in order to avoid noise. And to twist the wires to avoid noise. Since I am packing all this into an 8" box I suppose noise could be a concern. Being a novice all this research has been a bit confusing.

So, my question is, does this look like it will work? Can I get away with using this few pins? (I have other things to use pins for)

Thanks for any insight you can offer.

Looks like you have your inputs connected to GND.


You can use the A0-5 lines as digital inputs.


Thanks for the Typical Switch Wiring diagram, I'll definitely keep that in my kit.

To my novice eyes it looks like my wiring example is equivalent to the S1 External Pull Down example except that I have my resistor on the wrong side of the switch (and it's not a high enough value)

Can I get away with using only one power wire, one ground wire and one resistor for all eight switches?

Does this look correct?

If you use S3 as the example, with the internal pull-up resistor, you only need the switches.

Tell us a bit more about the design.

What pins are going to be used?

If you need 8 switches, you could use a matrix type circuit. Like a keypad.

Will there ever be a time when more than one switch is pressed at a time?


I believe that you will need one resistor per input pin unless you go to a more sophisticated scheme like scanning (which may involve you in diodes).

What is the problem? Each input pin already has the power wire and the resistor internal to the Arduino and for free (see INPUT_PULLUP).

Doing it this way, you will only need eight switches with each switch wired to a different input, and one ground wire connected to all of the switches (on the other end from the input pin connection of each switch).

Follow the black, GND, line.
It is shorting all your inputs together.


Don't make things more complicated then they are. Just wire each switch from Arduino pin to ground (no 5volt, no 10k resistor). Like S3 in larryd's diagram.

Ground to one contact of all switches, the other contact of the switches to multiple pins. Leo..

Thanks Wawa. Makes total sense.

Thanks Larryd. I knew I came to the right place.

Enable the internal pull up resistor on the switchpins in void setup().

pinMode(switchPin1, INPUT_PULLUP);
pinMode(switchPin2, INPUT_PULLUP);

Post your code if you want help with that.