Capacitive touch sensors on ESP32

Thread Starter

zazas321

Joined Nov 29, 2015
856
Hello. I need a way to increment or decrement a counter using hardware. I have initially thought of using 2 buttons - very simple and old method ( one for incrementing and one for decrementing). I have recently found out abut the ESP32 pins that are able to detect a change in electrical charge. I have tested it and they actually work! When I touch it with my finger, the value goes LOW
Code:
void setup() {
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor
  Serial.println("ESP32 Touch Test");
}

void loop() {
  Serial.println(touchRead(4));  // get value of Touch 0 pin = GPIO 4
  delay(1000);
}
I have connected a jumper cable to gpio 4 and I am touching it with my fingers, the output:
1597306403186.png


My question is how reliable are they to use for production replacing the good old buttons. Are they sensitive to temperature/humidity changes? Once I press the button on my ESP32, it enter a function untill I select what number I want to set counter to. This counter variable is very important to me since it controls "ID" of the remote device therefore I do not want the capacitive sensor to activate for no reason when i dont need it because it will enter a function when i dont need it!.
Does anyone have experience with those touch sensors and could advice me?
 

trebla

Joined Jun 29, 2019
360
For example is there a good design guide for Atmel chips, but can used with other MCUs too. You can do search "capacitive touch application note design guide" with Google.
 
Top