Brendan Gillatt wrote: > On 16 June 2012 09:10, Electron wrote: > > On a 3-axial accelerator I compute the magnitude by simple Pythagorean > > theorem in 3D, i.e. Mag=3Dsqrt(AccX*AccX+AccY*AccY+AccZ*AccZ) > > > > It is an analogue accelerometer with significant RC filters between its= 3 > > analog outputs and the PIC ADC. > > > > Leaving the accelerometer stationary, whatever the inclination, I measu= re > > 1.0g of course. > > > > But in the presence of strong vibrations, I measure a mean magnitude of > > more than 2.0g! > > > > Is this theoretically even possible, or should I bughunt it? If it's th= e > > filters, then I thought that the vibration would cancel out thanks to > > them, was I wrong? > > Are you taking the mean before or after finding the magnitude? If after t= hen > you will always get a positive mean. Think about it: the magnitude of a > positive and a negative acceleration will both be positive and hence will > not cancel. > > If you take the mean beforehand I'm not sure what is going on to cause su= ch > a large error. Just to add some detail to Brendan's response: The squaring operation in th= e magnitude calculation is functionally equivalent to a rectifier, in the sen= se that whether the input signal is positive or negative, the output will be positive. Consider the simple case, where gravity is entirely on the Z axis and the X and Y axes are zero. Vibration adds a signal to each axis, and any part of this signal that makes it through the analog filters on X and Y can only ad= d to the overall magnitude. Even taking the mean of each axis individually upstream of the magnitude calculation is not going to be a perfect solution. The "mean" operation is just another type of low-pass filter, a.k.a. "boxcar filter", a form of DSP= , and it is by no means a great filter either. Some of the vibration signal will still get through. And don't forget about aliasing issues: Any vibration signal components tha= t get through the analog filters and make it to the ADC that are at or near t= he sampling frequency (or its multiples) will show up as low-frequency compone= nts in the digital data that will be impossible to remove later. By far, your best bet for good accuracy is to find a way to physically isol= ate the accelerometer from the source of the vibration, e.g., using Sorbothane mounting hardware. In other words, a mechanical low-pass filter. -- Dave Tweed --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .