0% found this document useful (0 votes)
28 views

Lesson 13 Membrane Switch Module

This lesson explains how to set up a membrane switch module with an Arduino UNO R3 to read user input from a keypad. It includes hardware requirements, circuit connections, code interpretation, and step-by-step experimental procedures for successful implementation. Users can navigate menus and control devices by pressing the keys, with feedback displayed on the Serial Monitor.

Uploaded by

Euronymous
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Lesson 13 Membrane Switch Module

This lesson explains how to set up a membrane switch module with an Arduino UNO R3 to read user input from a keypad. It includes hardware requirements, circuit connections, code interpretation, and step-by-step experimental procedures for successful implementation. Users can navigate menus and control devices by pressing the keys, with feedback displayed on the Serial Monitor.

Uploaded by

Euronymous
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

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

 1 * Membrane Switch module

 8 * M-M Jumper Wires

Principle

Membrane Switch Module(Keypads)

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

const byte ROWS = 4; //four rows

const byte COLS = 4; //four columns

//define the cymbols on the buttons of the keypads

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

byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the


keypad
//initialize an instance of class NewKeypad

Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins,


ROWS, COLS);

void setup(){

Serial.begin(9600);

void loop(){

char customKey = customKeypad.getKey();

if (customKey){

Serial.println(customKey);

Experimental Procedures

Step 1:Build the circuit

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.

These are the connections in a table:


Keypad Pin Connects to Arduino Pin
1 D9
2 D8
3 D7
4 D6
5 D5
6 D4
7 D3
8 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 4: Load the Libraries:Keypad


Step 5:Upload the code to the RexQualis UNO R3 board.

Step 6:Open the Serial Monitor then you can see the data as
below:

(How to use the Serial Monitor is introduced in details in


Lesson 0 Preface)
Then, when you press the Membrane Switch Module
(Keypads), you can see the corresponding numbers and
symbols on the monitor
If it isn’t working, make sure you have assembled the circuit
correctly, verified and uploaded the code to your board.For
how to upload the code and install the library, check Lesson 0
Preface.

You might also like