Introduction: Keypad Access 4x4 With Arduino

Picture of Keypad Access 4x4 With Arduino

The 4x4 keypad is a composite of 16 keys arranged like a matrix. The method used for accessing 4x4 keypad with matrix scanning method. The 4x4 keypad requires 8 pins to access it, ie 4 pins for the columns and 4 pins for the line. How the scanning method works is that the column pin takes the LOW logic interchangeably, then the line pin performs the readings in turn as well.

Step 1: Materials You Need

You will need:

  • Arduino
  • Keypad 4x4
  • Jumper Wires

Step 2: Pin Out

  1. PIN A3 --> pin to 0 row
  2. PIN A2 --> pin to 1 row
  3. PIN A1 --> pin to 2 row
  4. PIN A0 --> pin to 3 row
  5. PIN 4 --> pin to 0 colomn
  6. PIN 5 --> pin to 1 colomn
  7. PIN 6 --> pin to 2 colomn
  8. PIN 7 --> pin to 3 colomn

Step 3: Schematic

Picture of Schematic

Connect each component as the picture above.

Step 4: Code

#include <Keypad.h> //import library keypad
const byte ROWS = 4; //number of colomn
const byte COLS = 4; //number of row
char hexaKeys[ROWS][COLS] = {
byte rowPins[ROWS] = {A3, A2, A1, A0}; //pin used for row
byte colPins[COLS] = {4, 5, 6, 7}; //pin used for colomn
//initialization variable
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
void loop(){
 char customKey = customKeypad.getKey();
 if (customKey){

Step 5: Output

Picture of Output

Check the output!


About This Instructable




Bio: Electronics Component - PCB [Design, Printing, Inserting] - Electronic Programming
More by sfeelectronics:Display Temperature on P10 LED Display Module Using ArduinoKeypad Access 4x4 With ArduinoDisplay Text at P10 LED Display Using Arduino
Add instructable to: