4×1 4-Key Matrix Keypad

13,00 DH 15,00 DH

Availability:

282 in stock

SKU: 0119 Categories: ,

Description

4×1 4-Key Matrix Keypad

The 4×1 4-key matrix keypad provides a simple user interface for electronics and home-automation projects. This input device has four buttons arranged in a 4×1 matrix. Pressing a key connects a row to a column, allowing the controller to identify the key. It is suited to projects needing a simple interface, such as security systems, access control, and automation.

Detailed Specifications

  • Configuration: 4 rows x 1 column
  • Number of keys: 4
  • Operating voltage: 5V DC
  • Contact type: Membrane
  • Dimensions: 70mm x 20mm
  • Interface: 5 pins (4 rows, 1 column)
  • Service life: Up to 1 million presses per key

Operation

The keypad scans its rows and columns to detect pressed keys. A pressed key connects a row to a column so the microcontroller can identify it. Scanning is generally handled by a library in development environments such as Arduino.

Applications

  • Security systems: Entering codes for access control.
  • Automation: User interfaces for machines or home-automation systems.
  • Electronics prototyping: Development projects that require user input.

How to Use It with an Arduino Uno

You will need:

  • 1 x 4×1 4-key matrix keypad
  • 1 x Arduino Uno
  • Connecting wires
  • Breadboard

Wiring instructions:

  1. Connect the keypad: Connect its 5 pins to Arduino digital pins (for example, pins 2 through 6).
  2. Use the Keypad library:
    • Install the Keypad library in the Arduino IDE.
    • Use the code below to read keypad input.

Arduino Uno code example:

#include <Keypad.h>


const byte ROWS = 4; // quatre lignes
const byte COLS = 1; // une colonne
char keys[ROWS][COLS] = {
  {'1'},
  {'2'},
  {'3'},
  {'4'}
};


byte rowPins[ROWS] = {9, 8, 7, 6}; // Connecté aux pins des lignes du clavier
byte colPins[COLS] = {5}; // Connecté aux pins des colonnes du clavier


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


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


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

Code Explanation

  1. Keypad library: The code includes the Keypad library for handling the matrix keypad. Install it in the Arduino IDE before use.
  2. Row and column declarations: ROWS and COLS define the matrix dimensions. The keys array contains the character assigned to each key.
  3. Row and column pins: rowPins and colPins specify the Arduino pins connected to the keypad rows and column.
  4. Keypad initialization: The Keypad object uses the key map (makeKeymap), pin arrays, and matrix dimensions.
  5. Serial communication setup: setup() initializes serial communication at 9600 baud to display pressed keys in the Serial Monitor.
  6. Reading keys: In loop(), getKey() reads a pressed key. If a key is pressed (if (key)), its character is displayed with Serial.println(key).

Pinout

  • L1 – L4: Connected to digital pins (for example, 9 through 6) for the rows.
  • C1: Connected to digital pin 5 for the column.

 

Keywords: matrix keypad, 4×1 keypad, user interface, access control, 4-key keypad, matrix, keyboard.

Thank you for your loyalty!

EN