Open UnguidedFreedom opened 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.
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), themu
coefficient is 1 and the formula becomespow(10.0,- 10*log10(4*pi/(c/freq))/20)
which can be simplified tosqrt(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 toc/(4*pi*freq)
rather thansqrt(c/(4*pi*freq))
. I therefore think the coefficient in front of the thelog10
should be20
instead of10
.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?