The MPR121 Capacitive Touch Keypad is an innovative electronic component that utilizes capacitive sensing technology to detect touch or proximity. This keypad is designed to interface with a wide range of microcontrollers, including the popular Arduino platform, making it an ideal choice for adding touch input to your projects. Common applications include touch-based user interfaces, interactive installations, and custom keyboards.
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 (connect to GND or VCC) |
5 | VSS | Ground |
6 | VDD | Power Supply (2.5V to 3.6V) |
Connecting the Keypad:
VDD
to the 3.3V output on the Arduino.VSS
to the ground (GND).SDA
and SCL
to the corresponding I2C pins on the Arduino.IRQ
to an interrupt-capable pin on the Arduino.ADDR
to GND
or VCC
.Library Installation:
Programming the Arduino:
#include <Wire.h>
#include <Adafruit_MPR121.h>
// You can have up to 4 on one i2c bus (connecting ADDR to different pins),
// but this example will just use one
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);
while (!Serial) { } // Wait for serial console to open, if necessary
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(" touched!");
}
}
// Optional: add a small delay to avoid overwhelming the serial port
delay(100);
}
Q: Can I use the MPR121 with a 5V microcontroller? A: Yes, but ensure that the MPR121's VDD is connected to a 3.3V supply, and use level shifters for the I2C lines if necessary.
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 connections for each sensor.
Q: Can the MPR121 detect touch through materials? A: Yes, the MPR121 can detect touch through non-conductive materials like plastic or glass, depending on the thickness and the calibration.
For further assistance, consult the MPR121 datasheet and the library documentation for in-depth information on configuring and using the device.