Convert several capsense nodes result to slider position

by <a href=""><font color="#000000"><font size="2">Master Employee</font></font> </a> delu on ‎08-02-2017 01:26 AM


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?


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



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.