SIMPLE 4X4 MEMBRANE KEYPAD AND 4X3 MEMBRANE KEYPAD INTERFACE WITH ARDUINO

SIMPLE 4X4 MEMBRANE KEYPAD AND 4X3 MEMBRANE KEYPAD INTERFACE WITH ARDUINO

simple 4x4 membrane keypad interface with arduino


Today we will learn about to 4x4 membrane keypad and 4x3 membrane keypad. What is a keypad? How does it work? and interface with Arduino uno? Will know everything. We get to see the keypad in most machines. it is very common to see the keypad in a machine. Like you can see the keypad in the ATM machine, you can see the keypad in the petrol pump, you can see the keypad in the smart door lock, and you can see the keypad in telephone etc. There are many such devices in which the keypad is installed. In generally, we use the keypad to give input commands to perform a particular task. For example, if the amount of money is needed, then by pressing the keypad in the ATM machine, we send the command to the machine, so that in a few seconds, the machine gives us money. Similarly, if someone wants to make a call, then we press the button from the keypad in the old mobile, which means giving input commands to the mobile, then we get the call from the keypad.

WHAT IS 4X4 MEMBRANE OR 4X3 MEMBRANE KEYPAD?

4x4 membrane keypad
4x4 membrane keypad
4x3 membrane keypad
4x3 membrane keypad


4 x 4 membrane keypad is an input device. It is made of flexible membrane material. Its size is 4 rows and 4 columns. It has total 16 membrane switch. The 4 rows and 4 columns are connected to each other through the conductive trace. And 4x3 membrane keypad is made same material and work same. But 4x3 membrane keypad has 4 rows and 3 columns. And it has total 12 membrane switch. That is different between 4x4 membrane keypad and 4x3 membrane keypad. And different-different size keypads are available in the market, such as 4 x 4, 4 x 3, 4 x 1 size keypad. All have same working processor. There are two types of keypads available in the market, a traditional type which has a push button, and a membrane material type keypad which is much lighter and better than the traditional type of keypad.

HOW DOES IT WORK?

We know that a 4 x 4 keypad has 4 rows and 4 columns. And a 4 x 3 keypad has 4 rows and 3 columns. 
These are 4 membrane switches in one row of a 4 x 4 keypad, and by connecting them to each other, we get an input connection. Type 2 , 3 , 4 Rows get 3 input connections by being connected to each other separately from the conductive trace. Thus we get a total of 4 input connections, for 4 rows.These are 4 membrane switches in one column of a 4 x 4 keypad, and by connecting them to each other, we get an input connection. Type 2 , 3 , 4 column get 3 input connections by being connected to each other separately from the conductive trace. Thus we get a total of 4 input connections, for 4 column.

These are 3 membrane switches in one row of a 4 x 3 keypad, and by connecting them to each other, we get an input connection. Type 2 , 3 , 4 Rows get 3 input connections by being connected to each other separately from the conductive trace. Thus we get a total of 4 input connections, for 4 rows.
These are 3 membrane switches in one column of a 4 x 3 keypad, and by connecting them to each other, we get an input connection. Type 2 , 3 column get 2 input connections by being connected to each other separately from the conductive trace. Thus we get a total of 3 input connections, for 3 column.

Thus we get a total of 8 input pins for a 4 x 4 membrane keypad, and 7 input pins for a 4 x 3 membrane keypad.

The working principle of 4 x 4 keypad and 4 x 3 keypad is very simple.When the button is pressed, one row and one column are shortened. Due to which the current flows from a row to a column and with the help of micro controller it detects the button pressed.

How microcontroller checks the button press status of 4 x 4 keypad and 4 x 3 keypad to find out which button is pressed. You can see the procedure of microcontroller given below.

  • First, the microcontroller sets the input pin of the 4 x 4 membrane keypad or 4 x 3 membrane keypad.
  • After that the microcontroller sets the entire row of the keypad to high.
  • Then microcontroller once again checks the column is high or low.
  • When none of the buttons in the row is pressed, the column remains in the LOW state during that time.
  • When one of the row buttons is pressed then row is HIGH and with the column also goes high.So the microcontroller detects which row is high and which column was high.
  • Finally the microcontroller detects which button was pressed according to the row and column

APPLICATION OF KEYPAD

  • Telephone.
  • ATM Machine.
  • Petrol Pump.
  • Dispenser Machine.
  • Mobile, Laptop etc.

COMPONENT REQUIRED

  • Arduino Uno.
  • 4x4 membrane keypad and 4x3 membrane keypad.
  • 9V battery.
  • Jumper wires.
  • Led.
  • 1k resistor.

PIN OUT 

You can see given below pin out of 4x4 membrane keypad and 4x3 membrane keypad.

4x4 membrane keypad
pin out of 4x4 membrane keypad
4x3 membrane keypad
pin out of 4x3 membrane keypad





CIRCUIT DIAGRAM

  4x4 membrane keypad with arduino uno
circuit diagram of 4x4 membrane keypad with arduino uno                         
4x3 membrane keypad with arduino uno
circuit diagram of 4x3 membrane keypad with arduino uno



We all know that a 4x4 keypad has a total of 8 input pins. 4 Input pin is for row. And the 4 input pins are for the column. 4x3 keypad has a total of 7 input pins. 4 Input pin is for row. And the 3 input pins are for the column.The C4 of the 4 x 4 keypad will be connected to the digital pin D2 of the arduino uno and C3,C2,C1 will be connected to the D3,D4,D5 of the digital pin of arduino uno .The R4 of the 4 x 4 keypad will be connected to the digital pin D6 of the arduino uno and R3,R2,R1 will be connected to the D7,D8,D9 of the digital pin of arduino uno. And D10 will be connected to one end of 1k resistor and second end of 1k resistor will be connected to anode terminal of led and cathode terminal of led will be connected to ground pin of arduino uno. And same procedure for 4x3 membrane keypad.

CODE

Firstly you will have to install keypad library ->Sketch->Include Library->Manage Libraries click on and wait some time.. write keypad on the search bar and install the keypad by mark stanely, Alexander Breving.

For 4x4 membrane keypad

#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns

//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup()
{
  Serial.begin(9600);
}
  
void loop()
{
  char customKey = customKeypad.getKey();
  
  if (customKey){
    Serial.println(customKey);
  }
}

For 4x3 membrane keypad

#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //four columns
//define the cymbols on the buttons of the keypads

/define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};

byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup()
{
  Serial.begin(9600);
}
  
void loop()
{
  char customKey = customKeypad.getKey();
  
  if (customKey)
{
    Serial.println(customKey);
  }
}

Led control by 4x4 membrane keypad 

LED CONTROL BY 4X4 MEMBRANE KEYPAD


CODE
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
int led=10;

//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] =
 {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = {2, 3, 4,5 }; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8, 9}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup()
{
  Serial.begin(9600);
  pinMode(led,OUTPUT);
}
  
void loop()
{
  char customKey = customKeypad.getKey();
  
  if (customKey)
  {
    Serial.println(customKey);
  }
  
  if(customKey=='1')
  {
    digitalWrite(led,HIGH);
  }
  else if(customKey=='2')
  {
    digitalWrite(led,LOW);
  }
}

Post a Comment

0 Comments