Introduction: KEYPAD

About: An educational blog for engineering students in providing information on electronics projects, Arduino projects, Engineering projects, circuits & Ideas

Today the one I am discussing is not a sensor it is a common thing which you are all familiar with is a is a keypad not the one like the old phone shave it is the one used with different microcontroller to get desired output

Most the devices contain either touch keypads or the physical one for entering the data input so to implement this thing into our project I have decided to make an article on it.

Step 1: WHAT IS KEYPAD

It is a 4x4 Matrix type structure or circuit which according to the number of row and column decide the output of the key. The no of rows and columns along with the elements contained in each letter is feeded into the microcontroller and then the output is decided by the microcontroller according to that matrix

Step 2: USE

  • Easy to use
  • Low price
  • Can be hooked to any micro-controller

Step 3: PINOUT

Step 4: COMPONENTS REQUIRED

  • Any microcontroller preferably Arduino Uno for beginners.
  • A breadboard
  • Jumper wires
  • Keypad

Step 5: CONNECTION

Connect the pin that is rows and columns of the keypad according to the above picture and below code and use the serial monitor to see the output.

Step 6: CODE

#include

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);

}

}

NOTE:- I have used KEYPAD LIBRARY which can be installed using Arduino library manager

Step 7: WORKING

As the code starts it initializes the pins that is rows and column pins to which the keypad is connected and then stores its value in the matrix. Then the micro-controller waits for the output from the matrix keypad. After receiving the output the micro-controller decides the output of the keypad according to the matrix feeded into it during initialization.

Then the values corresponding to the matrix is displayed onto the serial monitor(Ctrl+Shift+M).

Step 8: PCB DESIGN

Now we have got the PCB design and it’s time to order the PCB’s.

For that, you just have to go to JLCPCB.com, and click on “QUOTE NOW” button.

JLCPCB are also sponsor of this project. JLCPCB (ShenzhenJLC Electronics Co., Ltd.), is the largest PCB prototype enterprise in Chinaand a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production. You can order a minimum of 5 PCBs for just $2.

To get the PCB manufactured, upload the gerber file you downloaded in the last step. Upload the.zip file or you can also drag and drop the gerber files.

After uploading the zip file, you’ll see a success message at the bottom if the file is successfully uploaded.You can review the PCB in the Gerber viewer to make sure everything is good. You can view both top and bottom of the PCB.

After making sure our PCB looks good, we can now place the order at a reasonable price. You can order 5 PCBs for just $2 but if it’s your first order then you can get 10 PCBs for $2.

To place the order, click on “SAVE TO CART” button.

My PCBs took 2 days to get manufactured and arrived within a week using DHL delivery option. PCBs were well packed and the quality was really good.