The MPR121 Capacitive Touch Keypad is an innovative touch-sensitive input device that leverages capacitive sensing technology to detect touch or proximity. It is designed to interface with a wide range of electronic projects and consumer products, providing a reliable and user-friendly interface. Common applications include touch-enabled keyboards, keypads, touch screens, and interactive surfaces.
Pin Number | Pin Name | Description |
---|---|---|
1 | SDA | Serial Data Line for I2C communication |
2 | SCL | Serial Clock Line for I2C communication |
3 | IRQ | Interrupt Request (active low) |
4 | ADDR | I2C Address select (tie to GND or VCC) |
5 | VSS | Ground |
6 | VDD | Power supply (2.5V to 3.6V) |
#include <Wire.h>
#include <Adafruit_MPR121.h>
// You can have up to 4 on one i2c bus (by setting the ADD pin
// to different values), but this example will just use one
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);
while (!Serial) { // Necessary to wait for 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
uint16_t touched = cap.touched();
for (uint8_t i=0; i<12; i++) {
// Check if each pin is touched
if (touched & (1 << i)) {
Serial.print("C"); Serial.print(i); Serial.println(" is touched");
}
}
// Optional: add a delay between reads for stability
delay(100);
}
Q: Can the MPR121 operate at 5V? A: No, the MPR121 is designed to operate between 2.5V and 3.6V. Using a higher voltage can damage the device.
Q: How many touch sensors can I connect to a single microcontroller? A: You can connect up to 4 MPR121 sensors to a single I2C bus by using different ADDR pin configurations.
Q: Is it possible to detect the position of a swipe across multiple electrodes? A: The MPR121 can detect multiple simultaneous touches, but interpreting a swipe pattern requires additional software algorithms to process the touch data.
Remember to always consult the MPR121 datasheet for the most detailed and specific information regarding the operation and limitations of the device.