skip to navigation
skip to content

matrix_keypad 1.0.5

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

:Current Version: v1.0.5_

:Project Page: Project_Page_
:PyPI page: PyPI_Page_


:Author: Chris Crumpacker


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, Adafruit_I2C.py_ & Adafruit_MCP230xx.py_.


You can use the source from just downloading the files or Install it as a library via PIP::

pip install matrix_keypad

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

Version History


Initial Scripts


Initial package build


Initial package build and push to PyPI


Updating the to demo selecting the 4x4 keypad


Moved Version Log in README

Updated README Links


Updated References to include the PiLarm code as the inspiration for the "" code


Updates to the code in both main libs to fix some indenting and other issues from coping the code from blogger to a text file.

Updates to the keypad picking section for the constants to make it actually work

Code References

Column and Row scanning adapted from Bandono's matrixQPI_ which is wiringPi based. is based on some work that Jeff Highsmith had done in making his PiLarm_ that was featured on Make.

.. --------------------------------------------------------------------------
.. Links

.. _Project_Page:
.. _PyPI_Page:
.. _matrixQPI:
.. _PiLarm:
.. _PiLarm_Code:
.. _v1.0.1:
.. _v1.0.2:
.. _v1.0.3:
.. _v1.0.4:
.. _v1.0.5:  
File Type Py Version Uploaded on Size
matrix_keypad-1.0.5.tar.gz (md5) Source 2013-08-22 4KB (md5) Source 2013-08-22 9KB