Hardware Sensor Configuration

Sensor Configuration Overview

The sensor configuration configures the Capacitive Voltage Divider (CVD) waveform, which is used to acquire the relative capacitance value of the sensor, and also the number of oversampling for each sensor. The differential CVD waveform is shown below:


There are two ADC samples being acquired. Each sample needs three phases: sensor pre-charge, sensor acquisition, and analog to digital conversion.

For more information about the CVD acquisition method, see Application Note "AN1478 mTouch™ Sensing Solution Acquisition Methods Capacitive Voltage Divider".

Common Sensor Configuration

There is a common configuration section to setup all the sensors, as shown below:


Individual Sensor Configuration

Each sensor has its own configuration section to set up the sensor name, Pre-charge Time, Acquisition Time, and Oversampling value. The common configuration is assigned to each sensor by default. If the sensor has different physical conditions (parasitic capacitance, size of the sensor, etc..), you can enable the individual configuration.


Sensor Sampling Configuration

Idle Sensor Pin State: The system scans one sensor at a time, by default, the un-scanning sensor pins will be grounded (output low), which provide the lowest emission. For certain devices, it also has the capability of driving the un-scanning sensor pins as driven shield waveform, which will provide the best moisture/water tolerance.

Idle Sensor Pin State: This is a read-only text filed, indicating the dedicated driven shield pin that is selected in the pin manager grid view.

Oversampling: This defines the number of ADC samples taken for each iteration of measurement. Higher oversampling settings mean more samples for each measurement, which helps to average out the none-harmonic noise but higher oversampling settings take a longer time to do a touch measurement, which affects response time.

Sensor Waveform Configuration

Pre-charge Time: This value determines the amount of time provided to charge the external sensor and the internal Sample&Hold capacitor of the ADC. The unit is 125ns per count. If the value is too small, the sensor will not be as sensitive as they could be, or even has inverted behavior when touching the sensor.

Acquisition Time: This value determines the amount of time provided for the external sensor and internal hold capacitor to charge/average their voltages. The unit is 125ns per count. This value is related to the RC time constant of the sensor and its series resistor. If the value is too small so that the sensor charge is not fully settled before conversion, the sensor will not be as sensitive as it could be. If the value is too large, the noise immunity of the system will not be as robust as it could be because this time is also the time window for acquiring noise.

Additional Sample Capacitance: The value determines how much additional internal capacitance will be added to the Sample&Hold capacitor. This is used to improve the match between internal and external capacitance for a better sensing performance. The general rule of thumb is to settle the voltage after acquisition time close to half of the VDD as much as possible. This option is only available on parts that have hardware CVD module.

Auto-Calibration: To ease the tuning process for the CVD waveform, the library supports auto-calibration for acquisition time and additional internal capacitance. The auto-calibration will perform for each sensor after power-up, timeout and negative capacitance detected events. This option is only available on parts that have hardware CVD module.

Scan Rate Control: The capacitive sensors need to be scanned periodically, there are two options to control the scan rate: Free Running Mode and Timer 1 Scheduling Mode.

  • Free Running Mode: The sensor scan and post-processing will happen when the mTouch_Service_Mainloop( ) gets called, the timing is not precisely controlled, and will be determined by how often the application code calls the mTouch_Service_Mainloop( ).
  • Timer 1 Scheduling Mode: In this mode, the Timer 1 will be added to the project automatically and be used to schedule the scan rate in the unit of milliseconds. By default, the Timer 1 has been configured to use LFINTOSC, which can operate during MCU power down mode. Any manual change to the Timer 1 will affect the scan rate. The scheduling logic is implemented inside mTouch_Service_Mainloop( ) function, so there will be no change in the way of using the mTouch_Service_Mainloop( ). However, the mTouch_Service_Mainloop( ) needs to be called in a shorter time interval than the scheduled scan time. Otherwise, the scan rate will still be determined by how often the application code calls the mTouch_Service_Mainloop( ).
© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.