The Adafruit CAP1188 is a versatile capacitive touch sensor breakout board that provides an easy way to integrate touch-sensitive input into your electronic projects. With eight individual touch sensors, it is ideal for creating touch-sensitive buttons, sliders, and proximity sensing applications. The CAP1188 can be used in a wide range of projects, from simple DIY crafts to complex interactive installations.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply (2.7V - 5.5V) |
2 | GND | Ground connection |
3 | SDA | I2C Data line |
4 | SCL | I2C Clock line |
5 | MISO | SPI Data Out (Master In, Slave Out) |
6 | SCK | SPI Clock line |
7 | MOSI | SPI Data In (Master Out, Slave In) |
8 | CS | SPI Chip Select |
9-16 | C1-C8 | Capacitive touch sensor inputs |
#include <Wire.h>
#include <Adafruit_CAP1188.h>
// Create CAP1188 instance
Adafruit_CAP1188 cap = Adafruit_CAP1188();
void setup() {
Serial.begin(9600);
// Initialize the CAP1188 using I2C communication
if (!cap.begin(0x28)) {
Serial.println("CAP1188 not found");
while (1);
}
Serial.println("CAP1188 found!");
}
void loop() {
// Read touched status
uint8_t touched = cap.touched();
for (uint8_t i = 0; i < 8; i++) {
// Check if each sensor is touched
if (touched & (1 << i)) {
Serial.print("C"); Serial.print(i+1); Serial.println(" touched!");
}
}
// Small delay to avoid flooding the serial output
delay(100);
}
Q: Can I use the CAP1188 with a 3.3V system? A: Yes, the CAP1188 operates between 2.7V and 5.5V, making it compatible with both 3.3V and 5V systems.
Q: How do I increase the sensitivity of the touch sensors? A: Sensitivity can be adjusted through the CAP1188's configuration registers. Refer to the datasheet for detailed register settings.
Q: Can the CAP1188 detect multiple touches at the same time? A: Yes, the CAP1188 can detect multiple simultaneous touches, allowing for more complex touch interfaces.
Q: What should I do if the touch sensors are too sensitive or not sensitive enough? A: Adjust the sensitivity settings in the configuration registers, and ensure that the touch pads are designed with an appropriate surface area for your application.