Stufin
Home Quick Cart Profile

MPR121 - 12 Channel Capacitive Touch Sensor Controller Module - I2C Interface

Buy Now

Component Description

MPR121 - 12 Channel Capacitive Touch Sensor Controller Module - I2C Interface

Overview

The MPR121 is a 12-channel capacitive touch sensor controller module featuring an I2C interface. This compact module is designed to provide a reliable and intuitive way to detect touch inputs, making it an ideal solution for various applications, including human-machine interfaces, industrial control systems, and consumer electronics.

Functionality

The MPR121 module is a capacitive touch sensor controller that detects changes in capacitance when a user touches or approaches the sensor pads. The module uses a proprietary algorithm to detect and filter out Noise, ensuring accurate and reliable touch detection. The module's 12 channels can be connected to individual sensor pads, allowing for the creation of complex touch interfaces.

The MPR121 module communicates with a host microcontroller or processor through a standard I2C interface, enabling easy integration into a wide range of systems. The module's GPIO pins can be configured to generate interrupts, allowing the host system to respond quickly to touch events.

Key Features

12-Channel Capacitive Touch SensorSupports up to 12 individual sensor pads, enabling the creation of complex touch interfaces.
I2C InterfaceCommunicates with host systems through a standard I2C interface, facilitating easy integration and reducing wiring complexity.

Proprietary Noise Filtering Algorithm

Ensures accurate and reliable touch detection by filtering out electromagnetic interference (EMI) and other noise sources.

Interrupt Generation

GPIO pins can be configured to generate interrupts, enabling rapid response to touch events.

Low Power Consumption

Operates at a low power consumption level, making it suitable for battery-powered devices and energy-efficient systems.

Small Form Factor

Compact module design allows for easy integration into space-constrained applications.

Operating Voltage

2.5V to 5.5V, making it compatible with a wide range of host systems.

Operating Temperature

-40C to 85C

Supply Voltage

2.5V to 5.5V

I2C Clock FrequencyUp to 400 kHz

Touch Sensor Channels

12

Touch Sensitivity

Adjustable

Noise Filtering

Proprietary algorithm

Interrupt Pins

Configurable GPIO pins

Storage Temperature

-50C to 125C

Dimensions

15mm x 20mm (module size)

Applications

The MPR121 module is suitable for a wide range of applications, including

Human-machine interfaces (HMIs)

Industrial control systems

Consumer electronics (e.g., smartphones, tablets, and laptops)

Wearables and IoT devices

Medical devices

Automotive systems

Conclusion

The MPR121 module is a versatile and reliable capacitive touch sensor controller module that offers a high degree of accuracy and flexibility. Its I2C interface and interrupt generation capabilities make it an ideal solution for a wide range of applications, from simple touch interfaces to complex industrial control systems.

Pin Configuration

  • MPR121 - 12 Channel Capacitive Touch Sensor Controller Module - I2C Interface Pinout Explanation
  • The MPR121 is a 12-channel capacitive touch sensor controller module that communicates with a microcontroller through the I2C interface. It has a total of 8 pins, which are explained below:
  • Pinout:
  • 1. VCC:
  • Function: Power Supply Pin
  • Description: This pin is used to supply power to the module. Typically, a 3.3V or 5V power supply is used.
  • Connection: Connect to the positive terminal of the power supply (3.3V or 5V).
  • 2. GND:
  • Function: Ground Pin
  • Description: This pin is used as a ground reference for the module.
  • Connection: Connect to the negative terminal of the power supply (GND).
  • 3. SCL:
  • Function: I2C Clock Pin
  • Description: This pin is used for the I2C clock signal, which synchronizes data transmission between the MPR121 and the microcontroller.
  • Connection: Connect to the I2C clock pin (SCL) of the microcontroller.
  • 4. SDA:
  • Function: I2C Data Pin
  • Description: This pin is used for I2C data transmission between the MPR121 and the microcontroller.
  • Connection: Connect to the I2C data pin (SDA) of the microcontroller.
  • 5. INT:
  • Function: Interrupt Pin
  • Description: This pin is used to trigger an interrupt on the microcontroller when a touch event is detected on any of the 12 channels.
  • Connection: Connect to an interrupt pin on the microcontroller (optional, but recommended for efficient processing).
  • 6. BUSY:
  • Function: Busy Pin
  • Description: This pin indicates when the MPR121 is busy processing data or executing a command.
  • Connection: Connect to a digital input pin on the microcontroller to monitor the busy status (optional, but recommended for proper communication).
  • 7. RST:
  • Function: Reset Pin
  • Description: This pin is used to reset the MPR121 to its default state.
  • Connection: Connect to a digital output pin on the microcontroller, and briefly pulse the pin low (0V) to reset the MPR121 (if necessary).
  • Note: There is no pin number 8, as the module has only 7 pins.
  • Additional Connections:
  • To use the MPR121 as a capacitive touch sensor, you need to connect the sensor electrodes to the 12 channel pins (CH0-CH11) on the module. These pins are not listed above, as they are not part of the main pinout.
  • Connect the sensor electrodes (e.g., copper pads or sensors) to the corresponding channel pins (CH0-CH11) according to your specific design requirements.
  • Important:
  • Make sure to use a suitable pull-up resistor (e.g., 1k-10k) on the I2C bus (SCL and SDA pins) to ensure reliable communication.
  • Use a decoupling capacitor (e.g., 100nF-1uF) between VCC and GND to filter out noise and ensure stable operation.
  • By connecting the pins as described above, you can successfully integrate the MPR121 capacitive touch sensor controller module into your IoT project.

Code Examples

MPR121 - 12 Channel Capacitive Touch Sensor Controller Module - I2C Interface
Overview
The MPR121 is a 12-channel capacitive touch sensor controller module that communicates with a microcontroller through an I2C interface. This module is ideal for applications requiring multiple touch sensors, such as touch panels, keypads, and buttons.
Features
12 independent touch sensors
 I2C interface for communication with microcontrollers
 Adjustable sensitivity and filtering
 Supports multiple touch detection
 Low power consumption
Pinout
| Pin | Function |
| --- | --- |
| VCC | Power supply (3.3V or 5V) |
| GND | Ground |
| SCL | I2C clock line |
| SDA | I2C data line |
| INT | Interrupt output (optional) |
| ADDR | Address select (optional) |
Code Examples
### Example 1: Basic Touch Sensor Reading with Arduino
This example demonstrates how to read touch sensor data using an Arduino Uno board and the MPR121 module.
```c++
#include <Wire.h>
#define MPR121_ADDR 0x5A // Default I2C address
void setup() {
  Serial.begin(9600);
  Wire.begin();
}
void loop() {
  uint16_t touchData = 0;
  Wire.beginTransmission(MPR121_ADDR);
  Wire.write(0x00); // Register address for touch data
  Wire.endTransmission();
  Wire.requestFrom(MPR121_ADDR, 2);
  touchData = Wire.read() << 8 | Wire.read();
  Serial.print("Touch data: 0x");
  Serial.println(touchData, HEX);
if (touchData & (1 << 0)) { // Check if touch sensor 0 is touched
    Serial.println("Touch sensor 0 is touched!");
  }
delay(50);
}
```
### Example 2: Touch Sensor with Interrupt Handling using Raspberry Pi (Python)
This example demonstrates how to read touch sensor data and handle interrupts using a Raspberry Pi and the MPR121 module.
```python
import smbus
import RPi.GPIO as GPIO
# Set up I2C bus and GPIO for interrupt handling
bus = smbus.SMBus(1)
mpr121_addr = 0x5A
GPIO.setmode(GPIO.BCM)
int_pin = 17
GPIO.setup(int_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def read_touch_data():
  data = bus.read_i2c_block_data(mpr121_addr, 0x00, 2)
  return (data[0] << 8) | data[1]
while True:
  if GPIO.input(int_pin) == 0: # Interrupt triggered
    touch_data = read_touch_data()
    print("Touch data: 0x{:04X}".format(touch_data))
    if touch_data & (1 << 0): # Check if touch sensor 0 is touched
      print("Touch sensor 0 is touched!")
time.sleep(0.01)
```
### Example 3: Multi-Touch Detection with ESP32 (MicroPython)
This example demonstrates how to detect multiple touch sensors using an ESP32 board and the MPR121 module.
```python
import machine
import utime
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21))
mpr121_addr = 0x5A
def read_touch_data():
  data = i2c.readfrom_mem(mpr121_addr, 0x00, 2)
  return (data[0] << 8) | data[1]
while True:
  touch_data = read_touch_data()
  touches = []
  for i in range(12):
    if touch_data & (1 << i):
      touches.append(i)
  if touches:
    print("Touches:", touches)
  utime.sleep_ms(50)
```
Note: These examples are for illustration purposes only and might require modifications to work with your specific setup. Be sure to check the datasheet and documentation for the MPR121 module and your microcontroller board for more information.