

The MPR121 is a capacitive touch sensor controller capable of detecting touch inputs on up to 12 electrodes. It is designed to simplify the creation of touch-sensitive interfaces, eliminating the need for mechanical buttons. The MPR121 communicates via the I2C protocol, making it easy to integrate with microcontrollers such as Arduino, Raspberry Pi, and other embedded systems.








The MPR121 offers robust functionality for capacitive touch sensing. Below are its key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 1.71V to 3.6V |
| Communication Interface | I2C (up to 400 kHz) |
| Number of Touch Inputs | 12 electrodes |
| Maximum Current Consumption | 29 µA (typical, in run mode) |
| Electrode Sensitivity | Configurable via registers |
| Operating Temperature | -40°C to +85°C |
| Interrupt Output | Active-low interrupt pin (IRQ) |
The MPR121 is typically available in a 20-pin QFN package. Below is the pinout description:
| Pin | Name | Description |
|---|---|---|
| 1 | VDD | Power supply input (1.71V to 3.6V). |
| 2 | GND | Ground connection. |
| 3 | SDA | I2C data line. |
| 4 | SCL | I2C clock line. |
| 5 | IRQ | Interrupt output (active low). |
| 6-17 | ELE0-ELE11 | Electrode inputs for touch sensing. |
| 18 | RST | Reset pin (active low). |
| 19 | ADDR | I2C address selection pin (connect to GND or VDD to set address). |
| 20 | NC | No connection (leave unconnected). |
To use the MPR121 with an Arduino UNO, follow these steps:
Wiring:
VDD pin to the Arduino's 3.3V pin.GND pin to the Arduino's GND.SDA pin to the Arduino's A4 pin (I2C data line).SCL pin to the Arduino's A5 pin (I2C clock line).IRQ pin to any digital pin on the Arduino (e.g., D2).ADDR pin to GND or VDD to set the I2C address.Install the MPR121 Library:
Example Code: Use the following example code to detect touch inputs:
#include <Wire.h>
#include <Adafruit_MPR121.h>
// Create an MPR121 object
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);
while (!Serial) {
// Wait for the serial monitor to open
}
// Initialize the MPR121
if (!cap.begin(0x5A)) { // Default I2C address is 0x5A
Serial.println("MPR121 not found. Check wiring!");
while (1);
}
Serial.println("MPR121 initialized.");
}
void loop() {
// Read touch status
uint16_t touched = cap.touched();
for (uint8_t i = 0; i < 12; i++) {
// Check if electrode i is touched
if (touched & (1 << i)) {
Serial.print("Electrode ");
Serial.print(i);
Serial.println(" is touched.");
}
}
delay(100); // Small delay to avoid flooding the serial monitor
}
MPR121 Not Detected:
ADDR pin is set correctly. Use an I2C scanner sketch to confirm the address.Touch Inputs Not Detected:
Random Touch Events:
IRQ Pin Not Responding:
Q: Can the MPR121 detect proximity in addition to touch?
A: Yes, the MPR121 can detect proximity by combining multiple electrodes into a single sensing area.
Q: What is the maximum cable length for electrodes?
A: The maximum cable length depends on the environment and noise levels but is typically limited to a few centimeters for reliable operation.
Q: Can I use fewer than 12 electrodes?
A: Yes, unused electrode pins can be left unconnected or disabled in the configuration.
Q: How do I change the I2C address of the MPR121?
A: Connect the ADDR pin to GND (0x5A), VDD (0x5B), SDA (0x5C), or SCL (0x5D) to select one of four possible addresses.
By following this documentation, you can effectively integrate the MPR121 into your projects and create innovative touch-sensitive interfaces.