cancel
Showing results for 
Search instead for 
Did you mean: 

The STM8TL5x_STMTouch_Lib_V2.1.0, sensing long touches and the touch lib state machine

Ted Jackson
Senior

Hello. I've built a sensor similar to that pictured in 'Figure 3. H sensor (single layer)' from the AN4313 Projected sensor design document. I'm using it in conjunction with the Touch Driver library as part of the STM8TL5x_STMTouch_Lib_V2.1.0 touch library.

When I touch the sensor, I reliably get TSL_STATEMASK_DETECT states (normally preceded by DEB_DETECT states). When I stop touching the sensor after a moment, I reliably get RELEASE states (usually preceded by a few DEB_RELEASE_DETECT states). But NOT when the touch is long (greater than a second or so). In that case, I always get intervening CALIBRATION states that precede subsequent RELEASE states and those RELEASE states are often transmitted while the sensor is still being touched. And that is complicating the ability to determine the moment when the sensor is no longer touched. My goal is to determine the moment when the sensor is touched and the moment when it is no longer touched with equal reliability no matter how long the touch. Is this even possible to do for long touches? Is there any software option I can choose to prevent those intervening CALIBRATION states? Or might there be another kind of work-around?

It's curious that I never see a TOUCH state at all. I'm also noticing that the state machine does NOT necessarily follow the flow chart illustrated in 'Figure 12. Simplified sensors state machine' in the document 'UM1606 STMTouch driver user manual'. Am I not querying the state machine fast enough? Thanks for any help or suggestions.

1 ACCEPTED SOLUTION

Accepted Solutions
Ted Jackson
Senior

Problem solved. The fault was my own. I neglected to cover the bare electrodes (cut copper tape) with a thin insulator (paper or scotch tape will do). And the TSLPRM_DTO parameter should be set to 0 or 1 in tsl_conf_stm8tl5x.h. After doing those, it works like a charm for long or short touches.

With that capability, I should have a sweet solution to a fairly universal problem. Listen for a touch at low current for potentially many years off of penlight batteries. Soon as it's touched, do some work. Go back to sleep again. Soon as it's not touched, do some more work. Go back to sleep again. That is if Active-halt with ProxSense works at 10 uA for both cases. Using only a single cheap STM MCU chip and no supporting electronics. Will let you know. Thanks for all the help!

View solution in original post

1 REPLY 1
Ted Jackson
Senior

Problem solved. The fault was my own. I neglected to cover the bare electrodes (cut copper tape) with a thin insulator (paper or scotch tape will do). And the TSLPRM_DTO parameter should be set to 0 or 1 in tsl_conf_stm8tl5x.h. After doing those, it works like a charm for long or short touches.

With that capability, I should have a sweet solution to a fairly universal problem. Listen for a touch at low current for potentially many years off of penlight batteries. Soon as it's touched, do some work. Go back to sleep again. Soon as it's not touched, do some more work. Go back to sleep again. That is if Active-halt with ProxSense works at 10 uA for both cases. Using only a single cheap STM MCU chip and no supporting electronics. Will let you know. Thanks for all the help!