Electronic Design

  
Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


[Ideas For Design]
Power-Saving Keypad Controls Multiple Keys Through One MCU Pin

Mehmet Efe Ozbek  |   ED Online ID #16242  |   August 16, 2007


Traditionally, interfacing a microcontroller with an n-by-m keypad required n + m of the microcontroller's I/O pins for keypad scanning. Keypad designs that conserve microcontroller pins have been developed, but they require additional resources, such as external ICs or a built-in analog-to-digital converter (ADC). The design presented here uses only one I/O pin and requires only resistors and a capacitor as external components.

I/O is a bidirectional pin initially configured as an input (see the figure). When no key is pressed, the capacitor is discharged and the pull-up resistor, RH, keeps I/O High. The microcontroller is in sleep mode and will wake up only when a change in I/O's state generates an interrupt. When a key is pressed, I/O changes to Low, since the pull-down network is stronger than the pull-up. The microcontroller then wakes up to execute the following steps:

  1. Wait for contact debouncing.
  2. Change I/O to an output and set it High. The capacitor then starts charging to the High-state voltage. The charging time, Ti, is determined by the key pressed and its associated R (1, 2,…i).
  3. Wait until T1.
  4. Make I/O an input. Charging of C pauses.
  5. If I/O is High, key 1 was pressed. If I/O is Low, make I/O an output and set it High to continue charging.
  6. Wait until T2.
  7. Make I/O an input. Charging of C pauses.
  8. If I/O is High, key 2 was pressed. If I/O is Low, make I/O an output and set it High to continue charging.
  9. Continue for T3 through Ti.

Resistors should be chosen to make T1 < T2 < T3

Charging time can be determined as follows: When charging pauses, the voltage at I/O is (Equation 1) where VC is the capacitor voltage (Equation 2). Equation 3 solves the charging time by equating VI/O to the switching threshold voltage VTH. Here, VTH is the switching threshold voltage for I/O.

As Ri is increased, Ti initially increases. But then it reaches a maximum and starts to decrease. This imposes an upper limit on Ri and, hence, on the number of keys that can be connected to the circuit.

Ti may vary between Ti,min and Ti,max due to resistor tolerances and variations in VTH. Therefore, the values should be chosen so that Ti,max < Ti+1,min. Assuming resistors with 5% tolerances and a maximum VTH variation of 5%, a maximum of 15 keys can be connected to the circuit using the following Ri values (in kΩ): 0.01, 0.27, 0.62, 1.1, 1.8, 2.7, 3.9, 5.6, 8.2, 11, 15, 22, 30, 43, and 68. The number of keys can be increased if resistor tolerances are tighter.

This design saves power in three ways. First, energy of CV2 is dissipated each time a capacitor is charged to V and discharged. In this design, charging stops as soon as I/O goes High and the capacitor is charged to about VTH (less than 2 V), rather than VDD. Second, the capacitor is charged (and discharged) only once for each key press. Finally, after determining which key was pressed, the microcontroller enters sleep mode and remains asleep until the key is released and the state of I/O changes back to High. So even when some of the keys are stuck or held down, power consumption is minimized.


Reprints   Printer-Friendly  Email this Article  RSS    Font Size   What's This?


  • C Tools Accelerate HDV Development On Xilinx FPGAs
  • A New Design Inflection Point
  • Forecasting Industry Growth For 2009 And Beyond
  • EDA Retools To Exploit Multicore Architectures
  • Design And Verification Move Up In Abstraction
  • EDA Retools To Exploit Multicore Architectures
  • A New Design Inflection Point
  • Design And Verification Move Up In Abstraction
    1) Transportation Guidelines For Lithium Batteries Get Updated
    (1239 views today)
    2) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (284 views today)
    3) WHITE PAPER: Liquid-Level Monitoring Using a Pressure Sensor
    (214 views today)
    4) 1-A Switching Regulators Operate With 96% Efficiency To Replace Linear Regulators
    (142 views today)
    5) The Field Of Energy Harvesting Begins To Ripen
    (108 views today)
    ALL TOP 20



    Reader Comments

    Rating Only

    Rating Only -September 05, 2007   (Article Rating: )

    Rating Only

    Rating Only -September 05, 2007   (Article Rating: )

    POST YOUR COMMENTS HERE
    Name:

    Email:
    Your Comments:

    Enter the text from the image below


    Please refresh the page if you have trouble reading this text.

    Search Electronic Design
         
      
     
    Web Seminar
    Sponsored By:
    Title: Read Pacing: A Performance Enhancing Feature of PCI Express Gen 2 Switch Devices
    Speakers: 
    Date: 07/01/08
    Register: 

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources