The examples in this guide are no longer supported. Check out the MPR121 sensor guide for CircuitPython and Python usage: https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial/overview
Note: The latest Raspbian Jessie and Stetch releases changed the I2C driver to not support a repeated start mode used by the MPR121. See this thread for more details and a workaround (mentioned below): https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=184377

As noted above the latest Raspbian Jessie and Stretch releases have an updated I2C driver that isn't compatible with how this library enables repeated I2C start bits.  From the thread about this issue there's a workaround to enable the older I2C driver.  Edit the /boot/config.txt on your SD card and add:

dtoverlay=i2c-bcm2708

Then restart your Pi and you should be able to use the library below.  If this still fails you might need to fall back to an earlier version of Raspbian which comes with the older driver, see the historical Raspbian images here and pick one from 2016 like 2016-11-29.

Dependencies

Before you install the software you'll first need to install a few dependencies.  Make sure your Raspberry Pi or BeagleBone Black is connected to the internet with a wired or wireless connection.  Then connect to a terminal on the device using SSH and execute the commands:

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus python-pip git

When prompted to install the dependencies answer yes, and after a few moments the necessary libraries and software should be installed.  You can also ignore any messages about dependencies which are already installed.

Installation

Follow the steps below to install the software for the Python MPR121 library.  At a terminal execute the following commands to download the library into a subdirectory of your user's home directory.

cd ~
git clone https://github.com/adafruit/Adafruit_Python_MPR121.git

Next execute the following commands to install the library:

cd Adafruit_Python_MPR121
sudo python setup.py install

The setup script will download a few dependencies and install the library.  If there are errors, carefully check all the dependencies above were installed and try again.

That's it, the MPR121 library is now installed!  Continue on to learn how to run an example program and learn how to use the library.

This guide was first published on Dec 23, 2014. It was last updated on Mar 08, 2024.

This page (Software) was last updated on Mar 08, 2024.

Text editor powered by tinymce.