Filter the errors of accelerometer readings from smartphone using mit app inventor

Any one know how to filter the errors of accelerometer readings from smartphone using mit app inventor.
Kindly reply.

" filter the errors of accelerometer readings" … please explain.

Here is what a developer can do with an accelerometer AccelerometerSensor .

Depending on what ‘errors’ you experience, you may ameliorate the problem by filtering the data stream ( perhaps using a Clock), setting the Sensitivity to a lower value and/or experimenting with the MinimumInterval.

Provide a better description and a code snippet and someone might be able to offer specific advice.

Thanks for your response.
I want to use kalman filter in Mit app inventor to reduce the error, since the plotted wave form of accelerometer readings is not in the form of proper sin wave. This leads to problem in position calculation.
So kindly help with , how to use Kalman filter in collected readings of inbuilt accelerometer from phone using mit app inventor.

Hi Reshma

A Kalaman filter is an algorithm to filter ‘noisey’ environments using mathematics.

You did not explain what you coded, what it is supposed to do , how you are plotting accelerometer data or post an example of what your plots look like. Someone needs to know that to advise you how to use the Kalman filter to smooth your data.

You said "plotted wave form of accelerometer readings is not in the form of proper sin wave. ". Yes, that is true. The sensor is not capturing smooth actions because the variations are most probably arbitrary. A sine wave is a mathematical curve that describes a smooth periodic oscillation. You want to smooth the output results of the x, y, z axes? Why would you want to do that?

App Inventor does not have a Kalman filter ‘library’. To filter a data stream using that technique, code an algorithm using Blocks (messy and difficult because this is not a scripting development language and the Math Blocks are awkward for defining complex mathematical operations) , use an extension based on a Java filter library (presently there is no extension that does that filtering) or use javascript implementation of the filter in conjunction with AI2.

A ‘simple’ javascript Kalman filter might work for you. You might be able to implement the filter for your purposes using the WebViewer . The article does not explain how to do that using AI2.

Here are additional descriptions that might be useful :slight_smile:
Kalman Filter (MIT)

Other possible Sources

and here with respect to an accelerometer using various techniques. Again, these are not AI2 discussions.

How you could try to implement Kalaman filtering is up to you , there isn’t a tutorial. If you post what you tried, someone in the Forum might be able to help. However, you need to share your data and code to get additional advice.

Here is a Forum discussion where one developer developed a ‘seismograph’ using AI2 and the Accelerometer. He plots smooth x,y and z curves simultaneously. The example might be something you could do to plot your data… see Seismic …Look at the aia on the 6/25/14 post What this developer does might suit your purposes but be aware he has a simplified approach to smoothing. See the discussions of possible ways to filter the accelerator data stream earlier in the discussion.