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

Board-Mount DC/DC Converters in Medical Applications

March 27, 2024
AC/DC or board-mount DC/DC converters provide power for medical devices. This article explains why isolation might be needed and which safety standards apply.

Use Rugged Multiband Antennas to Solve the Mobile Connectivity Challenge

March 27, 2024
Selecting and using antennas for mobile applications requires attention to electrical, mechanical, and environmental characteristics: TE modules can help.

Out-of-the-box Cellular and Wi-Fi connectivity with AWS IoT ExpressLink

March 27, 2024
This demo shows how to enroll LTE-M and Wi-Fi evaluation boards with AWS IoT Core, set up a Connected Health Solution as well as AWS AT commands and AWS IoT ExpressLink security...

How to Quickly Leverage Bluetooth AoA and AoD for Indoor Logistics Tracking

March 27, 2024
Real-time asset tracking is an important aspect of Industry 4.0. Various technologies are available for deploying Real-Time Location.

Comments

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