skip to navigation
skip to content

matrix_keypad 1.0.3

Matrix Keypad

Latest Version: 1.2.2


Python Library for Matrix Keypads. Written and tested on a Model B Raspberry Pi. Supports both a 3x4 and 4x4 keypad included

Project Page:Project_Page
PyPI page:PyPI_Page


If the I2C Port expander MCP23017 or MCP23008 is being used, the Adafruit Python library for I2C and the MCP will need to be installed.

You can clone the whole library like so:

git clone

or the two files needed can be pulled out, &


Files Included



See the demo scripts included to see this all in action.

To call the library select which one you intend to use and use the correct line:

from matrixKeypad_MCP230xx import keypad


from matrixKeypad_RPi_GPIO import keypad

Then name the library so it is easier to reference later:

kp = keypad()

It is possible to just check to see if a digit is currently pressed.:

checkKeypad = kp.getKey()

Or a simple function to call the keypad library and loop through it waiting for a digit press

def digit():
    # Loop while waiting for a keypress
    digitPressed = None
    while digitPressed == None:
        digitPressed = kp.getKey()
    return digitPressed


v0.1.0:Initial Scripts
v1.0.0:Initial package build
v1.0.1:Initial package build and push to PyPI
v1.0.2:Updating the to demo selecting the 4x4 keypad
v1.0.3:Moved Version Log in README Updated README Links


Column and Row scanning adapted from Bandono’s matrixQPI which is wiringPi based.

File Type Py Version Uploaded on Size
matrix_keypad-1.0.3.tar.gz (md5) Source 2013-08-19 3KB (md5) Source 2013-08-19 7KB