Interrupt (RISING) - triggers twice

After some thoughts, discussions and blaming the 328p and the software I had to come to the conclusion that the signal from the opamps going to the microprocessor bounced due to some output swing. This bouncing happens in a couple of micro seconds.

Therefore my solution had to come from the hardware design. Due to noise on the signal the comparator swings a couple of times between high and low (see screenshot). Solution was to improve the hysteresis of the comparator to increase thresholds.

This improved hardware works like a charm and interrupts work good (no interrupts are generated twice) (see attached screenshots).

  • Output swing / bouncing is difficult to find without a proper oscilloscoop (only a few micro secs)
  • Good info on the comperator hysteresis: TI app note on hysteresis

Thanks for thinking along!

piezo_noSwing.PNG