Not the Typical Signal Debouncing. What Do You Guys Think?

Hi all,

In this part of my project, I'm reading "raw" data from an IR sensor. It sends a HIGH whenever it's not detecting any IR signals. I of course am interested in making sure that the HIGH signals that the sensor sends are not false positives (due to noise, etc.).

I know that, in my case, the "IR barrier" is going to be cut for at least 1 second. So I'm thinking a way to accomplish my goal would be to take multiple back to back samples from the IR sensor after the first HIGH signal is detected—let's say 5 samples. If at least 4 out of 5 of those samples are HIGHs, then count the first HIGH signal as a "legitimate" HIGH.

What do y'all think of this method? Is there a more "efficient" way I can improve this?

Thank you.

This library might be of help: it's a different approach to debounce a noisy signal and similar to what you describe in your IR sensor setup.

When you post a question about some hardware, please include a link to the datasheet or product page for the hardware you are talking about. We cannot read minds, we can read datasheets...

MarkT:
When you post a question about some hardware, please include a link to the datasheet or product page for the hardware you are talking about. We cannot read minds, we can read datasheets...

My apologies. These are the data sheets:

IR Receiver (model TSOP38238): https://cdn-shop.adafruit.com/datasheets/tsop382.pdf

IR LED: https://cdn-shop.adafruit.com/datasheets/IR333_A_datasheet.pdf