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 in Figure 1.

CVD_waveform.png
Figure 1

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 in Figure 2.

common_sensor_configuration_v2.7.png
Figure 2

Some devices, including PIC16LF1554/9 and PIC16LF1566/7, have the feature to combine multiple channels internally to create a lumped sensor.

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.

sensorConfiguration_2.7.png
Figure 3

Sensor Creation

The sensor can be created and assigned to a specific pin using the pin manager grid view or package view as other MCC modules.

createLump.png
Figure 4

For the devices that can connect multiple channels internally, the lumped sensor is very useful for low power scan purposes, as it can scan multiple physical sensors as one big sensor in one shot instead of scanning them sequentially. Once you click the create button, a popup window will be shown as below. It lists all the currently selected sensors for the two ADCs. You will be able to combine the sensors on the same ADC and note that AN0, AN1, and AN2 are shared between two ADCs, but cannot combine.

lumpsensor.png
Figure 5

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 a driven shield waveform, which will provide the best moisture/water tolerance.

Dedicated Driven Shield

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 removes the impact of non-harmonic noise, yet with higher oversampling settings each touch measurement takes longer, which affects response time.

Sensor Waveform Configuration

Waveform Timing Unit

This is the time unit for the pre-charge and acquisition option below, and will be device and system clock dependent.

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. 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. 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.

Waveform Timing Graph

Clicking the button will open up a new window. The contents of this new window provide estimate calculation of the scan waveform timing information in a graph, this helps to estimate the response time of the system. An example is shown below:

waveform_timing_graph.png
Figure 6

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, Timer 1 Scheduling Mode, and Timer 2 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, Timer 1 will be added to the project automatically and will be used to schedule the scan rate in milliseconds. By default, Timer 1 has been configured to use LFINTOSC, which can operate during MCU Power Down mode. Any manual change to 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( ).
  • Timer 2 Scheduling Mode: This mode is similar to the Timer 1 Scheduling mode, but it has less firmware overhead. This is not available on all devices.
© 2024 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.