STM32L052 Touch Sensor

Some of STM32 MCUs are equipped with TSC (Touch Sensing Controller), whose hardware performance is comparable to ASIC solutions. It is a self-sufficient module supporting multi-touch with decent SNR. And you can lower its power consumption down to few tens of micro amps.

Setting up the TSC requires to select one port for sampling for each group. One group consists of one sampling channel, where a sampling capacitor is connected, with one or more measurement channel, where a sensor pad is connected.

In each group, charge transferred from a measurement channel to the sampling channel automatically without firmware intervention. This is done independently from other groups. Thus channels belongs to each group are measured at the same time. In the same group, however measurement should be done sequentially among channels.

Following picture shows the test setup. A PCB touch panel on the right is connected to the STM32L052 breakout board on the left.

The MCU is programmed to measure the touch sensor value at every 100 msec. It transfers the measurement to a PC via UART connection. On the PC side, a python utility is prepared to collect data.

The python script also shows real-time plots as well as simple statistical data. From this data, you can easily check certain characteristics of the touch pad such as SNR, long-term drift, as well as the effect of the front cover structure on the sensitivity of the sensor.

It varies depending on the situation, minimum SNR of around 4 is considered to be necessary for the reliable operation. If the SNR is smaller than 3, additional post processing is required. If the noise is random, simple averaging can enhance the SNR effectively. Otherwise things get complicated. You may need to activate the spread spectrum (clock jittering) feature of the controller to make the noise spread out.

(source code)