4x3 4x4 Matrix Keypad Interface with Atmel AVR Microcontrollers

Posted on Feb 6, 2014

Many application requires large number of keys connected to a computing system. Example includes a PC keyboard, Cell Phone keypad and Calculators. If we connect a single key to MCU, we just connect it directly to i/o line. But we cannot connect, say 10 or 100 keys directly MCUs i/o. Because :- We want to avoid all these troubles so we use some clever technique.

4x3 4x4 Matrix Keypad Interface with Atmel AVR Microcontrollers
Click here to download the full size of the above Circuit.

The technique is called multiplexed matrix keypad. In this technique keys are connected in a matrix (row/column) style as shown below. The rows R0 to R3 are connected to Input lines of Microcontroller. The i/o pins where they are connected are made Input. This is done by setting the proper DDR Register in AVR and TRIS Register in PIC. The column C0 to C3 are also connected to MCUs i/o line. These are kept at High Impedance State (AKA input), in high z state (z= impedance) state these pins are neither HIGH or LOW they are in TRISTATE. And in their PORT value we set them all as low, so as soon as we change their DDR bit to 1 they become output with value LOW. As you can see in the image above C0 is made LOW while all other Columns are in HIGH Z State. We can read the Value of R0 to R3 to get their pressed status. If they are high the button is NOT pressed. As we have enabled internal pullups on them, these pullups keep their value high when they are floating (that means NOT connected to anything). But when a key is pressed it is connected to LOW line from the column thus making it LOW. After that we make the C0 High Z again and make C1 LOW. And read R0 to R3 again. This gives us status of the second column of keys. Similarly we scan all columns. PORTA Port Driver - when any bit is set to 1 it appears as HIGH i. e. 5v. But this is the case only if that bit is OUTPUT. If it is input, setting any bit to 1 enables the internal...

Leave Comment

characters left:

Related Circuits

  • New Circuits



    Popular Circuits

    Current Limiting Power Supply
    TDA1524 Stereo Tone Control
    Bridge balance indicator
    Four-Quadrant Dimmer
    3-30V 3A Adjustable Regulated DC Power Supply
    Alarm Digital Clock-DS1307
    Rfrxd0420 Ask Receiver Reference Design
    Telephone call meter using calculator & COB
    ISL6528 Dual Regulator-Standard Buck PWM and Linear Power Controller
    1999 suburban: head lights checked fuses owners manual headlamps
    2x150W no large loop feedback hi-fi amplifier
    A small generator and network control circuit