How a keypad is working? How you can use it in your project? Introduction The keypad is a button matrix which the state (0 or 1) can be detected by a microprocessor such as an Arduino card. The keypad looks like a matrice, that’s mean each button of a column are linked as an input and each buttons of the same line is linked at a second input.When we press a button , it’s closing the line and the column of this button and that way the Arduino card knows which button you have pressed. The advantage of this matrix is that you can control 16 buttons with only 8 inputs of the Arduino card. How a keypad is working? The keypad is divided in two parts: lines and columns.On each button, there is an open switch on the line which give the LOW state and close the column to have a HIGH state.If we press one button, the switch will be reversed. That way the Arduino card will know which button has been pressed. This is an example: Here we have pressed the button 5. As we can see the column has a low state and the line at the high state.The Arduino card just has to meet to both to know that the button 5 has been pressed. To do a project with the keypad component you will need the keypad library. We will see how to install it. How to install the keypad library? The keypad library will be useful for every matrix of button.First you have to download it.Once the library downloaded, you have to open Arduino Ide and click on the sketch/include library and Add .zip library: Then you have to choose the library you have downloaded. At the end you have a notification if the library is correctly installed: How you can make your own keypad? If you don’t have a keypad, you can do one on your own with many push button.We have explained how to do it on the push button course. Display the numbers pressed on the serial monitor You have to compile the program on the Arduino Card: Here is what you can see on the serial monitor: Secret code on the keypad We will see now how to do a secret code on a keypad. It can be useful for opening a safety deposit box for example.Here is an explanation of how the program is working:First the red led is turn on. Then by taping 0123 and D to confirm the secret code, the green led will turn on. If the secret code is wrong and you have pressed on D, the red led will blink.Finally, if you have pressed the wrong number, you can press the button A to try again.Here is the sketch of the project: Here is the program that you have to compile on your Arduino card: