Adjusting the Detect Threshold of a QTouch® Sensor

Last modified by Microchip on 2023/11/10 11:18


Using QTouch® Analyzer you will monitor the touch delta of a sensor and adjust its detect threshold.

This tutorial builds on the Intro to PTC and Analyze Touch Data Using QTouch Analyzer projects. Make sure you've completed those before continuing with this hands-on exercise.

Back to Top

Reference Materials

ATmega328PB Xplained Mini Evaluation Kit

Atmel® Studio Integrated Development Environment

Back to Top


Connect to QTouch Analyzer

Perform steps 1 through 7 from the Analyze Touch Data Using QTouch® Analyzer project.

Back to Top

Tabular View

Select Tabular View and touch the 'V' in the AVR symbol (see accompanying image) on your ATmega328PB Xplained Mini. Observe the maximum Delta shown in the Tabular View.

ATMEL Studio Tabular View

Back to Top

Stop Reading

In the QTouch Analyzer window, click on Stop Reading.

QTouch Analyzer window

Back to Top

Open the QTouch Project Builder

In the Solution Explorer window, double-click on the .qtdgn file. Note that you may have named your project differently.

Solution Explorer window

Back to Top

Change Button Settings

Select 'Button0' and click on the Settings icon.

Sensor Selection Tab: Select 'Button0' and click on the Settings icon

In the 'Button0' settings, set detect threshold to 75.

'Button0' settings view

Back to Top

Generate Project

Go to the 'Project Generation' section and click Generate Project.

'Project Generation' section

Back to Top

Build and Program

Build the solution.

Build Icon

Program the application by clicking on the Start Without Debugging icon.

Start Without Debugging icon

Back to Top

QTouch Analyzer

Open QTouch Analyzer.

QTouch Analyzer Icon

In the QTouch Analyzer window, click ReConnect.

QTouch Analyzer window

Click on Start Reading.

Start Reading  selection in QTouch Analyzer

Use the 'Tabular View' to observe touch delta and state.

'Tabular View' tab

Back to Top

Touch the Sensor

Touch the sensor lightly (so that Delta is less than 75). You will notice that State is OFF.

'Tabular View' state is OFF

Touch State will only change to ON whenever the Delta of Button0 is more than 75.

'Tabular View' state is ON

Detect threshold can be directly modified inside the touch_selfcap_sensor_config() function of the respective sensor in the touch.c file.

touch_selfcap_sensor_config() function in the touch.c file

Back to Top


You have learned how to configure and set the detect threshold value of a sensor.

Back to Top