How to Interface Keypad 4x4 (2D) With Arduino

by mybotic in Circuits > Arduino

6039 Views, 15 Favorites, 0 Comments

How to Interface Keypad 4x4 (2D) With Arduino

13901821_1117537811652093_62578766_o.jpg

This tutorial is going to teach you some basics on using Keypad 4x4 on Arduino.

Introduction

Description:

This keypad consists of 4 rows x 4 columns of buttons. It is ultra-thin that it provides an useful human interface component for microcontroller projects. Convenient adhesive backing provides a simple way to mount the keypad in a variety of applications, such as menu selection, security systems, data entry for embedded systems and so on.

Specifications:

  • Maximum rating: 24VDC, 30mA
  • Interface: 8-pin access to 4x4 matrix
  • Operating temperature: 32ᵒF to 122ᵒF (0ᵒC to 50ᵒC)
  • Dimension: Keypad (69mm x 76mm), Cable (20mm x 87mm)

Pin Definition

pin definition.PNG

Sample Hardware Installation

sample hardware installation.PNG

Sample Source Code

To get the results, please download the sample source code attached below and upload it into Arduino.

Downloads

How to Install the Keypad Library

Method One:

1. Download the library from this link: http://playground.arduino.cc/uploads/Code/keypad.z... or you can directly download the zip file attached below.

2. Go to the location of the downloaded file and unzip it.

3. Next, move the unzipped file to the library folder of your Arduino software.

4. Quit your currently-opened Arduino software (if you are running it at the moment)

5. Open your Arduino software once again. Now you should be able to use your keypad library.

Method Two (Only applicable to Arduino IDE 1.6.2 or above):

1. Go to the menu of your Arduino software, then Sketch>Include Library>Manage Libraries...

2. Next, search for Keypad.

3. For a short while, the relevant result is displayed. Select the "Keypad" library and choose Install.

4. Quit your currently-opened Arduino software (if you are running it at the moment).

5. Open your Arduino software once again. Now you should be able to use your keypad library.

*Note that to understand the programming language used in keypad library and to know better their functions, you may kindly refer to this website: http://playground.arduino.cc/code/keypad

Downloads

Ways to Open Serial Monitor

sm1.PNG
sm2.PNG

Result

result.PNG

The picture above shows the button being pressed randomly and the corresponding number or symbol or alphabet is being displayed on the Serial Monitor.