Membrane Keypad

Z2M Parts: EMS-00015-B, EMS-00015-C

Read key presses from 4x4 membrane keypad.

Circuit Diagram
Circuit diagram for Membrane Keypad
Wire Connections & Pin Configuration

Wire Color Connections:

Yellow/Orange → Pins 3–10 to Keypad rows and columns
(Use different colors per row/column for easy identification)

Pin Configuration:

Arduino Digital Pin 10 → Keypad Row 1
Arduino Digital Pin 9 → Keypad Row 2
Arduino Digital Pin 8 → Keypad Row 3
Arduino Digital Pin 7 → Keypad Row 4
Arduino Digital Pin 6 → Keypad Column 1
Arduino Digital Pin 5 → Keypad Column 2
Arduino Digital Pin 4 → Keypad Column 3
Arduino Digital Pin 3 → Keypad Column 4
Arduino Code
Edit
#include <Keypad.h>

// Define number of rows and columns
const byte ROWS = 4;
const byte COLS = 4;

// Define keypad layout
char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

// Connect keypad row and column pins to Arduino
byte rPins[ROWS] = {10, 9, 8, 7}; // Row pins
byte cPins[COLS] = {6, 5, 4, 3};  // Column pins

// Create Keypad object
Keypad keypad = Keypad(makeKeymap(keys), rPins, cPins, ROWS, COLS);

void setup() {
  Serial.begin(9600); // Initialize Serial Monitor
  Serial.println(\"Membrane Keypad Initialized. Press a key...\");
}

void loop() {
  char key = keypad.getKey(); // Read key press

  // If a key is pressed, display it on the Serial Monitor
  if (key) {
    Serial.print(\"Key Pressed: \");
    Serial.println(key);
  }
}

Instruction Details

Wiring: Connect keypad Row 1–4 to Digital Pins 10, 9, 8, 7. Connect Column 1–4 to Digital Pins 6, 5, 4, 3.
Library: Sketch → Include Library → Manage Libraries → search "Keypad" → Install.
Upload Code: Tools → Board → Arduino Uno. Tools → Port → select your COM port. Click Upload button.
View Output: Open Serial Monitor (Tools → Serial Monitor) at 9600 baud. Press keys to see characters displayed.

How to Use

  1. Connect the required components as per the Pin Configuration above
  2. Open Arduino IDE and create a new sketch
  3. Copy and paste the code above
  4. Select your Arduino board and COM port from Tools menu
  5. Click the Upload button to upload the code to your Arduino
  6. Open Serial Monitor (if applicable) to see the output

Components Required

  • Arduino Uno
  • 4×4 Membrane Keypad
  • Breadboard
  • Jumper Wires

Category: Arduino Basics