subpos / subpos_receiver

http://www.subpos.org
GNU General Public License v3.0
21 stars 11 forks source link

Distance calculation formula #2

Open UnguidedFreedom opened 8 years ago

UnguidedFreedom commented 8 years ago

Your source code (receiver.ino, line 250) and your wiki indicate the same formula to compute the distance from the RSSI. In this formula, the λ/(4π) contribution is in the form pow(10.0,- 10*log10(4*pi/(c/freq))/(20*mu)). In the case of a lossless path (i.e. in vacuum with no multipath), the mu coefficient is 1 and the formula becomes pow(10.0,- 10*log10(4*pi/(c/freq))/20) which can be simplified to sqrt(c/(4*pi*freq)).

However, when inverting Friis' transmission equation (P_RX/P_TX = G_RX*G_TX*(λ/(4πd))^2) to compute the distance, we see that it is proportional to c/(4*pi*freq) rather than sqrt(c/(4*pi*freq)). I therefore think the coefficient in front of the the log10 should be 20 instead of 10.

Do you agree on this or do you have a justification for the use of the 10 coefficient? Do you get accurate distance estimations with your formula?

bleckers commented 8 years ago

The distance calculation code really is only an example and as such, any model (empirical or otherwise) will do nicely provided you test it.

The model I used was published in a paper on indoor locations with smartphones, which was developed with their own empirical results: http://www.academia.edu/5075508/Robust_Indoor_Wi-Fi_Positioning_System_for_Android-_based_Smartphone

This was originally used in the Android libraries and was then converted to the Arduino libraries, so there could be a mistake. Here's the original Anrdoid library - https://github.com/subpos/subpos_android_api/blob/master/SPSData.java

I did try a few different models early on, and this gave the most realistic results all round.