Low-power keypad consumes only 100 nA

-January 24, 2002

Often in the use of products with keypads, one or more keys become "stuck" or are being pressed. For example, a cell phone in the bottom of a purse or in a hip pocket could have one or more of its keys inadvertently pressed and held down for a considerable period. Depending on the circuit design and implementation of the keypad interface, this condition could cause excess current to flow, thereby draining the batteries in portable equipment. The circuit in Figure 1 is a keypad interface that solves this problem by using an ultralow-power microcontroller. The circuit typically consumes 100 nA while awaiting a key press and consumes a maximum of only 2 µA if all keys are stuck or held down. An added bonus of the circuit is that it requires no crystal.

The circuit uses the MSP430, IC1, because it offers low power consumption, individually configurable I/O pins with interrupt on rising or falling edges, and wake-up time of less than 6 µsec. In normal mode, port pins P3.0 to P3.3 drive the rows high. The columns connect to port pins P1.0 to P1.2, configured as inputs with interrupts enabled and set to interrupt on a rising edge. The pulldown resistors hold the inputs low in the inactive state. The MSP430 then goes into low-power Mode 4, in which the microcontroller draws 100 nA. This state continues indefinitely until you depress a key. The circuit is completely interrupt-driven with no need for polling. When you depress a key, the column associated with that key receives a rising edge, thereby waking the MSP430. The timer for the delay uses the internal digitally controlled oscillator of the MSP430, an RC-type oscillator. The digitally controlled oscillator is subject to tolerances, so you use a debounce delay to yield a worst-case minimum delay of 25 msec. That figure translates to a worst-case maximum delay of approximately 86 msec and a typical delay of approximately 40 msec. This range is eminently usable for keypad-debouncing purposes. After the debounce delay, the circuit scans the keypad to determine which key you depressed.

After you depress a key, the MSP430 goes into a "wait-for-release" mode, in which it drives only the necessary row for the key you depressed. (Other rows switch low.) The microcontroller reconfigures the P1.x I/O to interrupt on a falling edge, and it again goes into low-power Mode 4 and waits for the release of the key. Again, the circuit needs no polling at this point. The detection of the key release is completely interrupt-driven, allowing the MSP430 to stay asleep while the key is held, thereby reducing current consumption. Once you release the key, the circuit again executes the debounce-delay routine. After the debounce delay, the circuit again scans the keypad to determine whether any other keys are being held. If so, the wait-for-release mode continues. When all the keys are released, the MSP430 reverts to "wait-for-press" mode. During the wait-for release mode, only one row of the keypad goes high, thereby limiting the maximum current consumption to the condition in which all three keys on a single row are pressed. For a 3V system, this condition equates to approximately 2 µA. Any other key press does not result in increased current consumption, because the corresponding row is not in a high state. Click here to download the software for the microcontroller.

Is this the best Design Idea in this issue? Select at www.ednmag.com.

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES