4×4 Keyboard for Arduino




In Arduino app system, keyboard is one of the indispensable component to man-machine dialogue. When the button is less, we can connect the button to the I/O port of Arduino. While there need more button and the I/O resource of Arduino is limit, it is better to choose the matrix keboard. Next I will demo that use the 4 * 4 keyboard on Arduino.

The original post :

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Part List

1 x Arduino UNO  
1 x 4*4 keyboard
8 x Wire 

Step 2: Wiring Diagram

Step 3: Test Code

#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;

//define the symbols on the buttons of the keypads
char Keys[ROWS][COLS] =

byte rowPins[ROWS] = {2,3,4,5};
byte colPins[COLS] = {6,7,8,9};
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad(makeKeymap(Keys),rowPins,colPins,ROWS,COLS);

void setup()
  Serial.println("Please press the keyboard:");

void  loop()
  char key = customKeypad.getKey();
    Serial.print("Key Value : ");

Step 4: Run Test

(1) Connect the wiring according to the wiring diagram

Figure 1

(2)Download the Arduino library in attachment and save it to the Arduino IDE libraries:

Figure 2

(3)     Open the ArduinoIDE and put the test code into the IDE, compile and download:

Figure 3

(4)Open the serial Monitor, set the baud rate to 9600, press any key and you will see the corresponding key value in the monitor;
Figure 4

Step 5: Download

Arduino Library:keypad

1 Person Made This Project!


  • CNC Contest

    CNC Contest
  • Make it Move

    Make it Move
  • Teacher Contest

    Teacher Contest