The Adafruit MPR121 Gator is a capacitive touch sensor breakout board that provides an easy way to add touch input to your projects. It is based on the MPR121 chip, which is capable of detecting up to 12 individual touch points. This component is commonly used in interactive projects, touch interfaces, and can be easily interfaced with microcontrollers such as the Arduino UNO.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply input (2.5V to 3.6V) |
2 | 3Vo | 3.3V output from the onboard regulator |
3 | GND | Ground connection |
4 | SDA | I2C data line |
5 | SCL | I2C clock line |
6-17 | 0-11 | Capacitive touch sensor inputs |
#include <Wire.h>
#include <Adafruit_MPR121.h>
// Create an MPR121 instance
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);
Wire.begin();
// Initialize communication with MPR121
if (!cap.begin(0x5A)) {
Serial.println("MPR121 not found");
while (1);
}
Serial.println("MPR121 found!");
}
void loop() {
// Read the touched status
uint16_t touched = cap.touched();
for (uint8_t i = 0; i < 12; i++) {
// Check if each sensor is touched
if (touched & (1 << i)) {
Serial.print("Sensor ");
Serial.print(i);
Serial.println(" is touched");
}
}
// Small delay to avoid flooding the serial output
delay(100);
}
Q: Can I use the MPR121 Gator with a 5V microcontroller? A: Yes, but ensure that the MPR121 Gator is powered with a voltage between 2.5V and 3.6V. Use level shifters if necessary for the I2C lines.
Q: How can I extend the touch sensors? A: You can attach conductive materials (e.g., copper tape, conductive thread) to the sensor inputs to create larger touch areas.
Q: What is the maximum distance for the touch sensors? A: The distance depends on the material and size of the touch area, as well as the sensor's calibration. Typically, it works best with direct contact or very close proximity.