attachinterupt how to filter signal

Hi Guys,

I captured the signal from an coin machine. It works great, but sometimes the attach interrupt react to sensitive.

Now am i thinking, can i fix this at the software side, or do i have to look at the hardware side.

As attachemt is the capture. You can see clearly the riples from the coin machine on all outputs, and the gap is the actual coin. Time of that is 200ms.

Thank you!

Image attached for our convenience:


Technique described here.

This really a debouncing problem. There’s no reason to handle this in an interrupt. In this case, it’s actually a bad idea. Just check the switch in loop and debounce it based on millis(), or use the Bounce2 library.

Here’s a few resources for understanding the techniques:

Hackaday 3-part series

Ganssle “Debouncing Contacts and Switches”

Compuphase - “Debouncing Switches with Vertical Counters”



Thank you for your reply. Put debounce sample in place, and looks like it is working !

Thank you !