ESP32 offers up to 10 capacitive IOs that detect changes in capacitance on touch sensors due to finger contact or proximity.
The use of capacitive proximity sensors implies certain compromises of sensibility and stability of measurements.
I have been studying the operation of ESP32’s capacitive sensors. Finally I was able to implement a proximity sensor with a decent distance (3-4 inches) and an acceptable behavior.
Basically I configured the capacitive input for maximum sensibility, then dynamic thresholds were established based in the integrated and filtered capacitive sensor values.