ESP32 Capacitive Touch Pad Example

Introduction

A touch-sensor system is built on a substrate which carries electrodes and relevant connections under a protective flat surface. When a user touches the surface, the capacitance variation is triggered and a binary signal is generated to indicate whether the touch is valid.

ESP32 can provide up to 10 capacitive touch pads / GPIOs. The sensing pads can be arranged in different combinations (e.g. matrix, slider), so that a larger area or more points can be detected. The touch pad sensing process is under the control of a hardware-implemented finite-state machine (FSM) which is initiated by software or a dedicated hardware timer.

Capacitive touch detection is sometimes considered more art than science. This often results in multiple design iterations before the optimum performance sensitivity is achieved. There are, however, good design practices for circuit layout and principles of materials that need
to be understood to keep the number of iterations to a minimum. This design guide describes a process for creating and designing capacitive touch solutions, starting with the schematic, working through the mechanicals, and finally designing the electrodes for the application.

Read More on PCB and Touch pad design considerations for best results.

ESP32 Capacitive Touch pins

There are ten capacitive pins available on ESP32 names as Tocuch0 to Touch9.

ESP32 DevKit Capacitive Touch Pinout

ESP32 Cpacitive Touch Circuit

Do not connect any capacitor, Ccomponent, Ctrace and Celectrode are representation of capacitors formed in circuit.

ESP32 Capacitive Touch Buttons Code

Results

Open serial monitor and observe the reading when pad is not touched reading will vary from 70-80, when touch is detected reading will go to 0-20.ESP32 Capacitive Touch

 

 

Leave a Reply