4x4 Membrane Switch Keypad

From Wiki
Jump to: navigation, search


4x4 Membrane Switch Keypad 1.jpg Matrix Keyboard
Matrix Keyboard is a kind of keyboard whose layout is like a matrix and it’s used as a peripheral equipment of MCU. The structure of matrix keyboard is more complex than that of other common keyboards, and the condition is similar to that of the recognition. The column line is connected with the anode of the power supply through resistors and let the I/O port of MCU connected with the row line work as an output terminal. The I/O port connected with the column line will be the input.

Because during the circuit design, there is much more need of external input. It will consume much IO source if we control a button separately, we have the matrix keyboard. The most common types are 4*4 and 8*8. Among them, the type 4*4 is even more common than 8*8.

On a keyboard, if there are too many buttons, we will arrange them into the form of matrix to decrease the using of the I/O port. In the internal structure of the matrix keyboard, each horizontal line and each vertical line are not connected directly at the intersection, but at the button. Therefore, a port (eg. P1) can form 4*4=16 buttons, and the number is twice as much as that of the button whose port cable is connected with keyboard.
The larger the number of the wires, the clearer the difference. For example, if there is an additional wire, we can get a keyboard with 20 buttons; using the port cable directly, we can get one additional key (key 9). So if there is much need of buttons, it is wise to use matrix analysis.

membrane keyboard Membrane keypad is an application case of membrane switch with arrayed buttons. Membrane keypad is a kind of currently widespread operation system in the world that has the advantages of both practicality and beauty. It is composed of panel, upper circuit, isolation layer and bottom circuit. Due to these advantages: nice appearance, modern design, tiny in size, light weight, strong sealing (moisture proof, dust proof, oil pollution prevention, acid and alkali resistance), quake resistance and long service life, etc., it is commonly used in these fields, like medical instrument, computer control, digital machine tool, electronic weighing device, post and telecommunication, photocopier, refrigerator, microwave oven, electric fan, washing machine, electronic gaming machines.

Main Features

  1. Advantages
    • Artistic appearance, original
    • Small in size, thin and light, helps the keyboard to optimize to the level of being light, thin, short, small, and of high intelligence.
    • Dampproof, dustproof, oil-resistant, preventing noxious gas, strong sealing, acid-resistant, and vibration proof.
    • Long service life, bend-resistant
  2. Electronic Properties
    • Rated Current: 35V (DC), 100mA, 1W.
    • Contact Resistance: 10Ω~500Ω
    • Insulation Resistance: 100MΩ100V
    • Dielectric Strength: 250VRms (50~60Hz 1min)
    • Electric Shock Shake: <5ms
    • Longevity: touch type: ≥ 1 million times
  3. Mechanical Property
    • Working Voltage: touch: 170~397g(6~14oz)
    • Switching Path: T-Touch: 0.6~1.5mm
  4. Environmental Parameter
    • Working Temperature: -40 ~ +80
    • Storage Temperature: -40 ~ +80
    • Temperature: 40,90% ~ 95%, 240h
    • Vibration: 20G, maximum (10~200Hz, Mil-SLD-202 M204. condition B)


Here, when the buttons are not pressed, the output terminal is high level, and it means that there is no button pressed. The output of the row line is low level. Once there is a press on the button, the input line will be lowered; therefore, by reading in the state of the input line, we can get to know whether there is a press on any button or not.
4x4 Membrane Switch Keypad 2.jpg

Experimental Procedures for Arduino

Step 1: Connect the circuit: 4x4 Membrane Switch Keypad 3.jpg
Step 2: Compile and upload the code. Before uploading the codes, please import the Library files. Click “Sketch” => “Include Library” =>“Manage Libraries…” 4x4 Membrane Switch Keypad 4.jpg
Search “Keypad”, unfold the options, and click “Install”.
4x4 Membrane Switch Keypad 5.jpg

#include <Keypad.h>

const byte ROWS = 4; 
const byte COLS = 4;
char keys[ROWS][COLS] = {
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(){
void loop(){
  char key = keypad.getKey();
  if (key != NO_KEY){

4x4 Membrane Switch Keypad 6.jpg
Enter the serial port, and press the keyboard, then the relative name of the pressed button will appear.