Get relative information about phone movement inside of a car - Android - android

I am wondering if there is any way that I can make an app that detects moment of the phone inside of a moving car. Let me expand. Lets say I want to make an app that displays the phones relative speed, or velocity. If the phone is not moving inside of the car, but the car is moving 50 mph...I do not want the app to display 50 mph. I want the app to display 0mph. But if the phone is thrown in the moving car... I want the app to only display the speed at which the phone was thrown.
Please let me know if this is possible and how I should go about this :) Thank you for your time

You aren't going to get very accurate data for this. Accelerometers are very noisy, and the signal you're looking for is small compared to the signal of the car itself accelerating and adecelerating. GPS isn't really accurate enough for small movements within a car.
What you really need is a second source of data for the car alone. Either hooking into the car's data via an SDK (I think Ford and some others have this) or from a second phone that stays stationary in the device. These two devices could be calibrated together, and then the delta between the two devices would be the phone's movement relative to the car. Expect it to be extremely noisy though- accelerometers in phones are noisy and sensitive. And over time random noise would make it less accurate until you recalibrate.

Related

Check if still android device is in acceleration in a moving car using accelerometer

I have a scenario,
I have kept my android device in the car. Can i check if the car is moving using accelerometer.
you may not be able and has nothing to do with maths or the system you choose. Inertial velocity cannot be measured at all. Without looking outside the car you cannot distinguish wether it is moving or not if speed is constant. The phone won´t be able on doing that with the accelerometer, maybe with the camera...
you may need two cameras, though, because you have to measure distances and triangulate where you are and where you´ve moved to in a time period. And what if the cameras fix a point on a plant or a tree that keep waving with the wind?
would not gps be better?

Finding the cartesian coordinates of another smartphone?

Considering I have two smartphones, A and B. If I am holding smartphone A, is there a way to determine the location of B in relation to myself?
So if we had the situation of this image:
:
it would tell me B is at position (2, 1).
Inventive methods like using the strength of wifi signals to get position are more then welcomed. Could I also determine if there is a wall between the two phones?
As far as I understand, both Bluetooth and Wi-Fi signals move in a radial wave in all directions - so while you may be able to measure the distance between the two terminals, I doubt this would give you a correct reading, since it could either be on your "side" of the circular area or another one equidistant to the source of the signal.
While GPS may be the obvious solution since it provides exactly what you're looking for, I'm not sure if you're including this as an option. Once you get the two coordinate sets for the devices, it's a matter of calculating the offset (N/S and E/W) from device 1.
This makes me think on the accuracy given by GPS, which considering that you were including the tag Bluetooth in the question and since Bluetooth has a range of around 15-30 feet (type 2-3) and the GPS has an error margin of 25-35 feet, this may not be good either.
If you do manage to get a connection (Bluetooth) between the two devices, you'd already know your in that range, but not in what direction. You can get a signal strength measure from Android 2.1: How do I poll the RSSI value of an existing Bluetooth connection? but there-again I'm not sure as to how to detect in what direction the user is relative to you, just how close he is, in any direction. Hell the other device could be on top of you or under you and you'd get virtually the same reading as next to you given equal distances.
This is all on a "static" approach, meaning both devices are stationary. However if you measure that value and then take a step to your left and re-measure you can tell if you're closer or further away from the source, so with a little trial and error of one of the devices moving you could determine a relative position, this however may not be useful for you since you'd either need to tell the phone manually that you moved left and to re-measure or use something more complicated like monitoring the accelerometer of the phone which could tell in what direction the phone moved and map the strength of the signal.
Am I losing my mind? Probably.
No answer as far as I'm concerned for now, just thoughts. Depending on what the application will do, there may be other viable approaches. This is my brain-dump answer so hopefully someone else can read it and come up with a more elaborate answer instead of rumbling thoughts.
If the distance from A to B is more than a few metres, then if you can get the GPS location of both A & B, you can easily calculate distance and bearing between them using the Location.distanceTo() and Location.bearingTo() methods.
Depending on the physical environment, it is probable that two GPSs which are physically close together will be using the same satellites for calculation, and that the errors will be similar in both. So in some cases using GPS may work for small distances.

How to detect user movement in Android by using wifi rssi or acccelerometer?

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.

Detect if Android is in a car

I am trying to write an application on Android which requires to detect whether the android is currently in a car or not, using only accelerometers. Basically the app is suppose to detect if the person holding it is walking or in a car. For walking I just detected spikes in the accelerometer readings but I am not able to find any characteristic of the car. How exactly should I approach this problem?
First of all, the problem as posed is unsolvable - a phone sitting perfectly still in a parked car (or, for that matter, one running at constant velocity) is completely indistinguishable from one sitting on a desk if you restrict yourself to acceleremoter readings.
For heuristics, I'd just go and record samples, then hone detection algorithms on them. I assume characteristics for (city) traffic would be bouts of near-constant acceleration over a few seconds totalling up to around 10-20 m/s and somehwat more abrupt decelerations of about the same total velocity. I don't think you'd be able to integrate accelerometer readings well enough to accurately track something like a car smoothly accelerating to cruise speed, staying there for an hour and then rolling to a standstill over a long stretch, though.
What are you trying to achieve?
Well obviously, the typical largest differences are acceleration and speed (and perhaps sustained speed). My suggestion, build a profiling application and go have some fun on various types of transportation.

How to detect phone orientation relative to direction of movement

Problem: Consider an Android device mounted in a vehicle. We want to measure various things using the accelerometer. These measurements should be relative to the vehicle's coordinate system. Thus we need to figure out how the device is oriented in relation to the vehicle. The simple solution would be to just average the "early" acceleration after startup, but I'm worried that the first thing the driver will do is leave a parking lot or a turning left onto the road, thus describing a curve. It would be feasible to ask the user to start measuring after getting on the road, but what if there is no acceleration at that point?
Question: Can someone suggest a strategy or an algorithm that would do a reasonable job of telling how the phone is oriented in relation to the vehicle? A pointer to some FOSS source that solves a similar problem would be even better.
Notes:
I do not want to use GPS for this as it would complicate things for the user.
We can interact with the user, for example by requesting that the user starts measurements before starting out.
The accelerometer alone would not provide sufficient information for your purpose, I would hazard: The vectors acting upon the device, besides vehicle acceleration, will be the vibration of the vehicle itself, road inclines, braking and centripetal force from turns.
The amount of data from sensors due to all those forces would be impractical to aggregate on a phone, hence moving averages or other cumulation approaches would not give even vaguely precise results.
Also, a lot of the acceleration data would be lost between sensor sampling times, even if you were to use the highest available sensor rate.
Recommendation: Use GPS or network positioning information, generate moving averages to account for minor aberrations, and use the result.

Categories

Resources