Introduction: How to Use a Keypad - Arduino Tutorial

Picture of How to Use a Keypad - Arduino Tutorial

A keypad is a set of buttons arranged in a block or "pad" which usually bear digits, symbols and usually a complete set of alphabetical letters. If it mostly contains numbers then it can also be called a numeric keypad. Keypads are found on many alphanumeric keyboards and on other devices such as calculators, push-button telephones, combination locks, and digital door locks, which require mainly numeric input.

In this tutorial you will learn how to use a Numpad (numeric keypad) with Arduino uno.

So, let's get started!

Step 1: What You Will Need

Picture of What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Numpad - Keypad

Step 2: The Circuit

Picture of The Circuit

We are using 7 pins keypad with 3 columns and 4 rows.

Note:

If your keypad doesn't work with code on next step you must change the connections above and the pin numbers on those commands. Search the web for additional help or find the datasheet for your keypad.

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

Step 3: The Code

Picture of The Code

Here's the code, embedded using codebender!

About the code:

The keypad that we are using has 4 rows and 3 columns:

const byte rows = 4; //four rows
const byte cols = 3; //three columns

char keys[rows][cols] =

{ {'1','2','3'},

{'4','5','6'},

{'7','8','9'},

{'#','0','*'} };

Tip: If you have another set of keypad you can change those values with yours ;)

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board! Press connect button to start serial communication with your Arduino board.

Step 4: Well Done!

Picture of Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use a keypad with Arduino.

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!

Comments

devicemodder (author)2015-09-27

I love the in-browser compiler.

About This Instructable

5,110views

43favorites

License:

Bio: Arduino Tutorials by Codebender.cc Team
More by codebender_cc:How to use a magnetic door switch / sensor with ArduinoHow to Measure LUX With ArduinoHow to Control an RGB LED Strip - Arduino Tutorial
Add instructable to: