I am using an EL817S optocoupler to interface a 12 V push-button signal to an ESP32 GPIO.
After pressing the button once, the ESP32 GPIO sometimes detects multiple HIGH/LOW transitions. The GPIO is configured with GPIO_INTR_ANYEDGE, so each transition can generate an event.
The signal path is:
12 V push button → EL817S → header connector → separate MCU PCB → ESP32 GPIO
I would like to determine whether the multiple transitions are caused by mechanical switch bounce, optocoupler behavior, noise on the inter-PCB connection, or the input circuit.
Questions:
I would appreciate suggestions on the appropriate hardware filtering and debounce approach.
After pressing the button once, the ESP32 GPIO sometimes detects multiple HIGH/LOW transitions. The GPIO is configured with GPIO_INTR_ANYEDGE, so each transition can generate an event.
The signal path is:
12 V push button → EL817S → header connector → separate MCU PCB → ESP32 GPIO
I would like to determine whether the multiple transitions are caused by mechanical switch bounce, optocoupler behavior, noise on the inter-PCB connection, or the input circuit.
Questions:
- Can the EL817S output produce multiple transitions due to input bounce/noise?
- Should I add an RC filter/capacitor at the optocoupler output?
- What R/C values would be suitable for this ESP32 GPIO input?
- Could the capacitor cause slow rise/fall times or affect GPIO detection?
- Is hardware filtering + ~50 ms firmware debounce recommended?
I would appreciate suggestions on the appropriate hardware filtering and debounce approach.

