One-Pin Keypad Features Low Component Count

May 26, 2003
Building on the recent Design Brief theme of one-pin keypads, this design uses only one analog microcontroller (MCU) input to scan numerous keys, plus one resistor per key and another resistor and capacitor. The circuit is simply a crude...

Building on the recent Design Brief theme of one-pin keypads, this design uses only one analog microcontroller (MCU) input to scan numerous keys, plus one resistor per key and another resistor and capacitor. The circuit is simply a crude digital-to-analog converter. The MCU reads the analog voltage and quickly computes which key is pressed.

The figure shows the circuit's layout. When a key is pressed, a voltage divider is created and the signal KEY drops from VCC to a lower voltage. The capacitor suppresses noise. The MCU scans the KEY signal periodically—every 10 to 50 ms—and qualifies the key press when the voltage drops below VCC. Using VCC as the analog-to-digital converter's (ADC's) reference ensures that drift and regulator tolerance won't affect system operation.

To compute the resistor values, first choose the pull-up resistor. In this example, R1 = 10 kÙ. Some ADC inputs require lower input impedances for the rated conversion speed. But to save power, you can get away with higher values at low conversion speeds.

Next, note that the divider network must slice the MCU's ADC digital range into equal-sized bins. If B is the bin size, N represents the number of bits in the ADC, and K the number of keys scanned:

B = 2N/K

For a 10-bit converter scanning eight keys, B = 1024/8 = 128 counts per bin. The edges of the bins are simply multiples of this number.

To compute the target "key-pressed" value in the middle of each bin for each key, k (starting at k = 0), we have:

Xk = kB + B/2

For the 10-bit example, the threshold for the first bin is 64, for the second bin 64 + 128 = 192, and so on.

The value of the resistor attached to each switch is then:

R = (Xk R1)/(2N − Xk)

So the first bin's resistor is 667 Ù, the second is 2308 Ù, etc. The closest 5% values are shown in the figure.

The resistor tolerance must be chosen according to the number of keys and bins. With eight keys, the bins are 1/8 = 12.5% wide. By carefully selecting the values, ±5% resistors may be used while keeping each key's voltage within its bin. For 16 or more keys, the bin size is 6.25%, and you will need 1% resistors to ensure that each key's voltage stays within its bin.

This technique really suits low-power systems because the keypad draws zero power until a key is pressed. If the MCU's analog input can be configured for wake-on-pin-change, then the MCU can go to sleep until a key is pressed.

Sponsored Recommendations

TTI Transportation Resource Center

April 8, 2024
From sensors to vehicle electrification, from design to production, on-board and off-board a TTI Transportation Specialist will help you keep moving into the future. TTI has been...

Cornell Dubilier: Push EV Charging to Higher Productivity and Lower Recharge Times

April 8, 2024
Optimized for high efficiency power inverter/converter level 3 EV charging systems, CDE capacitors offer high capacitance values, low inductance (< 5 nH), high ripple current ...

TTI Hybrid & Electric Vehicles Line Card

April 8, 2024
Components for Infrastructure, Connectivity and On-board Systems TTI stocks the premier electrical components that hybrid and electric vehicle manufacturers and suppliers need...

Bourns: Automotive-Grade Components for the Rough Road Ahead

April 8, 2024
The electronics needed for transportation today is getting increasingly more demanding and sophisticated, requiring not only high quality components but those that interface well...

Comments

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