i am developing an android application which have module to search all nearest / detected wifi hotspot.
i can get all detail from searched wifi hotspot like,
SSID, BSSID, capabilities, frequency, level and timestamp
with these information, i also need Distance of wifi ( The distance between wifi accesspoint and Mobile Device )
i am using below lines to get Distance.
double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0;
double distanceM = Math.pow(10.0, exp);
this will return distance in meter.
i got these code by reserch on google from many pages.
but i think i am going wrong, this code is returning wrong distance. i also tried a lot on google search but not getting accurate output.
Please help me. how can i get Distance between Wifi AP and Mobile device?
This code:
double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0;
double distanceM = Math.pow(10.0, exp);
Works under the assumption of free space path attenuation between two isotropic antennas and the AP transmitting at a power of 20dBm (and the math is not even correct; the frequency dependence of free space path loss is different; not that is matters for the bands of W-LAN, uses, the correction is in the 27.55).
In reality you're dealing with anisotropic antennas, obstacles in your path, diffraction effects and the AP varying it's power output to save energy if no high bandwidth is required.
Or in other words: It's totally impractical to obtain a reliable distance figure just looking at the received power. It can give you a ballpark, order of magnitude, but not something that's remotely accurate. This is just basic physics.
The only reliable way of measuring distance is time-of-flight. For this you have to measure the roundtrip time between the device and the access point. Since we're dealing with the speed of light and distances in the order of meters up to 100m (top), this means measuring nanoseconds. Can be done but requires some work. See the link SatelliteSD gave you (it's in German but the diagrams and keywords should be understandable).
It is possible, you could use the Time-of-Flight approach. Keep in mind that you can't rely on the messages recieved, but on the overhead received (like ACK)
I can only come up with this reference (german language) measuring of signal runtimes
And from a quick read I think it is a very tedious thing to do.
No, it is not possible.
You'll not be able to find the hotspots distance from your current device location to the actual hotspot.
It seems that the hotspots don't report their coordinates.
Check the Link which has more detailed info.
There is a method called "triangulation" but for this case you have least 3 hotspot. You can answer with detail in this pdf.
http://www.see.ed.ac.uk/~slig/papers/ITM2010.pdf
Related
I wrote an app to detect beacons and calculate the distance by RSSI.
When I use iPhone/android for simulating as beacons will cause a big difference on RSSI.
Such as I put iPhone at 3M far from BLEscanner the RSSI is -65. But at the same place, the RSSI of the android devices will be -80 or more.
Does anyone know how to adjust the difference of RSSI?
As you have discovered, every phone model has a slightly different Bluetooth transmission power. Similarly, every phone model has a slightly different receiver sensitivity. Changing which phone model is used for transmission and reception will affect the RSSI you receive.
You cannot perfectly correct for these differences for two main reasons:
There are lots of other factors that come in to play that affect RSSI that have nothing do do with the phone model (signal reflections, attenuation by the air or obstructions, the effect of a phone case, a nearby hand holding the phone or other human body parts.)
There are limited data on the differences between phones in terms of Bluetooth transmitter power and receiver sensitivity.
With those caveats in mind, Google did create a limited dataset of correction factors as part of its coronavirus contact tracing effort with Apple.
You can read how this works here
And see the full correction data set here
The basic idea is:
Take two values from the CSV data set above for your test setup:
Use "tx" column value for the transmitting phone model as its "TX_Power" in the equation below. Use "RSSI_correction" column value for the receiving phone.
Then plug them into this equation:
Attenuation = TX_power - (RSSI_measured + RSSI_correction)
The resulting Attenuation value is the corrected signal loss (measured in dB and usable similar to RSSI) between your transmitter and receiver and can be used as an input to distance formulas.
I'm making an android app that connects to an OBD-II device (ELM327 - http://www.dx.com/p/elm327-bluetooth-odb2-v1-5-car-diagnostic-interface-126921#.V86wdih97IU) via Bluetooth.
I'm also using the https://github.com/pires/obd-java-api/ library to get the data from the device.
I am able to connect to the device and get data without any problems but when I try to retrieve distance it always returns it in KM. Is there a way to get the distance of a trip in meters instead?
I tried using the Torque Lite app (https://play.google.com/store/apps/details?id=org.prowl.torquefree&hl=en) and its able to return Trip distance in KM with one decimal place (0.0 KM).
Would like to know what command it uses to actually get the values or does it derive it from something else.
Unfortunately, a standard PID for distance traveled simply doesn't exist. See this for a list of standard PIDs.
The code you are using now, DistanceSinceCCCommand, uses standard Mode 01 PID 0x31 to retrieve the distance driven since the last clear codes command. The PID has units of integer kilometers and thus cannot give you the precision you are seeking.
I tried using the Torque Lite app (https://play.google.com/store/apps/details?id=org.prowl.torquefree&hl=en) and its able to return Trip distance in KM with one decimal place (0.0 KM).
The torque app used location(GPS) information from the android device to record geo location. I'd guess that it is using that information to determine the trip distance to the precision of 0.1km.
Recommendation
I'd recommend you follow their lead and use location data to determine distance traveled if you need that sort of accuracy.
Use a Location Listener from the google location api and Location.distanceTo(location) to determine the incremental location changes.
More On Enhanced PIDs
Enhanced PIDs (also called DIDs) are mode 22 parameters that are vehicle specific.
There exist many other vehicle parameters that are not publicly documented and may offer better precision. They are vehicle specific (but usually common to a subset of vehicles from the same manufacturer). They are Mode 22 enhanced PIDs. Here's a list of old Ford DIDs. If anyone can find a newer list of mode 22 DIDs, please edit my post and add it as I know there are many more than I've found available publicly.
GM Chevy Spark PIDs
You could read the OBD-II Mode 1, PID 0D to get the speed at regular intervals. This would give a decent distance reading in metres if you read often enough and apply the distance = speed * time calculation.
Most of the classes implement
ObdCommand
which has a method
useImperialUnits(boolean)
so, if you use, say, DistanceSinceCCCommand, then
DistanceSinceCCCommand distanceSinceCCCommand = new DistanceSinceCCCommand();
distanceSinceCCCommand.useImperialUnits(true);
would do the conversion.
You can find interesting stuff if you examine the library source.
You can also use
getImperialUnit()
if you just want the numeric value rather than the string with a trailing units label.
I am building an application that collects the RSSI levels of APs around me and do some calculations based on that.
The problem is that the readings are unstable even if the device is still. For example, signals from an access point fluctuates between -71, -68,-75 and so on....
Is there a way to stabilize the signals?
In telecommunications, received signal strength indicator (RSSI) is a measurement of the power present in a received radio signal.
I think the best you can do is count them al together and devide them after a x amount of measssure time. (since you would never get an 100% accurate acces point because of al kinds of components).
source:
http://en.wikipedia.org/wiki/Received_signal_strength_indication
"The problem is that the readings are unstable even if the device is still. For example, signals from an access point fluctuates between -71, -68,-75 and so on...."
This is the nature of the wireless signal. Even if the device is still, the environment is "moving", so, the signal is suffering from small scale fading mostly due to the environment scatterers. So, it is normal to obtain these fluctuations in the device measurements.
The accurancy of each Android device Wi-Fi measurement is another story.
Moreover, keep in mind that the values returned are in dBm which means that is in mWatt but expressed in the log scale. So, as Thealon proposed the averaging, you have to be careful because you cannot devide dBm values.
one solution would be to convert the dBm values back to mWatt and then perform the averaging. like below
Convert dBm to mWatt: mWatt = 10^(dBm/10)
When getting the RSSI, Google recommends to:
Use calculateSignalLevel(int, int) to convert this number into an absolute signal level which can be displayed to a user.
Official Docs
I'm working on a robot which need to know its exact position (with an error of +/- 5cm) in relation to a given point of coordinates (0, 0). So my question is :
Is it possible to get this kind of precision using differential GPS ?
The idea would be to place a GPS at the position (0, 0) and a GPS on the robot to compute the difference of coordinates of the 2 GPS and get the relative position of the robot.
Thanks for your answers
It is possible with DGPS, but bot in an mobile phone.
Precision Farming use GPS with cm accuracy.
With a consumer GPS if you would be able to read out the Satellite RAW data, you could do a GPS Post processing, that way you could reach <1m accuracy.
for cm accuracy you need 2 Phase Gps receiver (conusmer ois 1 -phase),
and additional RTK, Then you have cm accuracy.
Read more by searching for topic RTK, Rinex, GPS Post processing.
(But it is not possible for current mobile phones, using GPS)
And robotoers often want to work indoors, where GPS doesn not work, too.
No, GPS is way too inaccurate for that. Best guess would be that you can use the accelerometer to calculate a relative distance on movement.
Might be placing 3 wifi routers in the field and compute by using their relatively signal strength would give a better appoximation on the robot's current location?
How would I verify/ track device location within a 5' accuracy? I've heard of people using cell towers/ gps combinations.
As far as I know, the only way to get a 5 feet accuracy figure is to use GPS, then it still isn't always that accurate depending on how good a fix of the satellites (clear view to the sky) you have.
Cell tower / Wifi triangulation methods only serve to speed up positioning and will seldom (if ever) be more accurate than satellite positioning methods.
GPS is the way to go. Cell towers won't cut it. In Android (and I believe iOS) the system will provide you with an accuracy reading in addition to the actual location. You could use this value to determine whether the value you've received should be uploaded to your server. Keep in mind using the GPS is very battery intensive and there's no guarantee of how good the accuracy will be. Depending on conditions you may not be able to achieve 5' precision.
As #CommonsWare points out, 5' is really unrealistic anyway although you can get close.
As CommonsWare says you will not get much better that 10 metters accuracy in a consummer-grade device. Even in open sky, the atmosphere characteristcs change minute by minute and thats enough to change the GPS readings.
However, it's teoreticaly possible to increase accuracy if you could get all of the following:
1-There are some stationary GPS receiver stations with fixed known locations which measure the current GPS signals deviation. You would need to have one of those close to you and have access to the data in real time.
2-You would need to have low level access to your phone GPS receiver to read the unprocessed data received from sattelites. This would be different from device to device, and as far as I know, no supplier is providing this access.
3-Finnaly, you would need to do all the calculations required to determine your location applying the deviations got from point 1 above.
good luck.
The only way you can get this type of accuracy is with WAAS. As far as I know, there are no Android handsets that can receive WAAS corrections. If this is for a specific controlled situation, you could use a bluetooth gps receiver with WAAS, and only in WAAS supported locations. However, if this was for a wider deployment, then I think you are out of luck.