user62283: I am working on a project which involves counting the drops falling in a drip chamber of a IV fluid gravity based therapy bottle(saline bottle).I am using IR trans-receiver at the drip chamber to detect a drop falling. I am using a comparator to generate a pulse when ir voltage drops below a certain threshold. The output of comparator is connected to D1 of nodemcu. The ISR is called at rising pulse of comparator .But the nodemcu calls the ISR 3 to 5 times on a single drop.what should I do?plz help.

user38721: The signal is probably "bouncing" between HIGH and LOW instead of performing a clean edge, just like it happens with buttons.
Two simple solutions:

Hardware solution: use a schmidt-trigger instead of a comparator
Software solution: define a dead-time for the signal aquisition (disable the interrupt when the desired edge has been detected and enable it again after "dead-time")


62283: <p>I am working on a project which involves counting the drops falling in a drip chamber of a IV fluid gravity based therapy bottle(saline bottle).I am using IR trans-receiver at the drip chamber to detect a drop falling. I am using a comparator to generate a pulse when ir voltage drops below a certain threshold. The output of comparator is connected to D1 of nodemcu. The ISR is called at rising pulse of comparator .But the nodemcu calls the ISR 3 to 5 times on a single drop.what should I do?plz help.</p>
 38721: <p>The signal is probably "bouncing" between HIGH and LOW instead of performing a clean edge, just like it happens with <a href="https://www.allaboutcircuits.com/technical-articles/switch-bounce-how-to-deal-with-it/" rel="nofollow noreferrer">buttons</a>.</p>

<p>Two simple solutions:</p>

<ol>
<li>Hardware solution: use a schmidt-trigger instead of a comparator</li>
<li>Software solution: define a dead-time for the signal aquisition (disable the interrupt when the desired edge has been detected and enable it again after "dead-time")</li>
</ol>
