Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit MPR121: Examples, Pinouts, and Specs

Image of Adafruit MPR121Design with Adafruit MPR121 in Cirkit Designer

Introduction

The Adafruit MPR121 is a capacitive touch sensor module that features the MPR121 touch controller IC. It is designed to detect electrical changes on its 12 input pins that occur when a touch or proximity event is detected. This module is commonly used in creating touch interfaces, adding touch buttons to electronic projects, and in applications requiring user input without mechanical buttons.

Explore Projects Built with Adafruit MPR121

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Adafruit Feather 32u4 Bluefruit with MPR121 Capacitive Touch Sensor Interface: A project utilizing Adafruit MPR121 in a practical application
Adafruit Feather 32u4 Bluefruit with MPR121 Capacitive Touch Sensor Interface

This circuit integrates an Adafruit MPR121 capacitive touch sensor with an Adafruit Feather 32u4 Bluefruit microcontroller. The MPR121 is powered by the 3.3V supply from the Feather and communicates with the microcontroller via I2C, with SCL connected to pin 3 and SDA connected to pin 2 of the Feather. This setup allows the Feather to detect touch inputs from the MPR121 for further processing or wireless communication.

Open Project in Cirkit Designer
Image of Arduino UNO-Based Sensor Data Acquisition System with Bluetooth and Wi-Fi Connectivity: A project utilizing Adafruit MPR121 in a practical application
Arduino UNO-Based Sensor Data Acquisition System with Bluetooth and Wi-Fi Connectivity

This circuit is a multi-sensor data acquisition system with wireless communication capabilities. It utilizes an Arduino UNO to interface with an MPU-6050 gyroscope, an Adafruit ADXL345 accelerometer, an Adafruit MPR121 capacitive touch sensor, and a SparkFun Electret Microphone for audio input. The system can transmit sensor data via an HC-05 Bluetooth module and an ESP8266 WiFi module, and it includes a bi-directional logic level converter for voltage level matching between devices. The circuit is powered by a 9V battery connected to the Arduino's Vin pin.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VIN Supply voltage (2.5V to 3.6V)
2 3Vo 3.3V output from the onboard regulator
3 GND Ground connection
4 SDA I2C data line
5 SCL I2C clock line
6 IRQ Interrupt output (active low)
7-18 0-11 Capacitive touch input pins

Usage Instructions

Integration into a Circuit

  1. Connect the VIN pin to a 2.5V to 3.6V power supply.
  2. Connect the GND pin to the ground of the power supply.
  3. Connect the SDA and SCL pins to the I2C data and clock lines of your microcontroller, respectively.
  4. Optionally, connect the IRQ pin to an interrupt-capable pin on your microcontroller to detect touch events.
  5. Connect any of the touch input pins (0-11) to the conductive material or object you wish to use as a touch sensor.

Important Considerations and Best Practices

Example Code for Arduino UNO

#include <Wire.h>
#include <Adafruit_MPR121.h>

// You can have up to 4 on one i2c bus (connecting ADDR to 3V, 
// setting the jumpers to different combinations of connecting them to ground)
Adafruit_MPR121 cap = Adafruit_MPR121();

void setup() {
  Serial.begin(9600);
  while (!Serial) { // Needed to start serial on some platforms
    delay(10);
  }
  
  if (!cap.begin(0x5A)) {
    Serial.println("MPR121 not found, check wiring?");
    while (1);
  }
  Serial.println("MPR121 found!");
}

void loop() {
  // Get the currently touched pads
  currtouched = cap.touched();
  
  for (uint8_t i=0; i<12; i++) {
    // it if *is* touched and *wasnt* touched before, alert!
    if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.println(" touched");
    }
    // if it *was* touched and now *isnt*, alert!
    if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) {
      Serial.print(i); Serial.println(" released");
    }
  }

  // reset our state
  lasttouched = currtouched;
  
  // comment out this line for detailed data from the sensor!
  delay(100);
}

Troubleshooting and FAQs

Common Issues

Solutions and Tips for Troubleshooting

FAQs

Q: Can I use the MPR121 with a 5V microcontroller? A: Yes, but ensure that the MPR121 module is powered with a voltage within its operating range (2.5V to 3.6V). Use level shifters if necessary for the I2C lines.

Q: How can I change the sensitivity of the touch inputs? A: Sensitivity can be adjusted by writing to the MPR121's internal registers. Refer to the MPR121 datasheet for detailed register settings.

Q: How many MPR121 modules can I connect to a single I2C bus? A: You can connect up to 4 MPR121 modules to a single I2C bus by setting different I2C addresses using the address jumpers on the back of the module.