TUTORIAL ON 5X5 MATRIX KEYPAD

on Friday, 1 November 2013
It is necessary to know the working of  matrix keypad before we proceed on the project interfacing matrix keypad with the microcontroller. 
By its name '5x5 Keypad' means it consists of 5 Rows and 5 Columns, totally 25 keys. Look at the fig below which is the  general 4x4 keypad(24 keys) which we get ready made from market. 


keypad
It is very easy to get 4x4 matrix keypads from markets but difficult to find 5x5 keypads, but its very easy to make by our own.

Schematic diagram of 5x5 matrix keypad has been given below
5x5 matrix keypad

Note these points from the above fig.
  • Consists of 5 Rows from row1 to row5 and 5 columns from column1 to column5
  • Each button i.e switch has been connected one arm to one row and other arm to column i.e first button is connected to row1 and column1, 2nd button connected to row1 and column2 , 3rd button to row1 and column3 and so on...
All the rows and columns will be connected to microcontroller(we will see in next post). 
Suppose we make 'Row1' high and we press the 1st button  then column1 also becomes high because button's one arm is connected to row and other arm to column, when we press the button then both the arms will be shorted and current flows from row to column.  Look at the below fig to understand clearly, red color indicates the current flow during the button press. 

Similarly if Row1 is high and 3rd button is pressed then column3 becomes high,so on..
Now answer me, if i make Row2 high and pressed the 7th button then which column will be high?? 
Answer is simple, column which is connected to 7th button it will be high i.e column2. 
Now one more question if  column 3 is high and row 4 is high then say me which button has been pressed??? 
For answer look at the below fig. 

matrix keypad tutorial

Just look at the corresponding row and column to know which button is pressed, button marked in blue color which has been pressed.

If you understand this simple concept then you have successfully understood the working principle of matrix keypad.

HOW TO DETECT THE PRESSED KEY: 
First we make Row1 high, if the key is pressed then obviously one column will becomes high. Check which column becomes high, from it we know corresponding key has been pressed. If suppose key which has been pressed is not on the row1 then all columns will be low. 
Now make Row2 high and check all the columns, if we find any column high then we find corresponding key, again if the key is not on the row2 then we make row3 high and we check all the columns and if any one column is high then we find its corresponding key. Repeat it for all 5 rows....

Row1=1 => check columns => if column is high then take its corresponding key.
Row2=1 => check columns => if any column high take its corresponding key.
Row3=1 => check columns=> if any column high take its corresponding key
Row4=1 => check columns=> if any column high take its corresponding key.
Row5=1 => check columns=> if any column high take its corresponding key.

Note when one row is high we should make all other rows to zero. We repeat all of these steps at high speed so that we can detect all the pressed keys.

In our next post we will look at writing  code for detecting the pressed key and showing the same on the LCD display, click here

AUTHOR: YOUSTRON SIC




2 comments:

Armanelgtron said...

4*4=16, not 24. Not to judge or anything...

YOUSTRON SIC said...

Thanks for correcting me, im little poor at math... Hahaha ;-)

Post a Comment