Introduction to touch sensing with STM32

1. What is touch sensing?

Touch sensors are used in HMIs (human-machine interfaces)

Instead of using mechanical switches, actuation is achieved by touching the finger touch on a surface.

There are three methods:

  • Capacitance switch:
    • the electrode is placed behind a non-conductive panel
    • the change in capacitance is detected
  • Resistive touch switch:
    • two electrodes are bridged by the user's fingertip
    • the resistance of the fingertip is detected
  • Piezo touch switch:
    • a voltage is generated by pushing/bending a piezoelectric material
    • the voltage change is detected

The TSC (touch sense controller) peripheral is based on the capacitance switch method - when a human touches the surface of the sensor area, the capacitance changes.

Basic TSC working mode description

TSC state machine


2. Getting started with STM32 and touch sensing

Application note AN5105 summarizes all information regarding touch-sense controller usage.
This application note explain step-by-step how to handle touch sensors using STM32F072BDISCO and STM32L0538DISCO discovery boards.
For more information on STM32 Discovery boards --> Click here

3. STM32 compliance with touch sensing

3.1. Maximum number of sensors on STM32 Series products

STM32L0 STM32L1 STM32L4 STM32L4+ STM32L5 STM32F0 STM32F3 STM32WB
Peripheral TSC Software assist TSC TSC TSC TSC TSC TSC
Groups 8 11 8 8 8 8 8 7
Channels 32 48 32 32 30 32 32 28
Sampling capacitors 8 11 8 8 8 8 8 7
Sensors 24 37 24 24 22 24 24 21

3.2. Maximum number of sensors on LQFP64 packages

STM32L0 STM32L1 STM32L4 STM32L5 STM32F0 STM32F3
Peripheral TSC Software assist TSC TSC TSC TSC
Groups 8 10 4 8 6 6
Channels 32 33 16 30 24 24
Sampling capacitors 8 10 4 8 6 6
Sensors 24 23 12 22 18 18

4. STMicroelectronics resources

AN5105 Getting Started with Touch control url
UM1913 Developing applications on STM32Cube with STMTouch touch sensing library url
AN4316 Tuning a STMTouch-based application url
AN4312 Guidelines for designing touch sensing applications with surface sensors url
AN4299 Guidelines to improve conducted noise robustness on STM32 series touch sensing applications url
AN4310 Sampling capacitor selection guide for MCU based touch sensing applications url
AN3960 ESD considerations for touch sensing applications url