So I've been struggling with this issue for a while now:

I have a raspberry pi with wifi sensors on it and I need them to get the RSSI (signal strength basically) of the wifi-direct signal transmitted by a different AP.

Since these will be used to get distance measurements (between the pi and the AP), I need to get them with a high frequency within one second (or, ideally, I want an average of the RSSI within 100ms or within a second).

I know I can get RSSI using wpa_supplicant's p2p functions, but the frequency there is around 6-12 measurements/second, with a pretty high variance. Does anyone know of any other tool/way that could help? If wpa_supplicant provides 'average measures' that would be great as well.

NOTE: I do not fully understand the math/science behind how the distance/angle will be computed, as I'm only in charge of getting a head start on implementation. It might be that these values are good enough. I might be missing something conceptually. If so, please let me know :).


Don't use wpa_supplicant, go one level lower. I just tried

while true ; do date -Ins ; /sbin/iw wlan0 station dump | grep signal ; done

on my desktop which gives me more than 100 measurements per second, with not a particular high variance.

So I guess if you grep for signal avg instead of signal once every second, you should be fine. Though it might look different on the RaspPi because of less processing power.

Note that those values are computed by black magic inside the driver, differ from hardware to hardware and driver to driver, and should only be used as a rough indication, and don't assume the values are linear with distance.

So you'll need lots of measurements to pinpoint the source with any accuracy.

As for the maths, you should assume a monotone function to map signal strength to distance or vice versa, maybe make some assumptions how this function could look like (e.g. quadratic/cubic, maybe do some measurements first), derive some error value for given source coordinates, and look for coordinates that minimize the error.

If you happen to make an open-source project for this, I'd be interested in seeing a link. :-)

  • Perfect! Unfortunately you were also right on needing a lot of measurements for accurate readings. Still need multiple readings and your method is perfect for it!
    – Emad Y
    Mar 12 '17 at 11:49

You can get the signal strength every second through:

watch -n 1 cat /proc/net/wireless


watch -n '0.1' "iw wlan0 scan | grep 'SSID\|signal'"

The command wavemon after installing wavemon package

wavemon is a wireless device monitoring application that allows you to watch signal and noise levels, packet statistics, device configuration and network parameters of your wireless network hardware. It should work (though with varying features) with all devices supported by the Linux kernel.

enter image description here

Also you can use the bmon command after installing [bmon]3

It can be installed through : apt-get install bmon

bmon is a monitoring and debugging tool to capture networking related statistics and prepare them visually in a human friendly way. It features various output methods including an interactive curses user interface and a programmable text output for scripting.

the wpa_cli command:

watch -n 1 "wpa_cli signal"
  • Unfortunately the highest this can go is data every 0.1 seconds which is not enough in my case. The wavemon tool seems to circumnavigate this using the 'average' metric, but it seems difficult to scrape (I'm new to linux :S). Definitely +1 for a nice way to allow me to visualize the signal when not doing it in code, unfortunately I don't have enough reputation for that. Thanks though!
    – Emad Y
    Mar 12 '17 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.