Saturday May 18, 2024

Article: How to Choose A Sensible Sampling Rate
  Posted by: AceBHound on Aug 24th, 2011 9:02 PM
Found a neat article in choosing a sampling rate for switch closures using pinball machines as an example. Instead of taking a shot in the dark at what sampling rate to use it explains there's more of a science behind it.. pretty neat insight into how software's written to correctly identify a switch closing. I'll admit I haven't had a chance to read the whole thing, that's why I'm posting it here for my later perusing :)

How to Choose A Sensible Sampling Rate

Here's an excerpt:
I recently asked an engineer what sampling rate he used for an application he was working on.

"Five milliseconds," he replied. I asked him why.

"Because it works," he said. "We spent days testing a variety of sampling rates, and that is one that works."

His code was for a push-button switch that required some debouncing. He and his team ultimately selected a 5ms polling interval because, during testing, it did not appear to erroneously register a single push as two, and was fast enough to avoid misinterpreting an intentional double-push as a bounce.

Five milliseconds might be an acceptable answer, but without considering other factors in the system-its real-time response, in particular-we don't really know whether or not it is the best answer.

View More Techdose Articles