Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use MPR121: Examples, Pinouts, and Specs

Image of MPR121
Cirkit Designer LogoDesign with MPR121 in Cirkit Designer

Introduction

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.

Explore Projects Built with 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!
Touch-Sensitive Interface with Adafruit MPR121 and Feather 32u4 Bluefruit
Image of MPR121: A project utilizing MPR121 in a practical application
This circuit integrates an Adafruit MPR121 capacitive touch sensor with an Adafruit Feather 32u4 Bluefruit microcontroller. The MPR121 is powered by the Feather and communicates via I2C (SCL and SDA) to detect touch inputs, which can be processed or transmitted wirelessly by the Feather.
Cirkit Designer LogoOpen Project in Cirkit Designer
Adafruit Feather 32u4 Bluefruit with MPR121 Capacitive Touch Sensor Interface
Image of ALi WTSE: A project utilizing MPR121 in a practical application
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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Weather Station with SparkFun Pro Micro and NRF24L01
Image of Monitoring Suhu TX: A project utilizing MPR121 in a practical application
This circuit is a solar-powered environmental monitoring system that measures temperature and humidity using a DHT11 sensor and transmits the data wirelessly via an NRF24L01 module. The system is powered by a 18650 Li-ion battery, which is charged by a solar cell through a TP4056 charging module, and controlled by a SparkFun Pro Micro microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO R4 WiFi Capacitive Touch MIDI Controller with Visual Feedback and Sound Playback
Image of 自适应乐器: A project utilizing MPR121 in a practical application
This circuit is an interactive touch-based MIDI controller and audio player. It uses an Arduino UNO R4 WiFi to interface with an MPR121 capacitive touch sensor for input, a MAX7219 8-digit 7-segment display for visual feedback, and a DFPlayer MINI for audio output through a loudspeaker. The system detects touch inputs, plays corresponding sounds, and sends MIDI notes.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with 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 MPR121: A project utilizing MPR121 in a practical application
Touch-Sensitive Interface with Adafruit MPR121 and Feather 32u4 Bluefruit
This circuit integrates an Adafruit MPR121 capacitive touch sensor with an Adafruit Feather 32u4 Bluefruit microcontroller. The MPR121 is powered by the Feather and communicates via I2C (SCL and SDA) to detect touch inputs, which can be processed or transmitted wirelessly by the Feather.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ALi WTSE: A project utilizing 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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Monitoring Suhu TX: A project utilizing MPR121 in a practical application
Battery-Powered Weather Station with SparkFun Pro Micro and NRF24L01
This circuit is a solar-powered environmental monitoring system that measures temperature and humidity using a DHT11 sensor and transmits the data wirelessly via an NRF24L01 module. The system is powered by a 18650 Li-ion battery, which is charged by a solar cell through a TP4056 charging module, and controlled by a SparkFun Pro Micro microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of 自适应乐器: A project utilizing MPR121 in a practical application
Arduino UNO R4 WiFi Capacitive Touch MIDI Controller with Visual Feedback and Sound Playback
This circuit is an interactive touch-based MIDI controller and audio player. It uses an Arduino UNO R4 WiFi to interface with an MPR121 capacitive touch sensor for input, a MAX7219 8-digit 7-segment display for visual feedback, and a DFPlayer MINI for audio output through a loudspeaker. The system detects touch inputs, plays corresponding sounds, and sends MIDI notes.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Touch-sensitive control panels
  • Interactive displays
  • Wearable devices
  • Home automation systems
  • Musical instruments and toys
  • Proximity sensing applications

Technical Specifications

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)

Pin Configuration

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).

Usage Instructions

Connecting the MPR121 to an Arduino UNO

To use the MPR121 with an Arduino UNO, follow these steps:

  1. Wiring:

    • Connect the VDD pin to the Arduino's 3.3V pin.
    • Connect the GND pin to the Arduino's GND.
    • Connect the SDA pin to the Arduino's A4 pin (I2C data line).
    • Connect the SCL pin to the Arduino's A5 pin (I2C clock line).
    • Connect the IRQ pin to any digital pin on the Arduino (e.g., D2).
    • Optionally, connect the ADDR pin to GND or VDD to set the I2C address.
  2. Install the MPR121 Library:

    • Open the Arduino IDE.
    • Go to Sketch > Include Library > Manage Libraries.
    • Search for "Adafruit MPR121" and install the library.
  3. 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
    }
    

Important Considerations

  • Power Supply: The MPR121 operates at 3.3V. If using a 5V microcontroller, use a level shifter for the I2C lines.
  • Electrode Design: Ensure proper electrode design and layout for optimal touch sensitivity.
  • Pull-up Resistors: Use appropriate pull-up resistors (typically 4.7kΩ) on the SDA and SCL lines if not already present.
  • Interrupt Pin: The IRQ pin can be used to detect touch events without continuously polling the sensor.

Troubleshooting and FAQs

Common Issues

  1. MPR121 Not Detected:

    • Cause: Incorrect wiring or I2C address mismatch.
    • Solution: Verify connections and ensure the ADDR pin is set correctly. Use an I2C scanner sketch to confirm the address.
  2. Touch Inputs Not Detected:

    • Cause: Poor electrode design or improper grounding.
    • Solution: Check electrode connections and ensure they are properly grounded.
  3. Random Touch Events:

    • Cause: Electrical noise or improper sensitivity settings.
    • Solution: Adjust sensitivity registers in the MPR121 configuration.
  4. IRQ Pin Not Responding:

    • Cause: IRQ pin not connected or misconfigured.
    • Solution: Ensure the IRQ pin is connected to the correct Arduino pin and configured as an input.

FAQs

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.