Using a Membrane Keypad with an Arduino

Membrane Keypad    Send article as PDF   
With this tutorial, you will be learn to access any keypad, and have it interact with a microcontroller. You can salvage these keypads from old telephones or you can purchase them from most electronics store for less than $2. They come in wide variety of shapes and sizes. The most commons sizes are 3×4 and 4×4, and you can get keypads with with words, letters and numbers written on the keys.


These keypads very popular among the Arduino tinkerers, as they are very cheap, and you can use them with any microcontroller (MCU).

Where to buy?

You can purchase inexpensive keypads from eBay for just a few dollars.

How it Works?

A membrane keypad is a matrix consisting of rows and columns. Each key is assigned to a certain row and column (see the picture below).

On a 12 button keypad you have 4 rows and 3 columns. The first key, ‘1‘ would make a link between Row 1 and Column 1 (R1C1). The ‘2‘ would be R1C2, ‘3R1C3, ‘*R4C1, ‘9R3C3, and so on.

How a keypad works

Arduino with Membrane Keypad

You need the following components to make this circuit:

  • 1x Arduino (eBay)
  • 1x Keypad (eBay)
  • Jumper Wires


Connect up the Keypad to the Arduino as per schematics below. If your keypad is different from the one below, try to search for the datasheet online.

Membrane Keypad + Arduino

Library Download

You will need to install the Keypad library into the Arduino IDE for this project:

  1. Download the Keypad library
  2. Unzip the Keypad library
  3. Install the Keypad library in your Arduino IDE by moving the unzipped folder to: Arduino\Libraries
  4. Restart your Arduino IDE

Uploading the Code

If your keypad doesn’t work with code below, you might have to change the connections from the previous schematics.

Search the web, or go to the store that sold you the keypad to source a datasheet for your keypad.

Note: If your keypad has more keys you can change lines 3 and 4 to add the right number of rows and columns. Then in line 5 you can change the array to match your keypad keys.


For this project, when you press a key, it’s value is displayed in the Arduino IDE’s serial montior. Below is what you should see in your Arduino IDE serial monitor when you start pressing the keypad keys.

serial monitor with arduino & keypad


Now you can create an interface for your Arduino using a keypad. You could also add an LCD to this project to display the key strokes, or perhaps build an electronic combination lock.

Previous Post

ESP8266 Web Server using Arduino IDE

In this project you’ll create a standalone web server with an ESP8266 Wi-Fi Module that can toggle two LEDs. Where to buy? You can click here to get this module ... Read more

Next Post

Using the HC-SR04 Ultrasonic Sensor with Arduino

The working principle of an ultrasonic sensor is simple and use high-frequency sound waves that are evaluated when the sensor received back the waves. To determine the distance between the ... Read more

Short URL:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!