capacitive touch noise / ghost touching solution

doriantgt
Posts: 2
Joined: Thu Dec 24, 2020 7:44 pm

capacitive touch noise / ghost touching solution

Postby doriantgt » Thu Dec 24, 2020 10:12 pm

I've had this problem in the past with testing where the touch sensors pick up noise randomly. In my recent project it would register as being pressed for 1/2 a second but when it would print its reading it would show a value too high meet the press threshold. It seems like if you read the button->wait-> read again it clears the noise on the pin.

I have wifi and FastLed running. I'm sure the wifi has something to do with this. It seems like a lot of time working with the esp32 is spent working around problems like this.

uint8_t threshold =12;

if ( touchRead(T2) < threshold){
delayMicroseconds(5); //ghost press debounce . I'm surprised it works so quickly even 1us reduced it quite a bit.
if ( touchRead(T2) < threshold){
pin2State = true; cout << "|" << touchRead(T2) ;}}else{ pin2State = false; } //this would print a value higher than 12 before I added the delay

Who is online

Users browsing this forum: No registered users and 12 guests