At 14.04 2012.06.16, you wrote: >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 it= s 3 >> > analog outputs and the PIC ADC. >> > >> > Leaving the accelerometer stationary, whatever the inclination, I meas= ure >> > 1.0g of course. >> > >> > But in the presence of strong vibrations, I measure a mean magnitude o= f >> > more than 2.0g! >> > >> > Is this theoretically even possible, or should I bughunt it? If it's t= he >> > 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 = then >> 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 wil= l >> not cancel. >> >> If you take the mean beforehand I'm not sure what is going on to cause s= uch >> a large error. > >Just to add some detail to Brendan's response: The squaring operation in t= he >magnitude calculation is functionally equivalent to a rectifier, in the se= nse >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 a= dd >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 DS= P, >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 th= at >get through the analog filters and make it to the ADC that are at or near = the >sampling frequency (or its multiples) will show up as low-frequency compon= ents >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 iso= late >the accelerometer from the source of the vibration, e.g., using Sorbothane >mounting hardware. In other words, a mechanical low-pass filter. This is impossibile but I can take care of aliasing issues, and add very hi= gh RC constant analog low-pass filters. But if this alone won't be enough, I give up, as I cannot mount extra silen= t blocks or other mechanical means. I just tried with my Android phone, the vibrations increase the mean magnit= ude, so it's not my device, it's physics.. I wonder if electronically or via DSP methods the vibrations can be canceled out. Using a magnetometer is impossibile, as the device is mounted on a steel fr= ame. Gyro's are expensive, and anyway I don't think they will help, as they need= a fixed reference, and the magnetometer can't be used (steel frame) while the accelerometer suffers from the vibrations issue, as said. NOTE: all I really need is to know the inclination of my vehicle (dirt bike= ) but as I said the vibrations are extreme, and the mounting point can't be chosen/changed (it's on the frame). With kind regards, Mario >-- 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 .