Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Android's Linear Acceleration versus applying a low pass filter

I am trying to determine the benefit of making use of Android's Linear Acceleration data as opposed to simply applying a low pass filter as presented in Androids API reference and discussed in this other stackoverflow question.

I am asking as I am trying to get hold of a free app that records Linear Acceleration (as well as fullfils my other requirements (sampling rate, writing data to file etc...)). I haven't been able to find one, so I have considered just using an app that records using the standard accelerometer and then I'll simply apply the low pass filter to the data. Alternatively I could just write my own app to do what I need - but I don't have much experience in Android dev and this will take some time.

like image 517
dgldy Avatar asked Jun 23 '13 17:06

dgldy


People also ask

Why low pass filter is used in accelerometer?

The total noise power at the output of a system directly depends on the system bandwidth. That's why we need a low-pass filter to limit the bandwidth to the maximum frequency needed by the application. This maximizes the resolution and dynamic range of the accelerometer.

What is high pass filter in accelerometer?

High-pass filters are generally included in the analog circuits to prevent drift in piezoelectric accelerometer signals. Analog high-pass filters remove low frequency information, but also corrupt the amplitude and phase of the signal near the filter corner frequency.

What is Android motion sensor?

The Android platform provides several sensors that let you monitor the motion of a device. The sensors' possible architectures vary by sensor type: The gravity, linear acceleration, rotation vector, significant motion, step counter, and step detector sensors are either hardware-based or software-based.

What is accelerometer sensor Android?

Accelerometers in mobile phones are used to detect the orientation of the phone. The gyroscope, or gyro for short, adds an additional dimension to the information supplied by the accelerometer by tracking rotation or twist.


1 Answers

I have explored this subject at some length and I may be able to help point you in the right direction.

As others have mentioned, only some phones have implemented TYPE_LINEAR_ACCELERATION and TYPE_GRAVITY and they usually are equipped with a gyroscope. A Droid Razr even has a gyroscope, but they never bothered to implement it or TYPE_LINEAR_ACCELERATION. I believe the GS2 has TYPE_LINEAR_ACCELERATION implemented, but no gyroscope so they must have used the magnetic sensor or some sort of low-pass filter. It can be frustrating.

On most phones with a gyroscope there is some sort of fusion between the acceleration sensor and gyroscope (probably a complementary filter to compensate for drift and then quaternions or cardan angles to isolate gravity). These fusions and filters can be implemented differently and use different hardware, etc... Latency and accuracy are going to vary among devices, so TYPE_LINEAR_ACCELERATION isn't always going to produce the same results.

If you do not have a phone with TYPE_LINEAR_ACCELERATION, you are stuck with TYPE_ACCELERATION, which cannot separate gravity (tilt) from linear acceleration.

One option is to apply the low-pass filter. This may or may not work depending on your application. I have written a free application to help developers and other interested parties explore the low-pass filter option.

Another option is to just measure the tilt of the device when it is static and then apply that gravity measurement while the device is not static. If the device isn't changing the orientation often, this can be an excellent option because it is really fast and simple.

An excellent alternative sensor fusion option is to use the magnetic sensor instead of a gyroscope. This option will work on almost all devices assuming the magnetic field isn't under the effects of hard or soft iron distortions.

I have implemented all of these approaches in the open source project Acceleration Explorer

like image 76
Kaleb Avatar answered Sep 21 '22 01:09

Kaleb