Sunday, April 20, 2025

How to Use a Membrane Keypad 3x4 with Arduino | Simple Serial Monitor Project

If you’re looking for a beginner-friendly, flexible way to add multiple user inputs to your Arduino projects, the Membrane Keypad 3×4 is a fantastic option. In this tutorial, we’ll learn how to connect a 3×4 membrane keypad to an Arduino Uno and display button presses in the Serial Monitor using basic wiring and a simple Arduino sketch — no extra libraries needed!

Membrane keypad 3x4 with Arduino

๐Ÿ“Œ What is a Membrane Keypad 3x4?

A Membrane Keypad 3×4 is a compact, ultra-slim keypad featuring twelve individual keys arranged in a 3-column × 4-row grid. It works by closing a circuit when a key is pressed, creating contact between conductive layers inside the membrane. This type of keypad is lightweight, reliable, and commonly used in home appliances, control panels, password systems, and DIY electronics.

๐Ÿ“ Membrane Keypad 3x4 Specifications

Here’s a quick overview of the module’s specifications:

Membrane keypad 3x4 specifications


Components Required

To get started, you will need the following components:
Components required for this tutorial

✅ Arduino UNO board
✅ Membrane Keypad 3x4
✅ Jumper Wires
✅ USB cable for Arduino

๐Ÿ› ️ Circuit Wiring

Here’s how to wire the components correctly:
Connection membrane keypad 3x4

The connection between membrane keypad 3x4 and Arduino

Wiring diagram


✅ Keypad Pin 1 → Arduino Pin 6
✅ Keypad Pin 2 → Arduino Pin 7
✅ Keypad Pin 3 → Arduino Pin 8
✅ Keypad Pin 4 → Arduino Pin 2
✅ Keypad Pin 5 → Arduino Pin 3
✅ Keypad Pin 6 → Arduino Pin 4
✅ Keypad Pin 7 → Arduino Pin 5

Programming the Arduino

Here’s a simple sketch to detect button presses and display them on the Serial Monitor, or you can download the code HERE.
const int ROWS = 4;
const int COLS = 3;
const int rowPins[ROWS] = {5, 4, 3, 2};
const int colPins[COLS] = {8, 7, 6};
char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < ROWS; i++) {
    pinMode(rowPins[i], INPUT_PULLUP);
  }
  for (int i = 0; i < COLS; i++) {
    pinMode(colPins[i], OUTPUT);
    digitalWrite(colPins[i], HIGH);
  }
}

void loop() {
  for (int c = 0; c < COLS; c++) {
    digitalWrite(colPins[c], LOW);
    for (int r = 0; r < ROWS; r++) {
      if (digitalRead(rowPins[r]) == LOW) {
        Serial.println(keys[r][c]);
        delay(200); // Debounce delay
        while (digitalRead(rowPins[r]) == LOW);
      }
    }
    digitalWrite(colPins[c], HIGH);
  }
}

Open Arduino IDE and copy-paste the code

๐Ÿงช Testing the GSM Module

After uploading the code to your Arduino, open the Serial Monitor in the Arduino IDE and press each button on the 3x4 keypad.
You should see outputs like this when each button is pressed.

๐Ÿ“Œ Conclusion

That’s it — a simple, practical way to connect a Membrane Keypad 3×4 to an Arduino Uno and read user inputs via the Serial Monitor. This setup is ideal for beginner projects like password entry systems, digital locks, calculators, or menu navigation.

๐ŸŽฅ Watch the Full Video Tutorial


๐Ÿ”” If you found this guide helpful, share it with fellow makers! For more tutorials, subscribe to our YouTube channel and follow us on social media. ๐Ÿš€

#arduino  #keypad  #3x4keypad #membrane #diyprojects

No comments:

Post a Comment