Convert several capsense nodes result to slider position

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Master Employee</font></font> </a> delu on ‎08-02-2017 01:26 AM

Question

I have used the capsense library, the slider was composed of several sensors. do you have any suggestion how to convert the sensor data to slider position?

Answer

You could refer to our example CapsenseCircleSlider for EFM8SB1 device. You could get the example code in folder like below for default installation:

C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\8051\v4.0.3\examples\EFM8SB1_SLSTK2010A

 

The example use centroid algorithm to interpolate the 3 nodes data to get the slider position. The bin for the 3 sensors was [20, 40, 60]. the weight 40 was for the sensor with max value captured.

 

Let us assume the sensor value for the 3 sensors was x, y and z. Then 

centroid = (x * 20 + y * 40 + z * 60) / (x + y + z)

This would give a result with range [30 50].

The max value 50 was getten when y equals z.

The min result 30 was getten when y equals x.

 

You should choose suitable bin parameter based on your sensor layout and target slider range.