mTouch® Surface/Gesture Configuration

Last modified by Microchip on 2023/11/09 08:55

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:

NoneNo gesture support
One FingerSupports Tap, Swipe, Wheel gestures
One and two FingerSupports Tap, Swipe, Wheel, Pinch, and Zoom gestures (Default mode once activated)

Common Surface Settings pane with no Gestures available until a surface is created

Back to top

Gesture Types

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

  • Tap
  • Swipe
  • Wheel
  • Pinch Zoom

Common Surface Settings pane with all options available after creating a surface, This is where gesture behavior is controlled

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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.

Back to top

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

Back to top

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.

Back to top

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.

Back to top

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.

Individual Surface Settings pane where the surface dimensions and sensor behavior is configured

Back to top

Surface Settings Parameters

Horizontal Key Count

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

Back to top

Vertical Key Count

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

Back to top

Create / Update Grid

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

Back to top

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.

Back to top

Position Hysteresis

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

Back to top


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

Back to top


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.

Back to top

Position Filter

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

Back to top

Median Filter

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

Back to top

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.

Sensor selection popup window

Back to top