Button/Proximity Sensor Configuration

Button/Proximity Sensor Configuration

The Button/Proximity Sensor is an abstraction layer over the physical sensor which decouples the signal acquisition module and the decoding module. The benefit of this abstraction is that regardless of what acquisition method is being used for the sensor, the Button/Proximity Sensor decoding works the same way.

Common Button/Proximity Sensor Configuration

Similar to the sensor configuration, the Button/Proximity Sensor also has a common section. The common Button settings area consists of six sub-areas: creating a new button, the interface method to be utilized, the press timeout routine, negative capacitance recovery routine, baseline filtering and reading filtering .


The common Proximity Sensor has two extra sections: deviation integrator, and median filter.


Creat New Button/Proximity Sensor

The Create New Button/Proximity Sensor tab in the Common Settings area allows for the creation of an additional button/proximity sensor for the mTouch® sensing solution project. When a new button/proximity sensor is created, the default name is Button#/Proximity#, where # is the lowest number not currently used.

Interface Method

The mTouch® sensing solutions library allows your application code to obtain button/proximity sensor status in two ways: through a callback function and through polling. There are examples of how to use these two methods In the Step by Step Example section.

Press/Activation Timeout

The Press/Activation Timeout is a mechanism used to release a stuck button/proximity sensor. If a button/proximity sensor is pressed/activated for a number of consecutive counts, the button’s/proximity sensor's state will be reset. Each button/proximity sensor has its own time-out counter to track the press time. The underlying press time-out counter will increment each time the MTOUCH_Service_Mainloop() call is performed. The counts parameter acts as a threshold to each button’s/proximity sensor's press time-out counter. Upon the time-out’s counter exceeding the counts value, the button/proximity sensor state will be reset.

Press/Activation Timeout

The baseline of a touch button/proximity sensor is the output of a conditionally low-pass filter, and the input of this low pass filter is the button’s/proximity sensor's raw reading. This allows the baseline to track and react to environmental changes such as temperature and humidity. Upon a button entering a pressed state the baseline will stop updating until released.

Baseline Filtering

The filter gain parameter determines the baseline filtering strength. The larger the value, the stronger the filter gets, and the more slowly the baseline follows the button reading value.

The update parameter determines how often the system will update the button’s/proximity sensor's baseline. The larger the value, the less often the system updates the baseline.

Negative Capacitance Recovery

Enabling this feature allows the quick recovery of a button’s/proximity's baseline if negative capacitance is detected. The negative capacitance means the baseline value is greater than the reading for a button. The consecutive decodes parameter specifies the number of consecutive decoding cycles (MTOUCH_Service_Mainloop() call) with negative capacitance that the program has to detect before resetting the button’s/proximity state.

Reading Filter

To minimize the impact of impulse noise, the sensor output goes through a low-pass filter; the output of the filter is the reading of the button/proximity sensor. A higher filter level setting provides an improved signal to noise ratio under noisy conditions while increasing the total time for measurement, possibly resulting in increased power consumption and response time.

Deviation Integration Filter

To help the sensitivity of the proximity sensor, a deviation integrator is used. A larger gain value results in more sensitivity.

Median Filter

To gain a greater Signal to Noise Ratio (SNR) for the proximity sensor, a median filter can be used after the reading filter. The value of the median filter window decides how much history data will be stored. Similar to the reading filter, a higher value provides more noise immunity but longer response time.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.