How to programmatically control sensitivity of cap1188?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
drspeed
 
Posts: 17
Joined: Sat Oct 26, 2013 1:48 am

How to programmatically control sensitivity of cap1188?

Post by drspeed »

The documentation suggests that there is a programmatical way to control the sensitivity of the cap1188. I appears that I may be able to use the Adafruit library to writeRegister() with the appropriate values. The datasheet also has information about this. I can't quite figure out how to do it though.

Pg. 45 of data sheet
The Sensitivity Control register controls the sensitivity of a touch detection.
A little to sensitive, but otherwise working great with a Teensy 3.0!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to programmatically control sensitivity of cap1188?

Post by adafruit_support_mike »

It looks like you just need to set the upper half of register 1F:

Code: Select all

uint8_t reg = cap.readRegister( 0x1f ) & 0x0f;
cap.writeRegister( 0x1f, reg | 0x40 ); // or whatever value you want

User avatar
drspeed
 
Posts: 17
Joined: Sat Oct 26, 2013 1:48 am

Re: How to programmatically control sensitivity of cap1188?

Post by drspeed »

Thanks! That worked great.

Code: Select all

  
uint8_t reg = cap.readRegister( 0x1f ) & 0x0f;
cap.writeRegister( 0x1f, reg | 0xF0 );
Lower values make it less sensitive, higher values (obviously) make it more.

The value 0xF0 seems to work well with short pieces of wire in a breadboard.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to programmatically control sensitivity of cap1188?

Post by adafruit_support_mike »

Actually it's a threshold value.. from the datasheet:
The sensitivity settings act to scale the relative delta count value higher or lower based on the system parameters. A setting of 000b is the most sensitive while a setting of 111b is the least sensitive. At the more sensitive settings, touches are detected for a smaller delta capacitance corresponding to a “lighter” touch.
You only use the three lowest bits for that half of the register though, so the legal range of values is 0-7.

User avatar
drspeed
 
Posts: 17
Joined: Sat Oct 26, 2013 1:48 am

Re: How to programmatically control sensitivity of cap1188?

Post by drspeed »

Yes, I agree. Values 0..7.

Also, I found that using coax wire with the shield grounded is really necessary for lengths more than an inch or so. I have a 1 foot piece of coax and it works great. Since I don't reset the 1188, I found best results when I power cycle it so it can self calibrate for any change to the inputs.

User avatar
drspeed
 
Posts: 17
Joined: Sat Oct 26, 2013 1:48 am

Re: How to programmatically control sensitivity of cap1188?

Post by drspeed »

Spoons as input for midi controller
Spoons as input for midi controller
Img_1938.jpg (53.85 KiB) Viewed 440 times
A while back I switched my project to use an MPR121 based capacitive touch sensor and it is much better. I was never able to get the cap1188 to work consistently but the MPR121 products are great and work really well. I would recommend this chipset.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”