Author Topic: Capacitive touch sensing with STM32 -- struggling with linear sensor  (Read 593 times)

0 Members and 1 Guest are viewing this topic.

Online ebastlerTopic starter

  • Super Contributor
  • ***
  • Posts: 6627
  • Country: de
[I have just asked this question on the STM32 forum as well, but that does not seem to be the liveliest of places. I hope it's OK to double-post here.]

I am trying to get a linear slider (capacitive touch) to work on the STM32F373. I am using a three-segment linear slider, comprising three interlaced electrodes (no half ends); I have chosen the M1 Basic type. I am using HAL, the TSL Touch Sensing Library, and the STM32CubeIDE code generator.

Normalization of the Delta values is turned on in the library, to compensate for differences in response between the electrodes. I have determined suitable correction factors and entered them in the tsl_user.c file.

The Delta values for the individual electrodes, which indicate the change in capacitance vs. the untouched electrodes, make sense, at least qualitatively. But the position calculated from these by the TSL library does not. Please see the details below and the attached chart. Two things have me puzzled mainly:

(a) The Delta values for the three electrodes look plausible when I scan my finger over the sensor -- see the three thin lines in the attached plot. But are they expected to be in the 1000s of counts? (I can only specify a detection threshold from 0..255 in the TSL parameters, and the Delta values for simple touch buttons are in that range < 255. Is something wrong with the slider's Delta values already?)

(b) The Position which TSL calculates from these Deltas is total nonsense -- see the fat orange line in the plot. Note how the "position" flips just at the crossover points where another segment signal becomes the strongest one. What is up with this readout?! Am I reading the wrong variable? Is some critical parameter missing?

Many thanks for any pointers you might have!
« Last Edit: December 11, 2022, 04:59:08 pm by ebastler »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf