This membrane keypad with an adhesive back has a 4×4 matrix of letters and numbers including 0-9 and A-D along with the ‘*’ and ‘#’ symbols for good measure.
- Membrane Keypad 4×4 Matrix
KEY FEATURES OF MEMBRANE KEYPAD 4X4 MATRIX:
- 16 tactile membrane keys arranged in 4×4 matrix
- Adhesive back for permanently mounting keypad
- 3″ long 8-pin cable terminates in standard 2.54mm (0.1″) female header.
These membrane keypads work well for adding key input for a project. The construction makes them durable and weatherproof.
The keypad terminates in an 8-pin cable which has 4 row and 4 column pins. The row pins are on the left as you are looking at the front of the keypad and they have a dark strip near the connector to help identify them. The connector is a standard 2.54mm (0.1″) pitch 1×8 female header.
The membrane is a thin but rugged plastic with adhesive on the back. The protective liner can be left in place to keep the keypad mobile or it can be removed and the keypad permanently mounted if desired.
The matrix is resistive which means that when no button is pushed, none of the pins are electrically connected. When a button is pressed, the corresponding Row and Col pins have a resistance of approximately 60-90 ohms between them.
The MCU monitors for key presses by setting a row or column as an output and setting the pins LOW one at a time. It then looks for a LOW logic level on one of the pins on the opposite axis. It does this in a continual scanning process.
For example, if the ‘8’ button is pressed, there will be a low resistance path between the R2 and C1 pins. If the MCU sets R2 as a LOW output and reads C1 as an input, it will see the LOW and know that the ‘8’ button was pressed. These button pushes can easily be detected using 8 pins on an MCU. Software libraries take care of all the messy work as shown in our example below.
OUR EVALUATION RESULTS:
These keypads are an inexpensive and easy way to add a robust key entry system.
The downside to any type of matrix keypads is that they do consume a fair number of digital pins on the MCU which may or may not be a concern for a particular application. They do consume fewer pins than wiring up the same number of discrete buttons
The program below uses the keypad.h library to implement basic input functionality of the keypad.
Eight pins on the MCU are connected to the keypad. In this case we are using pins 2-9, but any 8 digital pins can be used if they are redefined in the rowPins and colPins statements below. Wire things up as shown in the picture to the right.
Once the program is downloaded, open the Serial Monitor window using 9600 baud and any key presses should be displayed in the window.