Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Electronics Basics

Membrane Keypad 4×4: Interface with Arduino

Membrane Keypad 4×4: Interface with Arduino

April 1, 2026 /Posted by / 0

The membrane keypad 4×4 is one of the most popular input devices for Arduino and microcontroller projects. With 16 buttons in a compact, flat package, it is perfect for PIN entry systems, calculators, menu navigation, and access control — all for under ₹60 in India.

Table of Contents

  • What Is a Membrane Keypad?
  • How the Matrix Scanning Works
  • Wiring to Arduino
  • Arduino Code with Keypad Library
  • Project Ideas
  • Recommended Products
  • Frequently Asked Questions

What Is a Membrane Keypad?

A membrane keypad is a thin, flexible input device made of multiple layers of polyester film. The top layer has printed key labels, and beneath it are two conductive layers separated by a spacer. Pressing a key pushes the top conductive layer through a hole in the spacer to make contact with the bottom layer.

The 4×4 variant has 16 keys arranged in 4 rows and 4 columns, typically labelled 0-9, A-D, *, and #. It uses only 8 pins (4 row + 4 column), which is a major advantage over wiring 16 individual buttons.

How the Matrix Scanning Works

The keypad uses a matrix wiring scheme to minimise pin usage. Each key sits at the intersection of a row and a column. To detect which key is pressed:

  1. Set all column pins as INPUT_PULLUP and all row pins as OUTPUT HIGH.
  2. Drive one row LOW at a time while keeping others HIGH.
  3. Read all column pins. If a column reads LOW, a key at that row-column intersection is pressed.
  4. Repeat for each row.

This scanning happens fast enough (microseconds per scan) that it feels instantaneous to the user.

Wiring to Arduino

The 4×4 membrane keypad has an 8-pin ribbon connector. The pinout (left to right when the keypad faces you) is typically:

Keypad Pin Function Arduino Pin
1 Row 1 D9
2 Row 2 D8
3 Row 3 D7
4 Row 4 D6
5 Col 1 D5
6 Col 2 D4
7 Col 3 D3
8 Col 4 D2

Arduino Code with Keypad Library

Install the Keypad library by Mark Stanley and Alexander Brevig from the Arduino Library Manager, then use this code:

#include <Keypad.h>

const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup() {
  Serial.begin(9600);
}

void loop() {
  char key = keypad.getKey();
  if (key) {
    Serial.println(key);
  }
}

Project Ideas

  • Door lock with PIN code — Combine the 4×4 keypad with a servo or solenoid lock. Store the PIN in EEPROM so it survives power cycles.
  • Calculator — Display results on a 16×2 LCD. The A-D keys can map to +, -, *, /.
  • Menu system for OLED — Use the number keys for selection and * / # for enter/back navigation.
  • DTMF tone generator — Play the corresponding DTMF tone for each key press through a speaker.
  • Home automation controller — Assign rooms or appliances to each key, with relay modules for switching.

Recommended Products from Zbotic

4×4 Matrix Keypad Membrane Switch

View on Zbotic

4×4 Matrix 16 Button Keypad Keyboard Module

View on Zbotic

1×4 Matrix – Membrane Type Keypad – 4 Keys

View on Zbotic

4×3 12-key Keyboard / Keypad Telephone Style – Black

View on Zbotic

4×5 Matrix Array 20 Key Membrane Switch Keypad

View on Zbotic

Frequently Asked Questions

What is the difference between a 4×3 and 4×4 keypad?

A 4×3 keypad has 12 keys (0-9, *, #) and uses 7 pins. A 4×4 keypad adds a column with A, B, C, D keys, totalling 16 keys on 8 pins. Choose based on how many inputs your project needs.

Can I use a membrane keypad in an outdoor project?

Standard membrane keypads are not waterproof, but their sealed construction offers some splash resistance. For outdoor use, mount the keypad behind a sealed enclosure or use an IP-rated industrial keypad.

How long does a membrane keypad last?

Most membrane keypads are rated for 1 to 5 million presses per key. For infrequent use (access control), they can last years. For heavy use, consider a PCB-mount tactile button matrix instead.

Can I use fewer Arduino pins for the keypad?

Yes. Use a PCF8574 I2C expander to read the keypad using just 2 pins (SDA and SCL). The Keypad_I2C library supports this configuration.

Start Your Keypad Project

Grab a keypad module and Arduino from Zbotic.in — delivered pan-India!

Shop Keypads

Tags: electronics basics, Switches
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Electromagnetic Launcher: Coil...
blog electromagnetic launcher coilgun project guide 613082
blog esp32 mqtt publish sensor data to cloud dashboards 613085
ESP32 MQTT: Publish Sensor Dat...

Related posts

Svg%3E
Read more

Coffee Roaster: Temperature Profile Controller Build

April 1, 2026 0
Table of Contents Why Build a Coffee Roaster? Roasting Temperature Profiles Components for the Build Thermocouple Placement PID Profile Controller... Continue reading
Svg%3E
Read more

Sous Vide Cooker: Precision Temperature Water Bath

April 1, 2026 0
Table of Contents What Is Sous Vide Cooking? Precision Temperature Requirements Components for the Build PID Temperature Controller Water Circulation... Continue reading
Svg%3E
Read more

Kiln Controller: High-Temperature Pottery Automation

April 1, 2026 0
Table of Contents What Is a Kiln Controller? Temperature Requirements for Ceramics Components for High-Temperature Control K-Type Thermocouple and MAX6675... Continue reading
Svg%3E
Read more

Heat Gun Controller: Temperature and Airflow Regulation

April 1, 2026 0
Table of Contents What Is a Heat Gun Controller? Temperature and Airflow Regulation Components for the Build PID Temperature Control... Continue reading
Svg%3E
Read more

Soldering Iron Station: PID Temperature Controller Build

April 1, 2026 0
Table of Contents Why Build a Soldering Station? PID Temperature Control for Soldering Components Required Thermocouple Sensing at the Tip... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now