Skip to content

CAP1188

Works with

Any CircuitPython board with I2C or SPI

What it does

The CAP1188 detects capacitive touch on 8 channels and has a corresponding LED output for each channel that activates automatically when a pad is touched — no code required for the LEDs. This makes it unusually easy to debug wiring and pad placement during development. It works over both I2C and SPI, and sensitivity can be adjusted globally. Common uses include touch buttons, sliders built from multiple pads, and any interface where visible feedback per pad is helpful.

Installing the library

Download the adafruit_cap1188/ folder from the Adafruit CircuitPython Bundle and copy the entire folder to the lib/ folder on your board.

Quick start

import board
import busio
import adafruit_cap1188.i2c

i2c = busio.I2C(board.SCL, board.SDA)
cap = adafruit_cap1188.i2c.CAP1188_I2C(i2c)

while True:
    for i in range(8):
        if cap[i].value:
            print(f"Channel {i} touched")

Key things you can do

What you want How to do it
Check if a channel is touched cap[i].valueTrue if touched
Use SPI instead of I2C import adafruit_cap1188.spi and use CAP1188_SPI
Adjust global sensitivity cap.sensitivity = adafruit_cap1188.SENSITIVITY_2X — options: 1X, 2X, 4X, 8X, 16X, 32X, 64X, 128X
Invert an LED output cap[i].led_polarity = True — LED is on when pad is not touched
Check multiple touches Read cap.touched_pins for a tuple of booleans across all 8 channels
Enable multitouch cap.allow_multiple_touches = True — by default only one touch is recognized at a time

Reading the official docs

Full API reference: https://docs.circuitpython.org/projects/cap1188/en/latest/

Key things to look up:

  • The automatic LED behavior requires no code — the chip drives the LED pins in hardware; you can override this by controlling led_polarity or disabling individual LED links
  • By default the CAP1188 only reports one touch at a time even if multiple pads are active; set allow_multiple_touches = True to enable simultaneous detection
  • Sensitivity constants are in the adafruit_cap1188 module; higher multiplier = more sensitive, but more prone to false triggers from nearby conductors
  • I2C address can be changed with the address pins to allow multiple chips on one bus

Projects using this library