Electronicdesign Com Sites Electronicdesign com Files Uploads 2014 10 Ifd2603 Mally

Basic Circuit Eliminates Numeric Keypad Polling

Oct. 20, 2014
Any X-Y switch matrix can be considered with this circuit, which simplifies decoding of the common 4x4 keypad matrix and eliminates having to scan rows or columns.
Rick Mally, Independent Designs LLC

Using eight digital inputs, this circuit simplifies decoding of the common membrane 4x4 keypad matrix and eliminates the traditional requirement of scanning rows or columns. Any X-Y switch matrix, which can be part of some apparatus, can be considered with this device.

The design uses eight pre-biased transistors—four NPN and four PNP. When depressing a given switch, two transistors will turn on via the current through their internal biasing networks, providing a unique signature code that can be recognized and decoded. The generated code, which will be unique for each key, is readable with a simple 8-bit input statement. By enabling a pin-change interrupt on all eight inputs, the keyboard decode program can be entirely interrupt-driven.

Download this article in .PDF format
This file type includes high resolution graphics and schematics when applicable.

The eight lines could also be connected to a shift register, thereby only requiring two to three digital I/O lines for the microprocessor to shift out and read the result.

1. To simplify decoding of a 4x4 keypad matrix, an 8-bit port was configured as inputs using internal pull-up and pull-down resistors the microprocessor.

In the simplest setup, an 8-bit port is configured as inputs, with internal pull-up resistors on bits 0-3 and internal pull-down resistors on bits 4-7 (Fig. 1). This is possible with several microprocessors, including STMicroelectronics’ STM32F100. In fact, this circuit was prototyped with the STM32F100, and wound up delivering excellent results.

The design in Figure 2 employs external pull-up and pull-down resistors. The best solution implements two resistor arrays, such as the widely available four-element surface-mount types—they’re compact, inexpensive, and add only two components to the circuit board. For most pull-up and pull-down applications, 10 kΩ will suffice.

2. This alternate to Figure 1 uses external pull-up and pull-down resistor arrays.

Of course, several combinations are possible when simultaneously pressing two keys, also leading to the generation of unique codes. This scenario works as well—any combination in which the two keys don’t share a common row or column can be decoded.

Rick Mally, sole proprietor of Independent Designs, a small-scale custom electronic design and prototyping firm for clients with a limited budget was home-schooled and self-educated in the electronics field.

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!