The 3x4 Phone-Style Matrix Keypad (Adafruit Art.-Nr.: AF1824) is a compact and versatile input device featuring 12 buttons arranged in a 3x4 grid layout. This keypad is commonly used for user input in electronic devices, allowing for efficient data entry. It is ideal for applications such as security systems, home automation, and control interfaces. The keypad operates as a matrix, where rows and columns are scanned to detect button presses, making it a cost-effective and space-saving solution.
The keypad has a 7-pin header for interfacing with microcontrollers. The pins correspond to the rows and columns of the matrix.
Pin Number | Label | Description |
---|---|---|
1 | R1 | Row 1 connection |
2 | R2 | Row 2 connection |
3 | R3 | Row 3 connection |
4 | C1 | Column 1 connection |
5 | C2 | Column 2 connection |
6 | C3 | Column 3 connection |
7 | C4 | Column 4 connection (optional, unused in 3x4 keypads) |
Note: The 7th pin (C4) is typically unused in this 3x4 keypad configuration but may be present for compatibility with 4x4 keypads.
Connect the Keypad to a Microcontroller:
Scan the Matrix:
Debounce the Input:
Below is an example of interfacing the keypad with an Arduino UNO using the Keypad
library.
Keypad Pin | Arduino Pin |
---|---|
R1 | D2 |
R2 | D3 |
R3 | D4 |
C1 | D5 |
C2 | D6 |
C3 | D7 |
#include <Keypad.h>
// Define the rows and columns of the keypad
const byte ROWS = 3; // 3 rows
const byte COLS = 4; // 4 columns
// Define the keymap (button layout)
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
// Define the row and column pins
byte rowPins[ROWS] = {2, 3, 4}; // Connect to R1, R2, R3
byte colPins[COLS] = {5, 6, 7, 8}; // Connect to C1, C2, C3, C4
// Create the Keypad object
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600); // Initialize serial communication
Serial.println("Keypad Test Ready");
}
void loop() {
char key = keypad.getKey(); // Check for key press
if (key) {
// Print the key to the Serial Monitor
Serial.print("Key Pressed: ");
Serial.println(key);
}
}
Note: Install the
Keypad
library in the Arduino IDE via the Library Manager if not already installed.
No Key Press Detected:
Incorrect Key Presses:
Multiple Keys Detected:
Can I use this keypad with a Raspberry Pi?
Yes, but you will need to use GPIO pins and a library like gpiozero
or RPI.GPIO
to scan the matrix.
What is the maximum cable length for connecting the keypad?
For reliable operation, keep the cable length under 1 meter to minimize signal degradation.
Can I use this keypad with a 4x4 keymap?
No, this keypad is designed for a 3x4 layout. The 4th column (C4) is unused.
How do I clean the keypad?
Use a soft, dry cloth to clean the surface. Avoid using liquids or abrasive materials.
By following this documentation, you can effectively integrate the 3x4 Phone-Style Matrix Keypad (Adafruit Art.-Nr.: AF1824) into your projects for reliable and efficient user input.