Reputation: 29
I need to estimate the direction and the distance from the router in android application. in this way, for example, I can know in which room I am in my house.
any ideas?
Upvotes: 0
Views: 1498
Reputation: 1
Unfortunately I don't think there is a way to find the direction of the signal but there is a math formula to calculate the distance. Just to let you know the results are quite reliable if there are no objects between the android device and the router(like 20cm divergence) but even if you are between the router and the device the results are like 10 meters different from the real distance.
This is the formula
public double getDistance(){
double exp = (27.55 - (20 * Math.log10(freqInMHz)) - signalLevelInDb) / 20.0;
double res = Math.pow(10, exp);
return res;
}
Upvotes: 0
Reputation: 5022
If you go to each room in your house and take average measurements as to the signal strength/rate etc, basically taking as much information for reference as possible in every room and in various parts of the room, you could make a reasonable estimate.
Bearing in mind that all this information varies quite significantly even in different parts of a single room, you would probably end up with a reading which suggested the likelihood you were in any particular room, based on perhaps the number of times that combination of data occured in different parts of that room.
It's quite a lot of work for a fairly inaccurate result but it would be good fun as a development project if that's what you're after. The principle is you need to take reference information and build a database to consult for suggestions with varying probability.
Upvotes: 1
Reputation: 40710
You may be able to estimate distance, but it's not going to be reliable -- the thing to do is to wander around your building, noting power levels at each point. You can then work out possible locations based on the current power level. You're not going to get a single value for your distance, though, because the signal will be affected by walls and other obstructions.
Automating any of this is left as an exercise to the reader :).
Upvotes: 0