How to use Android Accelerometer feature to measure the distance when phone moved position? What is the best way to build this kind of application
example on Youtube
Android Provide SensorManager for this.There are many samples are available which for creating such types of app.Below links may help you :
http://www.techrepublic.com/blog/app-builder/a-quick-tutorial-on-coding-androids-accelerometer/472
http://www.ibm.com/developerworks/opensource/library/os-android-sensor/
There is no way to do it reliably. For true inertial navigation, you need accelerometer as well as hyroscopes. For meassuring distance on plain surface, it could work. You will have to
listen to sensor values with maximal frequency phone gives you.
integrate values over the time.
As your phone lies on flat surface, you shall ignore respective acceleration component.
You may also need some denoizing of acelerometer values - chips used in phones are of miserable quality
Related
I'm going to create an app which uses sensors in a smartphone. Before doing this job, I also want to test the sensors of the smartphone so that I can evaluate their correctness. What are the common ways to achieve that? I'm going to use phone's accelerometer sensor. But I also wonder about other sensors too.
Using a level, verify that a surface is flat. Place the phone on the surface, and ensure that there is a 1g reading in one direction and zero in the others. This can be done in the other two directions as well to ensure they are reading 1g from gravity, but you will need a holder that keeps it at exactly a right angle with the surface (or alternatively, set on the floor with the back of the phone against a wall once you know the wall and floor are level).
I'm trying to write an android code that uses the device sensors to detect freefall scenario.
I searched the web a lot for a solution to this problem but I was unable to find anything useful.
I did see that there are several apps that does exactly this so it is possible, but i didn't find any code sample or tutorial on how to do that.
Can anyone please help me with a code snippet or even with a mathematical calculation using the sensors data?
Thanks in advance
The device is in free fall if the length of the vector given by TYPE_ACCELEROMETER is approximately zero. In theory, it should be exactly zero, in practice, it well be only near zero. So you need to come up with some threshold by trial and error and declare that the device is in free fall if the length of that vector is below this threshold.
Check out the API here SensorEvent Values and the math behind FreeFall here Wikipedia.
You are trying to detect speed in some direction. Look at the motion equations on wikipedia. You are detecting acceleration over time that is normalized for the gyroscopic rotation of the device.
Also see: How to approach Fall Detection Algorithm
From what I've read, the accelerometer normally measures gravity. Thus, if you're in freefall and the device is not being moved laterally, all accelerometer readings should be zero. (Disclaimer: I have not written any accelerometer code.)
Google the iFall project by a group at Florida State University. The have published a paper describiing the approach they took for their Android iFall application, which gives a host of references for further/extended study. They also have an API available and explain how to use it, if you want a fast shortcut approach. (To use their API, I believe you just need to download and install their iFall app form the Playstore)
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.
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
I want to make an app that need to use Gyroscope Sensor
However, due to cheap android phone didn't provide this sensor but it still have accelerometer and digital-compass in itself.
As far as I know.. Since, accelerometer can detect 3 axis of our phone. When compare to Gyroscope, only the thing they lack is they can't detect if user rotate their phone without changing their pose. That's why I need to use digital compass to get the north direction to solve this problem.
So, I would like to know is it possible to just use only these 2 sensors to make a gyroscope sensor work-like? Anyone ever try? Is it actually work?
Thanks
It is not clear why your app needs gyroscopes. I assume that you want to track the orientation of the phone.
You can track the phone orientation reasonably well with the accelerometer, compass and a low-pass filter. It lags a bit but it works, I have impleneted that for the Shimmer platform. See also my answer here with the link to a demonstration video.
In my project, I want to detect if a user is moving or not by using either wifi rssi or accelerometer sensor.
What I should do to achieve that?
It actually all depends on what kind of movement you want to detect.
WiFi RSSIs : From a starting position and scan results (initial RSSIs for newly discovered access points), you can check through time their evolution in term of signal quality. A short displacement of the user will not be easy to find as RSSI values are tweaked by a large amount of parameters (orientation, obstacles, setup of the room, atmospheric conditions, people around). Thus you would need averaged values (scans must then be performed quickly to have enough data) and leaving an access point perimeter would make you lose the information.
Accelerometer : Depends on what quality of sensor you are using. If you're using embedded sensors within smartphones, it will be tough. Their accuracy is bad, and as you'll need to integrate its values (m/s² to get m/s) the error will grow subsequently. Plus it might be hard to discern real user movement from the device's tilt if you're using a mobile phone or tablet.
Without really knowing the details of your projet, I believe that RSSIs should be easier to use if you actually need to detect not so tiny motion. If you want something more precise, you'll need some way bigger research work.
See Android accelerometer accuracy (Inertial navigation) for RSSI-based indoor localization.