I am facing a trouble that seems to be generated by AC coupling noise.
I get button pushes events triggered by electrical noise. My button is connected to PIN 21 of ESP32. I tried configuring the input with internal an external PULL-UP, also tried with internal/external PULL-DOWN, and also including debounce code and hardware circuit, and still having false button pushes.
This trouble happens in different ESP32 boards, NodeMCU 32s, DEVKITV1, DEVKITV4
I generate noise pluging and unplugging AC loads and switching on and off.
I noticed that noisy AC coupling trigger button1.event on the main loop.
CODE:
void loop() {
int co2ppm = mhz19.getCO2(); // Request CO2 (as ppm)
int temp = mhz19.getTemperature(); // Request Temperature (as Celsius)
if (button1.event) {
Serial.printf("Button has been pressed for %u millis\n", button1.timePressed);
if (button1.timePressed < 1000)
CO2_base = co2ppm;
else calibrate_mhz19 ();
// button state updated inside a critical section
portENTER_CRITICAL(&mux);
button1.event = false;
portEXIT_CRITICAL(&mux);
}
..... }
Complete code is: https://github.com/medicionco2/proyecto ... gspeak.ino
I´ll really preciate if someone can help me, can share a similar experience or have a useful advice.
Noise triggers input button events with pullup/pulldown
Who is online
Users browsing this forum: Bing [Bot] and 165 guests