Arduino Keypad Shield with 16-Button Matrix Keypad
Add a Keypad to your Arduino Project
Whether you're giving your front door an electronic deadbolt, putting a combination lock on a puzzle box, building a novelty oversized calculator, or adding a launch control panel to your rocketship, there are lots of uses for a keypad in DIY projects! This hardware and software package gives you everything you need to easily attach a high-quality keypad to your Arduino with all the electronic, mechanical and software complexity made simple.
For maximum flexibility, the keypad can be attached to the shield in two ways:
- Mounted directly on the shield. Mounting hardware is included. This is a fast and convenient option that keeps the Arduino, shield, and keypad all together in a single unit.
- Mounted remotely. Sometimes, the Arduino and Keypad may be separated—for example, you may want to mount the keypad on the front of a box or next to a door and keep the Arduino itself somewhere nearby. In this case, attach the included RJ45 dongle to the keypad and connect the keypad to the shield's onboard RJ45 jack with any Ethernet cable.
The Easy Keypad
You can buy standalone keypads and attach them directly to an Arduino without a shield, of course. But that usually results in a big mess of wires and a keypad dangling from the Arduino. Also, directly attaching a keypad consumes 8 or more pins on your Arduino -- leaving precious few for other uses.
The Lectrobox Keypad Shield solves all these problems:
- Just plug it in! All the mounting hardware is included.
- In your sketch, just link our Arduino library, and call getNextKeypress() to get each keypress.
- Mount the keypad directly to your Arduino (hardware included), or use the enclosed RJ45 adapters with your own Ethernet cable to mount the keypad remotely, anywhere!
- The shield has stacking headers so it's easy to add another shield or access any of the Arduino's other pinouts to integrate the keypad with the rest of your project.
- The shield uses only two Arduino pins (SDA and SCL), keeping the Arduino's other digital and analog pins free for the rest of your project. (16-button keypads normally require 8 pins; the Lectrobox shield has its own onboard ATTiny processor that talks to the keypad for you.)
- The shield never misses a keypress, even if your application is busy doing other things. (Again, this works because the shield has its own tiny processor that does nothing but scan the keypad.)
- The keypad itself is high quality, rated for 1 million keypresses and with satisfying key travel. This isn't a cheesy membrane keypad!
Supported Arduinos
The shield should be compatible with nearly all 8-bit and 32-bit, 5v and 3.3v Arduinos as long as they have the "R3" pin layout. The shield and library have been tested and are known to work on a variety of Arduino hardware:
- AVR-based Arduinos:
- Arduino Uno R3
- Elegoo Uno R3
- Arduino Leonardo
- 32-bit Arduinos:
- Arduino Zero
- Intel Curie Arduinos:
- Arduino 101
Note that the shield does not support older (pre-R3) Arduinos such as the Uno R2, Uno R1, Diecimila, Duemilanove, and others that do not have SDA and SCL pins as part of the digital pin block.
Buying Hardware
- If you're in the United States, you can buy the board on Amazon. If you have Amazon Prime, two-day shipping is free!
- If you're outside the United States, you can buy the board from my eBay Store; eBay will export it using their Global Shipping Program.
Downloads
The Arduino library, including an example sketch, can be installed using the Arduino's Library Manager (search for "Lectrobox Keypad"), or downloaded here.
The library is also available on github.
You can also download the schematic (PDF) and the Eagle schematic and board layout files for Eagle v6.
Using the Library
To access the keypad from your sketches, first install the library. The easiest way is to use the Arduino's Library Manager; select Sketch > Include Library > Manage Libraries... and search for Lectrobox Keypad. You can also install it without the library manager by downloading the .ZIP manually and selecting Sketch > Include Library > Add .ZIP Library.... For detailed instructions, check out the Arduino Library tutorial.
As shown in the example sketch KeypadShield_Example, the keypad is accessed using a class called KeypadShield. To use it:
- #include "KeypadShield.h" in your sketch
- Declare a variable of type KeypadShield called, for example, keypad
- Call keypad.begin() in your sketch's setup() function
TWI Address Configuration
For maximum compatibility with other shields, the Lectrobox Keypad Shield lets you choose between two different hard-coded TWI slave addresses. The default 7-bit address is 0x32. The alternate address is 0x75, which can be selected by soldering a jumper between the two shield pads marked OPT and power-cycling the shield.
After the hardware has been reconfigured, the software library must also be configured to query the new TWI address. In your sketch's setup(), initialize the KeypadShield library by calling keypad.begin(0x75).
Example Program
#include <KeypadShield.h> KeypadShield keypad; void setup() { keypad.begin(); Serial.begin(9600); Serial.print("Starting keypad monitor!\n"); } void loop() { char nextChar = keypad.getNextKeypress(); if (nextChar != 0) { Serial.print("Got key: "); Serial.print(nextChar); Serial.print("\n"); } delay(100); }
Contact
For questions or support, please contact us at info at lectrobox dot com.