DIYmall 4×4 Matrix Key Membrane Switch Keypad


What you need:
1 X 4×4 Membrane Switch Keypad
1 X Arduino Uno
1 X Jumper wires
1 X USB cable

4X4 Matrix Array Keypad Schematic

The wiring of 4X4 Keyboard with Arduino UNO R3 board is like the following picture:

You need install Keypad in your arduino IDE library if you not installed it before.

Click Sketch-Include Library-Manage Libraries, search “Keypad” and install it.

Open examples-Keypad and revise the code

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; // four columns
char keys[ROWS][COLS] = {
{‘1′,’2′,’3’, ‘A’},
{‘4′,’5′,’6’, ‘B’},
{‘7′,’8′,’9’, ‘C’},
{‘*’,’0′,’#’, ‘D’}
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){

void loop(){
char key = keypad.getKey();

if (key){

Choose board, COM port, and upload the code.


Open Serial Monitor window, and press the keyboard, the relative name of the pressed button will appear.

Here is the vedio link for your reference:


Purchase link for 4X4 Matrix Keypad:




Leave a Reply

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