Close

CPT112 programming

A project log for Tactile Remote Control of a Mobile Device

Control your mobile device remotely without using the touch screen

kyle-thomasKyle Thomas 10/18/2017 at 05:361 Comment

The capacitive touch slider deserves a log all to itself.  I've never used one before, but i added the parts to the board anyways in hopes that it would work.  The CPT112 communicates over I2C which i am familiar with, so i figured i could get it working.

The device can be set up to control 12 buttons, or one touch slider.  When an action is detected, the I2C interrupt pin is pulled low.  This is connected as an input to the micro-controller, which has an interrupt set up on that pin.  When the MCU detects a high->low transition, it knows that the CPT112 has some data to send, so it initiates a read.

The data packet for the slider is a 4 byte value which includes a counter, and event code, an LSB and an MSB for the sider position.  So you have to I2C read 4 bytes, and then decode the packet in firmware.

You program the settings of the touch controller using a silicon labs debug adapter and the Simplicity Studio IDE.  The settings you need depend on the layout of the touch slider, so there isn't exactly ideal settings that you just set an forget.  It took a bit of trial and error to get it to settings that felt smooth.

There were a few gotcha's along the way that took some debugging to figure out.  

Now that I had the CPT112 settings configured, and it communicating properly and quickly with the BGM111, i had to decide on what data to send back to the mobile device.  I wanted the MCU to do most of the processing, again for speed reasons.  The CPT112 only tells you the position of where your finger is on the slider (a number between 0 and 100).  So it is up to the firmware to process numerous reads into relevant information.  I figured the relevant information would be the position of the finger when the slider is touched, the position of the finger when the slider is released, the speed of the finger slide, and the direction of the slide.  These values are all calculated by the firmware, and then sent to the mobile device using a notification.

All in all, the slider works just OK so far.  its not as smooth as i would like it to be.  And there seem to be some dead spots, which i presume are because of the slider layout.  I was happy to get it working decently though for the first prototype.

Discussions

markhoweuk wrote 03/01/2023 at 14:18 point

Hi there

Could you not use the code to pick up when using the touch feature to change it from 50ms to 7.5ms sampling?

Mark 

  Are you sure? yes | no