All the PIRs I've come across that are intended for intruder alarm systems use a reed switch on the output; IIRC a reed switch does not suffer from contact bounce, so does not need debouncing. However I cannot comment on the detection electronics which drives the relay.I'm not sure if PIRs need debouncing, but I've only ever used a couple of types.
Some of the PIRs have a 'true' latching option, where once set, they require activation of an input on the PIR to reset them.
It may be worth also acquiring the time when each input goes inactive, which gives the possibility of identifying (and probably discarding) very short triggers, and maybe unstable inputs (which could indicate localised interference, or perhaps be a precursor to failure).
The interrupt-driven solution suggested by @scruss is likely to be the best way forward (especially if you have the possibility to trigger on both edges) unless you have other regular monitoring to do.
Even if you think what you have is "good enough" at present, I'm sure you'll want to improve/extend the code in the future!
Statistics: Posted by stevend — Fri May 10, 2024 1:28 pm