CAP 1188 - no reaction to touch of C* pins. Expected behaviour?


#1

I’ve soldered on the header pins and wired up my newly acquired CAP-1188 to my Raspberry PI using the I2C interface.
I can see the device on address 0x29 and can change that address to 0x28 using the method described (connecting 3vo to AD).

So far, so good.

However I was expecting the CAP-1188 to react to touches on the C[1-8] pins, and nothing I’ve done has lit up those
onboard LEDs.

Have I misunderstood how this thing works? Is there some kind of initialisation sequence to be executed
before it will operate?

Any test sequence I can run to discover if the device is healthy?

Picture attached :


#2

According to the datasheet, the LED outputs are not linked to the Cap input by default.

I don’t have access to one of those unit so I can’t tell you if there’s a test routine you could use, short of using a logic analyser, or setting the appropriate register values.


#3

@RogueM is correct. There’s a fair bit of configuration that needs to happen before the Cap11xx chips will do anything sophisticated, but it’s all pretty straight forward to understand and a good, gentle dive into i2c protocols and the idea of setting/getting registers.

Are you using a specific software library to drive the chip at the moment, or were you going to poke it by hand and see what you get out of it?

This is the chip I’ve used on Piano HAT and Drum HAT so I know it well.

The datasheet is here: http://ww1.microchip.com/downloads/en/DeviceDoc/CAP1188%20.pdf

It looks daunting, but if you skip ahead to the register descriptions it’s all pretty straight forward from there.

Looking over “Sensor Input Enable Registers” you’ll see that they all default to 1 ( on ) so the contents of the register 0x21 should be 0xFF by default ( binary 0b11111111, 8 1s for the 8 inputs ).

If you skip back to “Main Control Register” ( address 0x00 ) you will see that the least significant bit is “INT” or “Interrupt”. If this bit is set, then the chip has detected a touch. You should then read the touch status, and clear this bit by writing back the contents of this register anded with 0xFE: main_control_reg_value & 0b11111110

You can read the touch status from the “Sensor Input Status” register ( address 0x03 ), each bit in this register will correspond to a touch on a pad.

If you want LEDs to blink when you touch it, I believe it’s sufficient to just:

i2cset 0x28 0x72 0xff

Which will write 0b11111111 to the “Sensor Input LED Linking Register” ( address 0x72 ). Each bit in this indicates that the LED state is linked to a touch on that sensor.

There’s an awful lot of fine-grained control for LED settings, but I think the defaults are pretty sane.


#4

Thanks - I am using the Adafruit I2C Python library to drive my various I2C-connected sensors. With the info above I should be able to make progress.


#5

And indeed it now works.

For info the steps are :

  1. Set up the attached cables etc. before powering on as the chip calibrates everything on power up.
  2. reset the status registers and int status e.g. via
    i2cset -y 1 0x29 0x00 0
  3. set up the leds to be linked to input stimuli
    i2cset -y 1 0x29 0x72 255
  4. set the led mode to “breathe” - top bits / bottom bits
    i2cset -y 1 0x29 0x82 255
    i2cset -y 1 0x29 0x81 255
  5. wave you hand near the device and watch the leds react.