The Adafruit MPR121 Capacitive Touch Shield is an add-on for Arduino boards that enables capacitive touch sensing. This technology is commonly used in touchscreens and touchpads, allowing users to interact with electronic devices through touch. The shield is based on the MPR121 integrated circuit, which can handle up to 12 individual touch pads. Common applications include touch interfaces, interactive installations, and prototypes that require user input without mechanical buttons.
Pin Label | Description |
---|---|
GND | Ground connection |
5V | Power supply from Arduino (5V) |
SCL | I2C clock line |
SDA | I2C data line |
IRQ | Interrupt request (active low) |
ADDR | I2C address select (connect to GND or 3.3V) |
Here is a simple example to read touch inputs from the MPR121 shield using an Arduino UNO:
#include <Wire.h>
#include <Adafruit_MPR121.h>
// You can have up to 4 on one i2c bus (connecting ADDR to 3V, SDA or SCL)
// but one is enough for testing!
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);
while (!Serial) { // Necessary to wait for Serial connection on some boards
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(" touched!");
}
}
// Optional: add a delay between reads to limit data to the serial output
delay(100);
}
Q: Can I use the MPR121 shield with a 3.3V Arduino board? A: Yes, the MPR121 can operate at 3.3V, but ensure that the logic levels are compatible.
Q: How can I change the sensitivity of the touch inputs? A: Sensitivity can be adjusted by configuring the internal registers of the MPR121. Refer to the datasheet and the Adafruit library for detailed instructions.
Q: What materials can be used for the touch pads? A: Conductive materials such as copper tape, conductive ink, or even fruits can be used as touch pads.
Q: How do I use the interrupt feature? A: Connect the IRQ pin to an interrupt-capable pin on your Arduino and configure it in your sketch to trigger when a touch event occurs.
For further assistance, consult the Adafruit forums or the extensive online community resources dedicated to Arduino and Adafruit products.