Lesson 13 Membrane Switch Module
Lesson 13 Membrane Switch Module
Introduction
In this lesson, we will go over how to set up a keypad on an arduino so that the
UNO R3 can read the keys being pressed by a user.
Hardware Required
1 * RexQualis UNO R3
Principle
Membrane Switch Module(Keypads) are a great way to let users interact with
your project. You can use them to navigate menus, enter passwords, and
control games and robots.Pressing a button closes the switch between a
column and a row trace, allowing current to flow between a column pin and a
row pin.
The schematic for a 4X4 keypad shows how the rows and columns are
connected:
Code interpretation
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
void setup(){
Serial.begin(9600);
void loop(){
if (customKey){
Serial.println(customKey);
Experimental Procedures
When connecting the pins to the UNO R3 board, we connect them to the digital
output pins, D9-D2. We connect the first pin of the keypad to D9, the second
pin to D8, the third pin to D7, the fourth pin to D6, the fifth pin to D5, the sixth
pin to D4, the seventh pin to D3, and the eighth pin to D2.
Schematic Diagram
Step 2: Open the code:Membrane_Switch_Module_Code
Step 3: Attach Arduino UNO R3 board to your computer via
USB cable and check that the 'Board Type' and 'Serial Port' are
set correctly.
Step 6:Open the Serial Monitor then you can see the data as
below: