I have a ESP32 Huzzah board which I am using to post a oil tank level to the Thingspeak cloud. Right now I am posting the value to the cloud and then going to deep sleep for 30 seconds. I have two doubts:
- How frequently can i do this… meaning is there any interval criteria for logging on to a WiFi router ?
- Since I keep changing the location of the ESP32 module, I keep changing the WiFi router credentials . Does ESP32 support Multi router configuraion so that I can enter all possible WiFi credentials and let ESP32 to connect to the strongest of them ?
I’m sorry for the delay in our response.
Answering your questions …
1) I don’t think there’s any interval criteria.
2) I’ve never tried something like that, but I think it is possible.
You can add a snippet of code that searches for nearby wi-fi networks and prints the corresponding RSSI (Received Signal Strength Indicator).
The RSSI indicates the signal strength. There’s a method to get it with the ESP32. It returns a negative number.
The smaller the absolute value, the strongest the connection will be. So, I think this is a good method to search for the strongest network.
To do this, you can take a look at the example provided in the WiFi library called WiFiScan.
In your Arduino IDE, with the ESP32 board selected in the Board menu, go to File > Examples > WiFi > WiFiScan.
You will need to use the WiFi.scanNetworks() and WiFi.SSID() methods.
I hope this helps.
Then, let me know if this works for you or if you were looking for something else.