How to interface Arduino with Keypad

Keypad is one of the most important components in an embedded system. The main aim of the interfacing project is to display the pressed key in the serial monitor window of the arduino IDE.

                           keypad interfacing with arduino

Components Required


Keypad is an arrangement of 16 push button switches in the form of 4x4 matrix. The keypad consists of numbers 0,1,2,3,4,5,6,7,8,9 and letters A, B, C, D,*, #.  R1, R2, R3, R4 represents the rows. While, C1, C2, C3 and C4 represents the columns of the keypad.

                                  KEYPAD WITH ARDUINO

Column scanning method is used to identify the pressed key.  Here, at first a particular row is kept low, while the other rows are made high.  Now, each column will be scanned.  If any column shows a low, it means that the key that comes in between the column and row gets pressed.  And the program registers the key being pressed. The entire process is repeated for other rows and columns.

For eg:

  • R1=LOW, C1=LOW: 1 is pressed.
  • R1=LOW, C2=LOW: 2 is pressed.
  • R1=LOW, C3=LOW: 3 is pressed.
  • R1=LOW, C4=LOW: A is pressed.


                             ARDUINO INTERFACING WITH KEYPAD

  • R1, R2, R3 and R4 are interfaced to digital pins 2, 3, 4 and 5 pins of the arduino respectively.
  • Columns C1, C2, C3 and C4 are interfaced to the digital pins 8, 9, 10, 11 of the arduino.


The program is used to check the key press.

The output and program is attached below. The program is attached as PDF......

keypad interfacing output

User Review (0)
Related Items