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

Highly Integrated 20A Digital Power Module for High Current Applications

March 20, 2024
Renesas latest power module delivers the highest efficiency (up to 94% peak) and fast time-to-market solution in an extremely small footprint. The RRM12120 is ideal for space...

Empowering Innovation: Your Power Partner for Tomorrow's Challenges

March 20, 2024
Discover how innovation, quality, and reliability are embedded into every aspect of Renesas' power products.

Article: Meeting the challenges of power conversion in e-bikes

March 18, 2024
Managing electrical noise in a compact and lightweight vehicle is a perpetual obstacle

Power modules provide high-efficiency conversion between 400V and 800V systems for electric vehicles

March 18, 2024
Porsche, Hyundai and GMC all are converting 400 – 800V today in very different ways. Learn more about how power modules stack up to these discrete designs.

Comments

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