DSP, Micros & Memory


Implementing an ultralow-power keypad interface

23 April 2003 DSP, Micros & Memory Products & Solutions

Often in applications with keypads, the condition can occur where a key can be held or stuck down, causing excess current consumption and reducing the battery life of a battery-operated product.

This article shows a solution. The keypad interface here, based on the Texas Instruments' MSP430, draws 0,1 µA while waiting for a key press, is completely interrupt driven, requiring no polling, and consumes a maximum of only 2 µA at 3 V if all keys are pressed and held simultaneously.

Figure 1. Keypad schematic diagram
Figure 1. Keypad schematic diagram

The keypad interface described in this article (schematic in Figure 1) is based on MSP430F12x device from. Its beneficial features include:

* 100 nA typical current consumption while waiting for key press.

* 2 µA maximum current consumption if all keys are held simultaneously.

* No polling required.

* No crystal required.

* Minimum external components.

* Application is suitable for any MSP430 device.

Implementation

The rows of the keypad are connected to port pins P3.0-P3.3. The columns are connected to pins P1.0-P1.2. Connecting the rows to port 3 pins, instead of port 1 pins, leaves the other port 1 pins for other interrupt sources, because the P1 pins have interrupt capability, but the P3 pins do not.

In normal mode, while the circuit is awaiting a key press (wait-for-press mode), the rows are driven high, and the P1.x column pins are configured as inputs, with interrupts enabled and set to interrupt on a rising edge. The 4.7 M. pulldown resistors hold the inputs low in this state. The MSP430 is then put into low-power mode 4, where the MSP430 current consumption is about 100 nA. This state is maintained indefinitely until a key is pressed. The circuit is completely interrupt-driven with no need for polling.

When a key is pressed, the column associated with that key gets a rising edge, waking up the MSP430. At that point, Timer_A is configured to perform a debounce delay of about 40 ms. The timer for the delay uses the internal digitally controlled oscillator (DCO) of the MSP430 - an RC-type oscillator. The DCO is subject to tolerances, so a debounce delay was chosen to give a worst-case-minimum delay of 25 ms. That translates to a worst-case-maximum delay of about 86 ms and a typical delay of about 40 ms. This is a useable range for keypad debounce.

After a key has been pressed, the MSP430 goes into a wait-for-release mode in which it drives high only the necessary row for the key being pressed (other rows are driven low). It reconfigures the P1.x I/O lines to interrupt on a falling edge, and it goes back into low power mode 4, waiting for the release of the key. Again, there is no polling necessary at this point. The detection of the key release is completely interrupt driven allowing the microcontroller to stay asleep while the key is held, thus reducing current consumption. Once the key is released, the debounce delay is again executed. After the debounce delay, the keypad is scanned again to determine if any other keys are being held. If so, the wait-for-release mode continues, waiting for all keys to be released. When all keys are released the MSP430 goes back to the wait-for-press mode again.

During the wait-for-release mode, only one row of the keypad is driven high, therefore limiting the maximum amount of current consumption to the condition where all three keys on a single row are pressed and held. For a 3 V system, that equates to about 2 µA. Any other key press does not result in increased current consumption because the corresponding row is not driven high.

In this 3 x 4 keypad example, the rows are driven rather than the columns, to limit the maximum current consumption by the circuit when all keys are pressed and held simultaneously. Had the columns been driven instead, the rows would have had the pulldown resistors, therefore increasing the number of paths to ground when all the keys are held and increasing the possible current consumption.

Figure 2. Software flow
Figure 2. Software flow

The software

The software flow chart is shown in Figure 2. Click here for the complete code listing.

For more information contact Avnet Kopp, 011 809 6100, [email protected], www.avnet.co.za





Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

Quad RF ADC/DAC for wideband transceiver design
Altron Arrow DSP, Micros & Memory
The AD9084 from Analog Devices integrates a quad 16-bit RF digital-to-analogue converter with a maximum sampling rate of 28 GSPS and a quad 12-bit RF analogue-to-digital converter.

Read more...
High-performance FPGA family
EBV Electrolink DSP, Micros & Memory
AMD’s Kintex UltraScale+ FPGA family delivers high-performance, mid-range field programmable gate arrays that balance price, performance, and power efficiency for demanding DSP applications.

Read more...
Bringing fire safety closer to home
SafeQuip Fire & Safety Products & Solutions Smart Home Automation
SafeQuip’s latest product launch introduces two compact, disposable fire extinguishers for everyday use, one suitable for Class A, B, and C fires, the other rated for Class A, B and F fires.

Read more...
From surveillance to insight across Africa
neaMetrics TRASSIR - neaMetrics Distribution Access Control & Identity Management Surveillance Products & Solutions
TRASSIR is a global developer of intelligent video management and analytics solutions, delivering AI-driven platforms that enable organisations to monitor, analyse, and respond to events across complex physical environments.

Read more...
Edge AI-powered night vision
Surveillance Products & Solutions
By eliminating the need for supplemental lighting, the VIVOTEK Chroma24 low-light full-colour AI camera series provides quiet, unobtrusive protection, while also reducing power consumption and minimising impact on people, ecosystems, and the environment.

Read more...
Inside the RealScan SG10
neaMetrics Access Control & Identity Management Products & Solutions
The SG10 was optimised for speed at every stage, from capture to processing. The result is faster fingerprint acquisition and near-instant response for operators.

Read more...
AI-powered classification across large areas
Axis Communications SA Surveillance Products & Solutions AI & Data Analytics
Axis Communications announced the upcoming launch of two innovative radars. Each device delivers a 180° or 270° horizontal field of detection, with accurate AI-powered classification across large areas, 24/7, in all weather and lighting conditions.

Read more...
Unified, AI-powered security platform
Suprema neaMetrics Access Control & Identity Management Surveillance Products & Solutions
Suprema recently announced the launch of BioStar X, its advanced unified security platform. BioStar X unifies biometric access control and video surveillance into a single, scalable platform.

Read more...
Protecting high-value data from AI
CASA Software Infrastructure Information Security Products & Solutions
As artificial intelligence accelerates the speed and sophistication of cyberattacks, protecting high-value data, such as financial records, legal files, patient data, intellectual property, and compliance records, has never been more urgent.

Read more...
Compact and scalable development board
DSP, Micros & Memory
The FRDM-MCXW72 from NXP is a compact and scalable development board for rapid prototyping of the MCX W72 multiprotocol wireless MCU.

Read more...









While every effort has been made to ensure the accuracy of the information contained herein, the publisher and its agents cannot be held responsible for any errors contained, or any loss incurred as a result. Articles published do not necessarily reflect the views of the publishers. The editor reserves the right to alter or cut copy. Articles submitted are deemed to have been cleared for publication. Advertisements and company contact details are published as provided by the advertiser. Technews Publishing (Pty) Ltd cannot be held responsible for the accuracy or veracity of supplied material.




© Technews Publishing (Pty) Ltd | All Rights Reserved