imp.rssi()

Availability

device

Returns

integer

Parameters

none

Description

This method gives the current strength of the WiFi signal in dBm as detected by the imp. The result is negative, and the higher (closer to zero) the number, the greater the signal strength.

The figure is the raw value reported by the WiFi hardware. To convert it to ‘bars’ of signal strength as seen on phones, tablets and laptops, one mapping might be:

RSSI Bars
below -87 zero (still connected, but barely)
-87 to -82 1
-82 to -77 2
-77 to -72 3
-72 to -67 4
above -67 5

 
There are many more signal strength levels above -67 – values of up to -11 have been reported – but that’s not important: anything above -67 is good enough for everything the imp needs to do. Remember, the value can change even if both the imp and the WiFi access point or router are not moved and remain at constant range.

If the WiFi is not active at all, or during an outage, the result will be zero.

Example Code

This function uses imp.rssi() to derive the number of bars a computer, phone or tablet might present in its WiFi signal-strength icon.