mTouch® Surface/Gesture Configuration

A group of sensors can be combined to form a 2D Touch Surface. A surface reports the touch position for one or two fingers. Surface touch data can be further processed to determine user gestures such as tap, swipe, pinch, and zoom.

Only one surface per project is currently permitted.

Common Surface Configuration

The Common Surface Settings consist of:

  • Create New Surface
  • Interface Method
  • Gesture Mode

Create New Surface

The Create New Surface button in the 'Common Settings' allow you to create a surface for an mTouch® sensing solution project.

Gesture Mode

When a Surface has been created, 'Gesture Mode' options are activated. There are three 'Gesture Mode' options:
None No gesture support
One Finger Supports Tap, Swipe, Wheel gestures
One and two Finger Supports Tap, Swipe, Wheel, Pinch, and Zoom gestures (Default mode once activated)

Gesture Types

Each gesture type listed can be activated using the corresponding 'Enable' checkbox.

  • Tap
  • Swipe
  • Wheel
  • Pinch Zoom

Tap Parameters

  • Tap Release Timeout
  • Tap Hold Timeout
  • Tap Area
  • Sequential Tap Distance Threshold

Tap Release Timeout

This parameter limits the amount of time allowed between the initial finger press and the liftoff. Exceeding this value causes the firmware not to consider the gesture as a tap gesture. The 'Tap Release Timeout' should be less than the 'Tap Hold Timeout' and 'Swipe Timeout'. Unit: x10 ms.

Example: If the 'Tap Release Timeout' is configured as 3, then you should finish tapping within 30 ms to qualify the gesture as a tap.

Tap Hold Timeout

If a finger stays within the bounds set by 'Tap Area' and is not removed, the firmware reports a 'Tap Hold' gesture once the gesture timer exceeds the 'Tap Hold Timeout' value. 'HOLD_TAP' is a single finger gesture whereas 'HOLD_TAP_DUAL' is a dual finger gesture. Ideally, 'Tap Hold Timeout' should be greater than the 'Tap Release Timeout' and the 'Swipe Timeout'. Unit: x10 ms.

Example: If the 'Tap Hold Timeout' is configured as 6, then you should tap and hold inside the 'Tap Area' for 60 ms to qualify the gesture as tap and hold.

Tap Area

The 'Tap Area' bounds the finger to an area it must stay within to be considered a tap gesture when the finger is removed and tap and hold gesture if the finger is not removed for some time. Unit: coordinates.

Example: If the 'Tap Area' is configured as 20, then you should tap within 20 coordinates to detect the tap gesture.

Sequential Tap Distance Threshold

This parameter limits the allowable distance of the current touch's initial press from the liftoff position of the previous touch. It is used for multiple taps (double-tap, triple-tap, etc.). If the taps following the first are within this threshold, then the tap counter will be incremented. If the following tap gestures exceed this threshold, the previous touch is sent as a single tap and the current touch will reset the tap counter. Unit: coordinates.

Example: If configured as 20, after the first tap, and you tap again within 20 coordinates, it is considered as a double tap gesture.

Swipe Parameters

  • Edge Boundary
  • Swipe Timeout
  • Horizontal Swipe Distance Threshold
  • Vertical Swipe Distance Threshold

Edge Boundary

The firmware can also be modified to define an edge region along the border of the touch sensor. With the 'Edge Boundary' defined, swipe gestures that start in an edge region are reported as edge swipe gestures in place of normal swipe gestures. To create an edge region, the 'Edge Boundary' is set with the size (in touch coordinates) of the edge region. Unit: coordinate count.

Example: Setting the 'Edge Boundary' to 100 designates the area 100 units in from each edge as the edge region.

Swipe Timeout

Swipe timeout limits the amount of time allowed for the swipe gesture (initial finger press, moving in a particular direction crossing the distance threshold and the liftoff). Ideally, 'Swipe Timeout' should be greater than the 'Tap Release Timeout' but less than the 'Tap Hold Timeout'. Unit: x10 ms.

Example: If the 'Swipe Timeout' is configured as 5, then you should swipe in a particular direction and liftoff within 50 ms for the gesture to qualify as a swipe.

Horizontal Swipe Distance Threshold

The 'Horizontal Swipe Distance Threshold' controls the distance traveled in the X-axis direction for detecting left and right swipe gestures. Unit: X-coordinate count.

Example: If the 'Horizontal Swipe Distance Threshold' is configured as 50 and you place your finger at x- coordinate 100, then you must move to at least x-coordinate 50 to record a left swipe gesture.

Vertical Swipe Distance Threshold

This threshold controls the distance traveled in the Y-axis direction for detecting up and down swipe gestures. Unit: Y-coordinate count.

Example: If the 'Vertical Swipe Distance Threshold' is configured as 30 and you place your finger at y- coordinate 100, you must move to at least y-coordinate 70 to record a down swipe gesture.

Wheel Parameters

  • Wheel Post-Scaler
  • Wheel Start Quadrant Count
  • Wheel Reverse Quadrant Count

Wheel Post-Scaler

The clockwise wheel is performed with four swipes. Similarly, the anti-clockwise wheel is performed with four swipes (left > down > right > up). To detect a wheel:
Minimum number of swipes required = 'Wheel Start Quadrant Count' + 'Wheel Post-Scaler'. Once the wheel is detected, for post scaler number of swipe detections, the wheel counter is incremented by one.

Example: If the 'Wheel Post-Scaler' is 2, then for each two swipe detections, the wheel counter is Incremented by one.

Wheel Start Quadrant Count

The wheel gesture movement can be broken down into 90° arcs. The firmware watches for a certain number of arcs to occur in a circular pattern before starting to report wheel gesture information. The number of arcs that must be first detected is determined by the parameter. Lower values for this parameter make it faster to start a wheel gesture, but it also makes the firmware prone to prematurely reporting wheel gesture information.

Example: If configured as 2, then after 180°, the gesture is updated as 'wheel'.

Wheel Reverse Quadrant Count

The 'Wheel Reverse Quadrant Count' is used when changing the direction of the wheel instead of starting it new. This is used to prevent quick toggling between directions.

Example: If the 'Wheel Reverse Quadrant Count' is set as 4 and after some wheel gestures you change the direction of rotation, then only after 360° will it be detected as one wheel gesture.

Pinch Zoom Parameters

  • Pinch Zoom Threshold

Pinch Zoom Threshold

The 'Pinch Zoom Threshold' limits the allowable distance between the two fingers to detect the pinch and the zoom gestures. After crossing the 'Pinch Zoom Threshold', if the distance between the contacts is reducing, then the gesture is reported as a pinch. After crossing the 'Pinch Zoom Threshold', if the distance between the contacts is increasing, then the gesture is reported as a zoom. Unit: coordinates.

Example: If the 'Pinch Zoom Threshold' is configured as 20, then after crossing 20 coordinates, it will be reported as a pinch gesture or a zoom gesture.

Individual Surface Configuration

The 'Individual Surface Configuration' allows you to set surface dimensions (horizontal x vertical), contact size threshold, position hysteresis, resolution, dead band percentage, and position filter. The Delete Item button is used to remove the surface from the project. While removing this surface from the project, the button sensors connected to this surface are also removed.


Surface Settings Parameters

Horizontal Key Count

The 'Horizontal Key Count' is the number of buttons in the surface horizontal direction.

Vertical Key Count

The 'Vertical Key Count' is the number of buttons in the surface vertical direction.

Create / Update Grid

This button creates a surface grid. The grid is editable.

Contact Size Threshold

The 'Contact Size Threshold' defines the threshold for surface touch deviation, which is the sum of deviation of the most and second most touched segment to detect a user touch. It is recommended to configure the surface contact size threshold to around 50% of the minimum surface touch deviation reported when sliding from end to end.

Position Hysteresis

Hysteresis is the number of positions you must move before the new touch position is reported from the first touch down position.


Defines the resolution of the surface in bits. A value of 8 indicates 256 positions. The surface value is reported from 0-255.


Defines the inactive area in percentage on the edge of the surface where no change in position is reported. If the deadband is 10, then the inactive area is 10% of the surface range in each direction. If the surface has an 8-bit resolution (0-255), but the output can only reach 25-230 due to sensor layout, then the deadband is25, which is roughly 10% of the whole range. Setting 10% in the deadband option removes this 10% inactive area and allows to reach the full range.

Position Filter

This filter is used to help resolve position with increased stability. The 'Position Filter' uses averaging IIR filtering, to this end.

Median Filter

The 'Median filter' can be enabled and provides more accuracy in the presence of noise, but increases the position resolution time.

Editing the Surface

The surface grid consists of channel references on the left and top of the display. The right and bottom edge lists the assigned sensor for that channel. The sensor can be reassigned for any channel. To do this, click on the relevant sensor name on the right or bottom of the grid, and select from the popup windows that appear. The selected sensor form the popup is then assigned to the surface channel.

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