when the switch is off you see a low duty cycle signal between 0-12v and when the switch in on it is a high duty cycle signal again 0-12v where no false period is longer than say 10 msec?
That being the case I would want to detect duty cycle ( an average time varying quantity). Basically counting up and down cycles over a finite sliding window.
You can do that by analog integration with a low frequency pole (a few Hz) and operate on the minus 1 slope ( you said you did a second order filter which would be a double integration ). I would tend to want to do that by performing an averaging in software. So you clamp/current limit the voltage input to the 12v range mainly to protect the controller, and now detect duty cycle . No debounce required.



Comment