I can't find any tutorials online explaining how to wire and control a 16mm push button like the one in the picture:

enter image description here

Do you have any suggestions as to how use it with an arduino or a raspberry pi?

  • 4
    Just look up any tutorial on a button. For the arduino, it doesn't make a difference whether they're 1mm or 100mm wide.
    – PMF
    Commented Feb 9, 2021 at 17:46
  • 1
    – Juraj
    Commented Feb 9, 2021 at 17:52
  • it's just a switch ... pressing the button connects the two wires together electrically
    – jsotola
    Commented Feb 9, 2021 at 18:01
  • One might suggest that a button is not controlled by an arduino. The button is an input device to control the action of the board's programming. It is to be used on digital inputs (on/off) and usually with a debounce routine.
    – fred_dot_u
    Commented Feb 9, 2021 at 21:02
  • 1
    @fred_dot_u One could argue that it is controlled digitally though....
    – Majenko
    Commented Feb 9, 2021 at 21:13

1 Answer 1


A pushbutton is a pushbutton. It is a momentary switch. Since it has flexible wires, and needs a place to mount, you should probably wire it using a breadboard.

That pushbutton looks like a panel mount pushbutton. You might want to mount it in a pice of plastic or sheet metal. (Unscrew that nut up by the red part that you press. Measure the outside diameter of the threaded part. Drill a hole ≈1/64" (≈0.4MM) bigger than the switch diameter into the plastic/metal. Insert the pushbutton from underneath the panel. screw the nut back on to secure it. Tighten moderately tight with needle-nose pliers, being careful not to round off the corners of the nut.

To wire it:

Get a breadboard. Run wires from your Arduino to the breadboard.

Wire the pushbutton into the breadboard as well.

There are various libraries that offer switch debouncing, or you can write your own fairly easily.

I suggest using INPUT_PULLUP mode, and wiring your switch between an Arduino digital input and ground. When the switch is open, the input will read HIGH. When you press the the switch, the input will drop to LOW.

If you want to debounce the switch input yourself: When the switch changes state, note the value of millis(), and ignore any new changes for a brief period (try 20-100 mS).

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.