How to convert Wifi signal strength from Quality (

2019-01-16 10:09发布

How should I convert Wifi signal strength from a Quality in percentage, usually 0% to 100% into an RSSI value, usually a negative dBm number (i.e. -96db)?

标签: wifi
10条回答
Lonely孤独者°
2楼-- · 2019-01-16 11:02

Im glad I found this post cause I was looking for a way to convert the dbm to percentage. Using David's post, I wrote up a quick script in python to calculate the quality percentage.

#!/usr/bin/python
import os
cmd = "iwconfig wlan0 | grep Signal | /usr/bin/awk '{print $4}' | /usr/bin/cut -d'=' -f2"
strDbm = os.popen(cmd).read()
if strDbm:
    dbm = int(strDbm)
    quality = 2 * (dbm + 100)
    print("{0} dbm = {1}%".format(dbm, quality))
else:
    print("Wifi router connection signal strength not found")

In order to get the highest wifi quality from where my computer is located, I moved/rotated my antenna until I received the highest quality. To see real time quality, I ran the above script using:

watch -n0.1 "python getwifiquality.py"
查看更多
祖国的老花朵
3楼-- · 2019-01-16 11:05

This article is a more detailed explanation of mW, dBm and RSSI

http://madwifi-project.org/attachment/wiki/UserDocs/RSSI/Converting_Signal_Strength.pdf?format=raw

According to it RSSI do not have a unit. It's a value defined in 802.11 standard and calculated by nic card and sent to OS. The nic card vendor should provide a mapping table of dBm-RSSI values.

Sorry for the direct link, but I can not found the original page for the file link.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-16 11:08

From RSSI vs RSS:

RSSI - Received Signal Strength Indicator RSS - Received Signal Strength

RSSI is an indicator and RSS is the real value. Ok, now what do you mean by indicator, indicator mean it can be a relative value and RSSI is always a positive value and there is no unit for the RSSI.

We can say RSSI is for common man to understand. RF values are always told in dBm and the values are negative values most of the time. To make it easy for the people to understand these negative values are converted to positive values through scaling.

Say for example, if the maximum signal strength is 0 dBm and minimum is -100 dBm. We can scale it like as explained. We can put 0 dBm and more (RSS) as 100 RSSI (i. e. maximum RSSI) and -100 dBm (or less) as 0 RSSI (minimum RSS).

查看更多
聊天终结者
5楼-- · 2019-01-16 11:09

I know this may be late but this may help someone in the future.

I took the value of dBm 30-90 for RSSI and correlated it to 100-0 %.

I used the basic linear equation to get the answer.

y = mx + b

We know our x values for dBm as 30 and 90. We know our y values for % as 100 and 0.

We just need to find the slope. So we can make it linear.

m = 100-0/30-90

  = 100/-60

  = -5/3

b = y - mx

 = 0 + 5/3*90
 = 150

Final equation to put in code when you know the RSSI value.

% = 150 - (5/3) * RSSI

Note I did take the RSSI value that is normally negative and multiplied by the absolute value to get positive numbers.

quality = abs(RSSI)
% = 150 - (5/3) * quality
查看更多
登录 后发表回答