Comparative: Push Buttons, Arcade Buttons and KeypadsOctober 3, 2012

[Spanish Version]

Welcome to a new section in Cooking Hacks. As you can see in our Blog, we have added a main menu in order to offer an easier navigation. You will have a Comparative section in this menu where you will be able to find some interesting comparisons between products you can use in your projects. We hope you find it useful. Enjoy it!

In this first comparative, we are going to discover the most common buttons that we will be able to use in our Arduino projects, from the small push-button to the keypads or arcade buttons. Here you can find all the necessary information to include them in your next hack!

First, before analyzing the different types, you can remember in this tutorial how to connect a button to your Arduino using pull-up or pull-down resistors to avoid reading errors and a small example in which you can switch on a LED.


Button Switches for PCB

These buttons are commonly used in projects that we mount in a PCB (Printed Circuit Board), or in a Protoboard for those quick projects (prototypes) where they are needed. They are characterized by a small size and they are normally used for voltages under 12V.

The main types that can be found are:

  • Mini push button Switch-6mm: It is the smallest one with only 6mm square and with an immediate action (the circuit is closed only when the button is pressed). In the next image we can see its internal connections; they will be repeated in almost all the push button switches. Although there are four pins, it doesn't mean that it has two internal contacts. It means that we have the same contact in two different places. A trick to remember the common pins is to observe which ones are faced; if yes, they are communicated!

  • Push button Switch-12mm: It is exactly the same than the previous one but with a difference: the size is twice than the other (12mm square). If we have a project where we have to push many times, it will make this action easier.
  • Push button Switch 12mm with LED: It has the same size than the previous one but with a integrated LED Diode. This LED can give us many good experiences in our Arduino projects, because we can activate or deactivate it with a resistor and a digital signal. Do you dare to make a replica of the old SIMON game? The negative terminal of the diode will be plugged in the BN screen-printed pin and the positive in pin number 10. In addition, there is a Breakout Board ready to solder and integrate them in a very elegant way in your hacks!

Arcade push-buttons

This kind of push-buttons are perfect for your projects which require an intensive use. They are similar to those that, some time ago, were used for playing in those forgotten arcade, where your social status depended on your speed pushing buttons.

We can found them in two versions:

  • Simple Push-Button 33m: A simple contact that we can use, like the previous buttons, with our Arduino. But, if we need working with higher currents, this kind of buttons allow us a 24A! More than necessary  to our hacks!
  • Double contact button 33mm: Similar in appearance to the previous one, but with a double contact. If the button isn't pressed, we have the contact between COMmon and NC (normally closed). When we push it, the contact between common and NO (normally open) will be closed and the contact between common and NC will be opened. If we connect the common pin to our Arduino board, the NC pin to 0v and NO to 5v, we won't need a pull-down resistor to maintain stable the entry without false readings!


Touch sensors

The next  touch sensor that we show you is a capacitive one. This means that it is made by some sheets making as a capacitor whose capacitance  is altered approaching  a non metal object. When this capacitance exceeds a limit, a small controller makes as a switch allowing the current flow between the two terminals.

In this example, we can see a  Touch Sensor with a Twig connector.

A place where we can usually found them is in cook-tops or in our iPod!! It will be a key player as show its integration under a glass or other insulating material. They will still work touching the surface! Why can't we make an alarm control integrated in a mirror?


Panel push-buttons

This kind of push-buttons are normally used for mounting in boxes, control panels even like switches using push-buttons with lock state. Their strength and easy assembly due to their screwed body, make them the most durable in a daily use.

We can find several types:

  • Momentary push-button: It holds its state only when we push it.
  • Locking push-button: It will change its state each time that we push it. When we press it once the contact will be closed and, until we push it again, it won't be opened.
  • Illuminated push-button with interlocking: This kind of push-buttons have a very attractive design. As well as a luminous ring around the button, they have a double contact like in an arcade button. The button we have shown in this example is waterproof it can work perfectly in damp places. The luminous ring can be connected to 5v to 12v DC with a resistor to control its intensity.



The Keypads are very useful to control our projects. Making an infinite list of applications, like using them to enter passwords in an alarm, or as  a dialer with a 3G shield.

In this comparative we are going to study two types: a numeric keypad and a board with five buttons that we can control with only an Arduino output!!

We start with the numeric keypad.

To bring it into operation is very easy. A keypad is a connection-matrix arranged in rows and columns, from left to right and from up to down. That's why, if we press the number one, we connect the first row with the first column. If we press the number 0, we connect the fourth row with the second column... we can see it in the next picture:

The pins configuration is very easy: from left to right, you'll have the rows first and then the columns. It's possible that the configuration between keypads changed, that's why it is recommendable using a multimeter in continuity mode and observe in which terminals there is an union when we push a key.

In order to manage the combinations, we have the library  keypad.h: it's going to help us with programming. Here you can see an example about its uses and how to configure it.

Let's see the second type of Keypads.

The main problem of KeyPad is the big quantity of pins that they use. To solve this, if we have few free pins in our Arduino, we will have other useful keyboards. The first we have mentioned needs eight digital inputs, something difficult to do in some projects, that's why we have the ADKeyboard!!

ADKeyboard is a keyboard with 5 buttons that uses only one analog input for all of them! This is possible because, depending on the button we're pushing,  it will use one, two or more resistors changing the input voltage. It can be interpreted using a code in our Arduino.

Here you have an example of how to filter a signal to interpret which button  is activated in each moment. We also share a link to this tutorial where we can view how to read an analog input and how to convert an analog voltage to a digital value using the 10 bits analog/digital converter that Arduino has.

I hope you like this first comparative!

See you soon!!

//ADKeyboard Module
//Developed by
//Last modified 30/11/2011
//Version 1.0
int adc_key_val[5] ={50, 200, 400, 600, 800 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;
void setup()
  pinMode(13, OUTPUT);  //we'll use the debug LED to output a heartbeat
  Serial.begin(9600); // 9600 bps
void loop()
  adc_key_in = analogRead(0);    // read the value from the sensor
  key = get_key(adc_key_in);  // convert into key press

  if (key != oldkey)   // if keypress is detected
    delay(50);  // wait for debounce time
    adc_key_in = analogRead(0);    // read the value from the sensor
    key = get_key(adc_key_in);    // convert into key press
    if (key != oldkey)
      oldkey = key;
      if (key >=0){
           case 0:Serial.println("S1 OK");
           case 1:Serial.println("S2 OK");
           case 2:Serial.println("S3 OK");
           case 3:Serial.println("S4 OK");
           case 4:Serial.println("S5 OK");
// Convert ADC value to key number
int get_key(unsigned int input)
    int k;
    for (k = 0; k < NUM_KEYS; k++)
      if (input < adc_key_val[k])
            return k;
       if (k >= NUM_KEYS)k = -1;  // No valid key pressed
       return k;

Source: Arduteka

Leave a Reply