Analog Keypad



What a Gaming Keypad with an Analog Stick. What this device is a small auxiliary keyboard that is created specifically for gaming. The keypads posses a limited number of original keys being arranged in an ergonomic design with common keys such as ‘W,’ ‘A,’ ‘S,’ ‘D,’ and the keys close and adjacent to. ADI Global Distribution is the industry’s leading global distributor of security, AV, and low-voltage products.For more than 25 years, professional contractors, dealers and installers have relied on ADI for products and solutions as well as knowledge and support for projects and value-added services like industry training. The “analog” label is what makes the Wooting One standout. It is its main feature along with some other useful features. Design: The design is a standard tenkeyless keyboard without a number pad. I had no gripes or problems with the design, although a number pad would have been a nice addition.


Digial keypad on the left. Analogue keypad on the right.

Battery, analog: Up to 4 350 Ω load cells, 5V Excitation Keypad 8 function keys, 4 navigation keys, 12-key alphanumeric keypad, On/Off button Memory Battery-backed internal Communication Options Standard COM1 RS-232, isolated Option Slot 1 COM2 RS-232/485, isolated COM2 + D I/O RS-232/485, isolated + 2 inputs and 4 outputs (analog version only). DIY Single Pin Analogue Navigation Keypad. Here is a simple keypad set up on a breadboard. The wire from the button switches goes to A0 on the Arduino. I used 2.2K ohm resistors because it is what I had but other values can be used as long as they are large enough. 1K and 2K work as well.

When I first started building the dropController and the camController I could not find suitable navigation keypads, the ones I did find were expensive or not really suitable, so I built my own. These were simple keypads and follow the normal wiring for press button switches. This means each of the push button switches is wired to a separate pin on the Arduino. This obviously means you need 5 pins. This was fine until I wanted to add extra solenoid valves and realized I didn’t have enough spare pins.

I starting looking for pre-made keypads again and came across the Keyes Keypad on Taobao. These are cheap and smaller than the keypads I made. They also use a single pin. These are analogue keypads that use a single analogue pin on the Arduino.


The main difference between the digital keypad and the analogue keypad is how the keys are read and how the returned value is used. For the digital keypad you need to check each pin/key separately. For example. If left_key is pressed, if right_key is pressed. The analogue keypad uses a single variable which has a different value depending on the key pressed. For example. if Keypress is left, or if keypress is up. I found this a little easier to work with but it can be written anyway you wish.

Analog Switch Keyboard

Digital Keypad

The wiring for each button switch is fairly simple. There is a GND wire with a 10K pull down resistor, a VCC/+5V wire and a data wire that goes to an Arduino digital pin. The pull down resistor gives you a reading of LOW when the button switch is not pressed. When pressed the 10K resistor is bypassed and the reading is HIGH.

Keypad analog pin

Both diagrams are the same. Internally, the left and right sides of the switch are joined together. This can be seen from the schematic icon used for switches:

Making a keypad is just a case of adding more buttons.

Here is the layout I use:

There are many resources on the net and the Arduino site has a good introduction: http://arduino.cc/en/tutorial/button

I use Alexander Brevig’s button library for detecting key presses. Whatsapp sniffer official website. This makes the code simple. At the start of the sketch you define which buttons are on which pins and if you are using pulldown (to GND) or pullup (to +5). I have always used pulldown.

Later in the main body of the sketch you can detect key presses with a simple one line statement. Thrall kills garrosh.

This returns TRUE of FALSE and can be used in a variety of different ways. For example:

The library allows you to detect such things as unique key presses and the current button state (up or down) as well as others. The library can be found in the Arduino playground at http://playground.arduino.cc/Code/Button

Analogue Keypad

The analogue keypad produces a different voltage or analogue value depending on which key is pressed. This can be read by a single analogue pin on the Arduino. In theory this is slower than using digital pins but I have not noticed any difference and I have found that the analogue routine I use (copied from the interweb) gives a more positive response than the one I use for the digital keypad. I still get a lot of bounce and false presses with the digital keypad (not that I really did much to fix it).

I buy the analogue keypads from Taobao in China but they are also available from ebay. It is fairly straight forward to make your own, the switches are arranged in the same way as a voltage divider (or because we have 5 switches I think it is a voltage ladder).

DIY Single Pin Analogue Navigation Keypad

Razer Tartarus Pro Ffxiv

Here is a simple keypad set up on a breadboard. The wire from the button switches goes to A0 on the Arduino.

I used 2.2K ohm resistors because it is what I had but other values can be used as long as they are large enough. 1K and 2K work as well.

Keypad tester sketch

The below sketch reads the analogue pin and outputs the value to the serial monitor.

Using 2.2KΩ resistors I get the following values:.
– No button pressed = 1021 to 1023
– First button = 14 or 15
– Second button = 72 or 73
– Third = 124
– Forth = 170
– Fifth = 212 or 213

Due to tolerances in the components you are very likely to get slightly different values.
Setting the pullup resistor on the analogue pin means it is putting a +5v (in reality is is slightly lower) on the pin which means when no button is pressed the pin reads about 1023.

You may notice that the first button switch causes a direct short from A0 to GND. The pullup resistor on the pin protects the Arduino from a short and the actual current flowing is only around 1 milliamp.

Moving the GND connection to the other end of the circuit simple reverses the values each button switch gives. i.e. pin one now gives 212 and pin 5 gives 14.

Keypad Analog Stick


In the sketch we could just use the value returned from the analogread() but a better way would be to use direction labels. This allows you to write things like if (buttonPressLEFT) {}, or if (buttonPressDOWN) {}.

Run the sketch, open the serial monitor and you should now see something similar to:

Further Resources

There is another fairly simple example on the tronixstuff website Using analog input for multiple buttons. This is very similar to mine.
An example that uses different value resistors can be found at http://arduino-info.wikispaces.com/Keyboards-MultipleButtons. I believe this is how the pre-made keypads I buy are configured. Different value resistors spread out the range of key press values more evenly.

I am running out of digital pins on my Pro Mini. However, I am not using any of the analog pins. Can anyone think of a reason why I could not use the analog pins for a keypad?

I can’t think of any way to use them with a matrix keypad, but I should be able to connect up to 8 discrete buttons, no? Supply Vcc to one side of the button, and then read the analog input for voltage with a pulldown to pull the input low when the switch is open?

Razer Analog Keypad

Or would it work better with pullups so the input is always in a known state (high when switch is open, low when it’s closed)?