Arduino momentary switch wiring questions

It’s “simple” tasks like these that make me realize I remember much, much less from the 6 weeks of circuit design I took in college than I wish.

OK, all I’m trying to do is get 5 switches wired up to the digital inputs on an Arduino Uno. I’ve tested these switches and they’re NO. The issue is that when I press a button, it resets the Arduino.

Here’s how I have them wired up. Ignore the multiplexer, I just needed something to represent the inputs.


I’ll cop to not understanding at all what the 10K ohm resistor is bringing to the party here. It seems like when the button is pressed the current is just going to follow the path of least resistance into the input, which could very well be why it’s rebooting. But this seems to be how the internet says to wire them.

Help me, I feel stupid. Thanks!

I don’t know the answer to your question but I suspect it doesn’t lie in the circuitry you have shown here.

The 10K resistor is a pulldown resistor. It keeps the inputs low when the switches are open. When a switch is pressed, the corresponding input goes high. Without the 10 K resistor, when a switch was pressed it would short the supply to ground and the input would stay low.

I’ll admit to acting like I know more about electronics than i really do, but doesn’t this diagram show that all of your switches are wired together on the ground side? When you press SW1, what’s preventing the current from flowing to all five inputs in parallel?

Nothing !
If any of them are connected to the reset pin, then any switch will reset it.

OK, well that’s a good observation :slight_smile:

Nothing is connected to a reset pin. But… when I unplug ALL of the switch pins from the digital inputs, it still resets on a button press…

Gotta scratch my head a bit on this one.

When you push a button the board resets, even when the button is not connected to the board at all?

Not to the digital input pins, it’s just connecting +5V to GND through the 10K ohm resistor.

Are you sure it’s 10k?
You could also try configuring the inputs as INPUT_PULLUP and putting the other side of the switches to GND instead of +5V.

Hmm… it might be blown. The one I installed is measuring 0 ohms while the rest of the pack is measure 10K…

eta: Not sure if that’s even something that can happen or if there’s another reason I’m not measuring any resistance. There’s no sign of damage or anything.

Well that sounds like you’ve somehow wired the swtiches through the Arduino’s own power supply, and when you close the switch you’re just shorting out the power to the Arduino?

I think you have more than one problem here. In addition to your reset issue, the way that the circuit is currently drawn, if none of the switches are pressed, then all of the inputs will be pulled down to 0 volts.However, if any of the switches are pressed, then ALL of the inputs will be pulled high.

You need to electrically separate the switches and have a pull-down resistor for each input.

Are all of the pins configured as inputs? If any of the five are set as outputs, you could plausibly see a reset. Also, as ecg notes, the circuit doesn’t work–the pins are all connected together. So pressing any of the 5 buttons would cause a problem, even if it were some other pin that was misconfigured.

Agree. But I am a bigger fan of pull-up resistors vs. pull-down resistors. Reason being: with a pull-down resistor, any short to ground - accidentally, intentionally, or due to a failure - will result in the power supply being shorted. Not good. A pull-up resistor offers better fail-safe protection. (Of course, there is a difference in the polarity of the signal. But hopefully the firmware can be programmed to accept either.)

It would be strange for a resistor to fail like that. They usually open, like a fuse.

Thanks for the guidance everyone! Just to close the loop, aside from the problems pointed out above, the small prototyping PCB that I bought at MicroCenter to use as a common +5V and GND rail wasn’t just a bunch of unconnected holes, but the rows were actually internally connected (ironically for the specific purpose I wanted.) I just assumed that since I couldn’t see any printed connections that there wasn’t anything going on in the internal layers… very dumb of me.

Anyway, the result of that was that my resistor was effectively doing nothing, which is why it measured 0 ohms when installed. I moved the connections to different rows, added a resistor for each button, and now I’m back in business.

Thanks again for all the replies.