countio and debounce

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sgalway
 
Posts: 10
Joined: Fri Nov 12, 2021 12:42 pm

countio and debounce

Post by sgalway »

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.

User avatar
Franklin97355
 
Posts: 23940
Joined: Mon Apr 21, 2008 2:33 pm

Re: countio and debounce

Post by Franklin97355 »

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.

User avatar
sgalway
 
Posts: 10
Joined: Fri Nov 12, 2021 12:42 pm

Re: countio and debounce

Post by sgalway »

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.

User avatar
Franklin97355
 
Posts: 23940
Joined: Mon Apr 21, 2008 2:33 pm

Re: countio and debounce

Post by Franklin97355 »

I used millis in Arduino and checked if the second trip is longer than a switch bounce (milliseconds)

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: countio and debounce

Post by danhalbert »

A capacitor could also be used to debounce the signal.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”