Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Sensor filtering

2005-09-11 by Robert Adsett

At 03:26 PM 9/11/05 +0200, Ralph Hilton wrote:
>On Sun, 11 Sep 2005 05:13:09 -0000 you wrote:
>
> >I have a circuit with an Accelerometer connected to an ATmega32.  The
> >Accel measures 2.5V at rest and goes to .5v or up to 4.5v when tilted.
> >The motors I am using on this bot cause vibrations when running and I
> >can't get a clean signal fromt he Accel.
> >Is there a way to filter the noise from the motors out of the Accel
> >signal through CodevisionAVR?
> >Thanks!
> >~Mike
>
>A moving average is quite easy to implement. Just put the values into an 
>array and
>maintain a sum, adding the latest value and subtracting the oldest. I got 
>better results
>using a hardware filter - a dual op amp connected as a low pass filter.


I'd second the use of a HW filter.  A simple RC will likely help a lot.  It 
will be useful even if you add software filtering.  It is necessary to get 
the input frequency down so that you avoid 'folding' higher noise 
frequencies into your input where averaging may actually amplify them if 
you are unlucky.  Just as bad I've seen noise spike do funny things to A/Ds 
if there aren't filtered out.  I ran into that when I used a system where I 
knew the sensor bandwidth was low and left out the Nyquist filter, the 
input line picked up spikes from the power switching elements and fed them 
in the A/D lines which led to occasional bad readings.

On a second note it is entirely possible you are getting electrical rather 
than mechanical noise coupled into your system.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.