Would any buttons just work with Arduino?

I want to get a push button that looks cooler than the one that came with my Arduino Starter kit, but I'm not sure if any kind of buttons will just work.

I went to a local electronics store and they had different kind of buttons. Many of them are way larger than the one that came with the Starter Kit. The button that came with the Starter Kit has 4 leg pins, but I usually use only 2 of them. The buttons I see in the store have a variety of number of pins. Some buttons have 2 pins, some have 4 and some have more than 4. Some buttons are huge and I'm worried that they are not compatible.

I'm new to electronics. How do I determine if a button would work with Arduino? Would something like this one (picture) work? Is there anything I have add or take note of for these buttons to work?

Pretty-much any button or switch will work... A switch simply makes or breaks an electrical connection. I'll give you some basic information and let you research the schematics & details...

If you don't already have one, I recommend that you get a multimeter. By measuring resistance (Ohms) you can see exactly what a switch is doing. And in general, its almost impossible to do any testing/troubleshooting without one. You can find them online starting at around $10 USD.

The most basic switch is SPST (single-pole single-throw). It has 2 contacts. That's like a regular light switch in your house (not a "3-way" switch). In one position it's on (the contacts are connected when the switch is on, and open (disconnected) when off.

The most common type of pushbutton switch is "momentary". The contacts are closed (on) when you push the button, and off when you release it. There are also "on/off" pushbutton switches that go on and say on when you push it, and go off and stay off when you push it again.

An SPDT (single-pole double-throw) switch has a 3 terminals. There is a common (middle) terminal and two switched terminals. In one position/state the common is connected to one of the other terminals, and in the other position the common is connected to the other terminal. The two switched (outside) terminals are not connected together in either switch position. (A "3-way" switch in your house is an SPDT. That's where you have a switch at the top of the stairs and another at the bottom, and either one can turn the lights on or off... The wiring is a little tricky and you'd have to look it up.)

If you have a momentary SPDT switch, one of the terminals will be labeled NO (normally open). This terminal and the common operate exactly like a regular SPST momentary switch, on when the button is pushed. The other terminal is labeled NC (normally closed). The NC and common are connected when the button is not pushed, and opened when the button is pushed.

A DPDT switch is two SPDT switches operated together by one button or one toggle. It has 6 terminals.

There are many other special configurations but that should cover 90 percent of what you'll run into.

Relays (regular mechanical relays) are electrically operates switches and they come in the same basic configurations. Except that normal relays are all momentary... When you remove the coil voltage, they return to their "normal" state. The most common relay configuration is DPDT.

There are push buttons with

  • single output, contact is ON only when you press),
  • double output.
    With a double output push button :
  • when push button is release one output is ON and the other is OFF,
  • when push buttons is pressed : the output which were ON toggle to OFF and these who were OFF become ON

The bounces of these buttons can be deleted :

  • by hardware by adding a capacitor (100 nF) in parrallel on the contact button.
  • By software -> see example on Arduino IDE exemple

The second model (double output) can also be debounced with a RS flip-flop (see example in Wikipedia).

All of these solutions work, but the best solution is the one with the RS flip-flop but it needs a two output button.
Then this with the capacitor.
In my opinion the software solution, even if it works, is unsatisfactory because it masks the problem by adding delay so the two first suppress problem.

Thanks guys for the explanation. Just one thing, what type of a button is the one that came with the Starter Kit? The switch looks like this one:

Thanks guys for the explanation. Just one thing, what type of a button is the one that came with the Starter Kit? The switch looks like this one:

A simple momentary switch.