Go Down

Topic: Noise reduction through deletion, not averaging. (Read 3546 times) previous topic - next topic


I'm trying to get a sound sensor to control a servo or motor they way a potentiometer would.  The problem is that the sound sensor hiccups a value to zero about every third millisecond or so, no matter the input.  This sends the servo wiggy.  I used a modified version of the smoothing example, but that cuts my highest results in half, and the thing is still kinda jittery.  All I want to do is to have the Arduino ignore a reading of 0.  I'm just not sure how to do that.  Please help.


Well presumably at present you do something with the readings. So just don't do that something with a 0 reading.

if (getReading() != 0) {

Rob Gray aka the GRAYnomad www.robgray.com



to generalize AWOL's solution :


if (getReading() >= MINIMUMSIGNAL)

furthermore instead of averaging you could use the median - http://arduino.cc/playground/Main/RunningMedian - to prevent spikes

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131