countio and debounce
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- sgalway
- Posts: 10
- Joined: Fri Nov 12, 2021 12:42 pm
countio and debounce
I am having trouble counting rotations of an anemometer. I am trying to use the countio library but I can't seem to figure out how to debounce the signal before counting. I am getting 4-5 "counts" every time the sensor passes by. A search of this forum comes up with EXTINT, but that doesn't seem to exist anymore.
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: countio and debounce
What are you using for the micro and how fast do the pulses come? I have used a kluge where I ignore pulses if they are quicker than the fastest possible rate of spin.
- sgalway
- Posts: 10
- Joined: Fri Nov 12, 2021 12:42 pm
Re: countio and debounce
I am using a pyportal Titano. Anemometer pulse frequency is on the magnitude of 10-20Hz. I've thought about doing something similar, but I can't figure out how do it asynchronously. I need the count to accumulate despite my loop pausing.
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: countio and debounce
I used millis in Arduino and checked if the second trip is longer than a switch bounce (milliseconds)
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: countio and debounce
A capacitor could also be used to debounce the signal.
Please be positive and constructive with your questions and comments.