Touch sensor - Using an CAP1188
What is the CAP1188?
The CAP1188 is an easy-to-use 8-channel capacitive touch sensor breakout board. This chip can handle up to 8 individual touch pads, it will light up the 8 onboard LEDs when the matching touch sensor fires to help you debug your sensor setup.
The CAP1188 has support for both I2C and SPI, so it easy to use with any microcontroller. If you are using I2C, you can select one of 5 addresses, for a total of 40 capacitive touch pads on one I2C 2-wire bus. Using this chip is a lot easier than doing the capacitive sensing with analog inputs: it handles all the filtering for you and can be configured for more/less sensitivity.
Other Capacitive Touch Sensing Method
We have tutorials for other alternatives as well!
MPR121 vs CAP1188 Comparison
Feature | MPR121 | CAP1188 |
---|---|---|
Number of Inputs | 12 electrodes | 8 electrodes |
Multi-touch | ✅ Yes (tracks all touches) | ⚠️ Partial (multi-touch disabled by default) |
I2C Addressability | 4 possible addresses (0x5A–0x5D) | 3 jumpers for I2C address config |
Proximity Sense | ✅ Yes (via filtered data) | ✅ Yes (via built-in proximity detection) |
Slider/Wheel Support | ✅ Yes | ❌ Not native |
Sensitivity Adjustments | ✅ Touch & release thresholds | ✅ Built-in auto-calibration, less customizable |
Interrupt Support | ✅ Yes | ✅ Yes |
Noise Handling | Good, needs tuning | Excellent built-in debounce and filtering |
Communication | I2C | I2C or SPI (selectable) |
Power Consumption | Low | Low |
Library
We will be using the library Adafruit CAP1188
.
We have a tutorial on how to install a library here.
Wiring
Wiring is pretty simple, it's an I2C component so it's relatively standard.
- VIN -> 5V
- GND -> GND
- SCL -> SCL / A5
- SDA -> SDA / A4
Older Arduino boards
Some older Arduino boards do not have SDA and SCL pins as shown in the diagrams, in this case you'll need to look it up on the boards documentation, however most Arduino boards used A4 as SDA and A5 as SCL.
Getting started
After installing the library and wiring the board, go ahead and use the examples in the File
> Examples
> Adafruit CAP1188
> cap1188test
.