• Channels
Part Inventory
Go
 
powered by:

 
  • Quick Poll
What Social Networking site do you use the most?



VOTE VIEW RESULTS
Previous Polls

Premium Content

New Signal Chain Technical Papers from Texas Instruments:

 

 

 

One-Pin Keypad Interface Conserves Battery Power


John Pote

November 11, 2002

Print
Reprints Comment Subscribe

This idea builds on a previous IFD, "Connect Any Keypad With Any Microcontroller Using Only One Pin" (electronic design, May 1, 1998, p. 126), where a 555 timer connects a keypad switch matrix to a microprocessor. The timer converts a key press to a frequency of 1 for each key, which the processor measures. The great advantage is that only one processor pin is required.

I was in exactly that situation—needing to connect a 4-by-4 switch matrix to a processor, but having only a few I/O pins left. This idea seemed ideal, except that I also needed low power, while the 555 timer always draws current. As that's not really good for battery operation, I modified the circuit (see the figure). Standby power consumption is now only the leakage of a CMOS IC.

A 74HC14 Schmitt inverter forms an oscillator when a key is pressed. U1C's output is fed back to U1A's input and the timing capacitor, C1. The circuit oscillates and a pulse waveform is output. Resistor networks, SIL1and SIL2, plus C1 set the timing of the pulses. Unfortunately, switching thresholds of a CMOS inverter don't have the same stability as a 555 timer. So using the resistors to select one of 16 frequencies might prove not stable enough with time—and especially temperature.

To overcome this problem, current steering diodes D1 to D10 were added. Now resistor networks SIL1 and SIL2 determine the mark and space output times, respectively. The mark and space have only four different times now, so small variations due to temperature won't cause misreading of a key. In the key matrix, the mark time gives the column, and the space time gives the row. A processor measures these times and uses simple threshold/lookup code to decode them and determine the key pressed. Observation of the output waveform on a scope revealed negligible interaction between a key's row and the mark (column) time, and the column and the space (row) time.

When no key is pressed, the feedback loop is broken and R1 pulls U1A's input to 0 V. Now all inverters have inputs and outputs at 0 V or VCC. So current drain reduces to the very low leakage of the 74HC14 package. This is ideal for battery operation because the circuit is normally off. But oscillation starts immediately when a key is pressed. If the input to the processor is interrupt driven, the processor can remain in sleep mode without even polling the keypad to see if a key is pressed.

Diodes D11 and D12 provide some temperature compensation in the manner described in the IFD, "A New Stable RC Pulse Generator" (electronic design, Feb. 8, 1999, p. 104). These diodes may be omitted if wide temperature-range operation isn't necessary. E-mail the author for code to interface to a PIC16C877.

ifd winners
Jim Lepkowski, ON Semiconductor, "Dual-Gate Inverter Oscillator Saves Power, Boosts LED Brightness," June 24, 2002.

Ricardo Jimenez, Neftali Salazar, and Mayoral Ulises, Technological Institute of Mexicali, "Two-Chip Digital Thermometer Delivers 0.4°C Accuracy," July 8, 2002.

Submit your own Ideas For Design to:
IFD@penton.com

This idea builds on a previous IFD, "Connect Any Keypad With Any Microcontroller Using Only One Pin" (electronic design, May 1, 1998, p. 126), where a 555 timer connects a keypad switch matrix to a microprocessor. The timer converts a key press to a frequency of 1 for each key, which the processor measures. The great advantage is that only one processor pin is required.

I was in exactly that situation—needing to connect a 4-by-4 switch matrix to a processor, but having only a few I/O pins left. This idea seemed ideal, except that I also needed low power, while the 555 timer always draws current. As that's not really good for battery operation, I modified the circuit (see the figure). Standby power consumption is now only the leakage of a CMOS IC.

A 74HC14 Schmitt inverter forms an oscillator when a key is pressed. U1C's output is fed back to U1A's input and the timing capacitor, C1. The circuit oscillates and a pulse waveform is output. Resistor networks, SIL1and SIL2, plus C1 set the timing of the pulses. Unfortunately, switching thresholds of a CMOS inverter don't have the same stability as a 555 timer. So using the resistors to select one of 16 frequencies might prove not stable enough with time—and especially temperature.

To overcome this problem, current steering diodes D1 to D10 were added. Now resistor networks SIL1 and SIL2 determine the mark and space output times, respectively. The mark and space have only four different times now, so small variations due to temperature won't cause misreading of a key. In the key matrix, the mark time gives the column, and the space time gives the row. A processor measures these times and uses simple threshold/lookup code to decode them and determine the key pressed. Observation of the output waveform on a scope revealed negligible interaction between a key's row and the mark (column) time, and the column and the space (row) time.

When no key is pressed, the feedback loop is broken and R1 pulls U1A's input to 0 V. Now all inverters have inputs and outputs at 0 V or VCC. So current drain reduces to the very low leakage of the 74HC14 package. This is ideal for battery operation because the circuit is normally off. But oscillation starts immediately when a key is pressed. If the input to the processor is interrupt driven, the processor can remain in sleep mode without even polling the keypad to see if a key is pressed.

Diodes D11 and D12 provide some temperature compensation in the manner described in the IFD, "A New Stable RC Pulse Generator" (electronic design, Feb. 8, 1999, p. 104). These diodes may be omitted if wide temperature-range operation isn't necessary. E-mail the author for code to interface to a PIC16C877.

ifd winners
Jim Lepkowski, ON Semiconductor, "Dual-Gate Inverter Oscillator Saves Power, Boosts LED Brightness," June 24, 2002.

Ricardo Jimenez, Neftali Salazar, and Mayoral Ulises, Technological Institute of Mexicali, "Two-Chip Digital Thermometer Delivers 0.4°C Accuracy," July 8, 2002.

Submit your own Ideas For Design to:
IFD@penton.com

Average (0 Ratings):

Subscribe
Subscribe to Electronic Design and start receiving more articles like this one
Filed Under:

Check for price and availability on Source ESB:

Go
powered by  
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
Acceptable Use Policy

Sponsored Links