ESP32 WiFi.RSSI

Hi

After a whole afternoon of Googling and reading other posts in this forum, I still have not resolved why WiFi.RSSI always returns 0.

  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
  delay(100);

From what I understand, this should return the signal strength, but it always returns 0.

Doesn't seem to matter where I request it (just after the WiFi.mode(WIFI_STA); command), or later in the code... it doesn't work.

Lots of people seem to have this issue, but I have yet to find a resolution.

I have 2x ESP32's talking to each-other over ESP_NOW.
Just wondered if anyone had ever got this command to work?

You need to call the following (in setup)

int8_t scanResults = WiFi.scanNetworks();

Then this returns the signal strength of the available networks:

  int32_t rssi = WiFi.RSSI(0);                          
  String SSID = WiFi.SSID(0);

  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");

0 = The number of the network you want the strength from (0 = top of your network list).

BUT.... This doesn't return the signal strength of another ESP32 in the ESP_NOW link.
Still working on that.

I suspect I need to set the other ESP32 to be both ESP_NOW and as an AP point (if possible).
Then maybe I can obtain the value of the signal strength from that WifI connection.

Not sure if you need to keep calling 'int8_t scanResults = WiFi.scanNetworks();' to get a new value.
Hope not, because that actually disconnects the WifI briefly.

I will continue to tinker

If you set the ESP32 you are linked to as a access point and station, it works.... .kinda

  WiFi.mode(WIFI_AP_STA);                                                      
  WiFi.softAP(WIFI_SSID, WIFI_PASS);                                                       
  int32_t channel = getWiFiChannel(WIFI_SSID);
  esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);

This works and transmits an SSID I can gauge the signal strength off of. And the ESP_NOW link still functions fine.

BUT....

  int32_t rssi = WiFi.RSSI(0);                           
  String SSID = WiFi.SSID(0);

  int8_t scanResults = WiFi.scanNetworks(0);             // This stops the network briefly

  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");

  Serial.print("SSID: ");
  Serial.println(SSID);

It only returns the last received signal value when you call int8_t scanResults = WiFi.scanNetworks(0);

You have to keep requesting that command to get updated signal data and that disconnects the ESP link briefly which is very annoying.

Also, the '0' is the strongest network. If there is a stronger network closer to the ESP32 than your other ESP32, then it will read the strength of that instead.

I am going to add a search loop to look for the required SSID and only read that signal strength.

But, still doesn't fix the brief disconnect

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.