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
method to debounce / ignore noise on ADC
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: method to debounce / ignore noise on ADC
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
daveb0360
- Posts: 139
- Joined: Mon Sep 21, 2009 10:17 am
- Location: Leicester
- Has thanked: 35 times
- Been thanked: 12 times
Re: method to debounce / ignore noise on ADC
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
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