Page 1 of 1

method to debounce / ignore noise on ADC

Posted: Wed Aug 10, 2011 2:47 pm
by daveb0360
Hi,
Can anyone suggest a method of including debounce or noise/spike suppression on ADC inputs.
My design watches for an analogue signal voltage falling outside a mid rail 'ignore' window and reacts accordingly. I have overcome this programmability thanks to the forum and can include hardware filtering on board but I would like to be able to write into the code that a reaction is only valid if voltage is outside this window for more than say, 250ms.

Any simple way this can be done?

Dave

Re: method to debounce / ignore noise on ADC

Posted: Wed Aug 10, 2011 3:21 pm
by Benj
Hi Dave,

You could add a low pass filter to the ADC inputs to do it via hardware. Low pass filter can be made with simple resistors and capacitors.

You could also add a software debounce by creating some kind of checking procedure.

eg.

sample = readADC

if ((sample > minrange) && (sample < maxrange))
yes: in range ok
no: outside of range, delay and retest.

Re: method to debounce / ignore noise on ADC

Posted: Wed Aug 10, 2011 3:30 pm
by daveb0360
Thanks Ben,
I already intend to have hardware filter and was just wanting belt and baces approach to augment the hardware because this trigger MUST NOT activate in error.

Your decision and retest is logical and I think a loop of 10 with 25ms per test is a good way to be sure.

Thanks for the input.

Dave