Measured RSSI Does Not Change
Posted: Mon Jul 15, 2019 12:42 am
Using Arduino IDE and Adafruit HUZZAH32-ESP32 Feather Board connected to a battery I wrote code to do the following.
1. ESP32 connects to WiFi network.
2. Once connected it stays in a loop and measures RSSI and displays the results to a LCD graph.
The idea of the code is to be able to walk around and plot signal strength of the WiFi network. The issue that I am having is that sometimes the RSSI value does not change. It shows the same value for prolong periods of time. Sometimes the same value is shown for 10 to 30 seconds, other times the same value is displayed for 5 to 10 minutes?
When it does work correctly, I can see the rssi fluctuating slightly when the device is stationary. And also see it increase or decrease as I move the it closer or further away from the WiFi router.
Yesterday when I first tried it out, it was working great in that there was only a few times where the RSSI value remained constant (10 to 30 seconds). This morning when I turned the device on the behavior considerably changed in that the RSSI values are remaining constant for periods of 5 to 10 minutes. Then without changing anything the rssi starts updating as expected. This happens regardless if the device is on battery or connected to 5V via USB. Between yesterday and today no code was changed.
If I change the code to do a network scan and filter on SSID to get the RSSI it works flawlessly in that rssi value always changes as expected. It seems like when the rssi value does freeze (i.e. does not change) the value shown is whatever the last value was right before the freeze. Note, I did verify through the use of PING that when the RSSI freezes the ESP32 is still connected to the network.
Questions,
1. Is there a setting in the ESP that might be causing this issue?
2. Is there a way to reset the ESP32?
3. Could it be related to my WiFi router settings?
4. Did something go wrong with the device?
I have tried to find info on how the actual RSSI measurement works inside the ESP32 but no details are found. Any help or guidance on solving this issue would be appreciated.
Thanks
Basic code that I am using is listed below....
//------------------------------------------------------------------------------------
#include <WiFi.h>
const char* ssid = "XXXXXX";
const char* password = "XXXXXXX";
void setup() {
Serial.begin(115200);
}
void loop() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Establishing connection to WiFi..");
}
Serial.println("Connected to network");
Serial.println(WiFi.localIP());
for (int i = 0; i <= 10000; i++){
long rssi = WiFi.RSSI();
Serial.print("rssi = ");
Serial.println(rssi);
delay(500);
}
WiFi.disconnect(true);
}
1. ESP32 connects to WiFi network.
2. Once connected it stays in a loop and measures RSSI and displays the results to a LCD graph.
The idea of the code is to be able to walk around and plot signal strength of the WiFi network. The issue that I am having is that sometimes the RSSI value does not change. It shows the same value for prolong periods of time. Sometimes the same value is shown for 10 to 30 seconds, other times the same value is displayed for 5 to 10 minutes?
When it does work correctly, I can see the rssi fluctuating slightly when the device is stationary. And also see it increase or decrease as I move the it closer or further away from the WiFi router.
Yesterday when I first tried it out, it was working great in that there was only a few times where the RSSI value remained constant (10 to 30 seconds). This morning when I turned the device on the behavior considerably changed in that the RSSI values are remaining constant for periods of 5 to 10 minutes. Then without changing anything the rssi starts updating as expected. This happens regardless if the device is on battery or connected to 5V via USB. Between yesterday and today no code was changed.
If I change the code to do a network scan and filter on SSID to get the RSSI it works flawlessly in that rssi value always changes as expected. It seems like when the rssi value does freeze (i.e. does not change) the value shown is whatever the last value was right before the freeze. Note, I did verify through the use of PING that when the RSSI freezes the ESP32 is still connected to the network.
Questions,
1. Is there a setting in the ESP that might be causing this issue?
2. Is there a way to reset the ESP32?
3. Could it be related to my WiFi router settings?
4. Did something go wrong with the device?
I have tried to find info on how the actual RSSI measurement works inside the ESP32 but no details are found. Any help or guidance on solving this issue would be appreciated.
Thanks
Basic code that I am using is listed below....
//------------------------------------------------------------------------------------
#include <WiFi.h>
const char* ssid = "XXXXXX";
const char* password = "XXXXXXX";
void setup() {
Serial.begin(115200);
}
void loop() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Establishing connection to WiFi..");
}
Serial.println("Connected to network");
Serial.println(WiFi.localIP());
for (int i = 0; i <= 10000; i++){
long rssi = WiFi.RSSI();
Serial.print("rssi = ");
Serial.println(rssi);
delay(500);
}
WiFi.disconnect(true);
}