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

    Transmit Time Limiter
    Audio Line Driver Circuit
    Fantastic Simulated Laser Circuit
    Inclinometer
    Digital Decade Counter Schematic
    Combinatorial and Sequential Circuits
    VCR Robot
    CRYSTAL TESTER
    PIC-based circuit example from Westford MicroSystems repeater for GPS data and battery voltage monitor
    Peak Reading Audio Level Meter
    Bandwidth broadband linear detector circuit schematic of 10MHz



    Top