Dropped Packets AP and Station mode
Posted: Wed Aug 21, 2019 10:34 pm
I'm working on a project intended to eventually be given as a gift to friends and family. It uses wifi and so the idea is to have it start in soft AP mode and to host a simple HTTP server to serve up a basic web page where they can enter their wifi credentials. After entering their wifi credentials it would connect to their wifi and return the newly acquired ip address from the router back to the client so that the client can get redirected to the new address and the user can wrap up the setup process.
I have all of this working. However, where I run in to problems is that once the wifi starts the connection process to the router, I start to see tons of dropped packets on the soft AP ip. The connection normally stays open long enough for the new ip address to get sent, but not always. I would like this to be fool proof since I plan on giving it to people.
This is what I run in the setup:
When my modest HTTP server receives an HTTP POST with the wifi credentials I run the following which is exactly when I start to see dropped packets:
I have read that the channel can cause issues if its heavily used in your area. I have it set on channel 8 because it looked like it had the least amount of overlap from my scans.
As I mentioned, this works probably 85% of the time if not more, but I would really like to figure out why I get so many dropped packets once both the soft ap and the station are active.
I have all of this working. However, where I run in to problems is that once the wifi starts the connection process to the router, I start to see tons of dropped packets on the soft AP ip. The connection normally stays open long enough for the new ip address to get sent, but not always. I would like this to be fool proof since I plan on giving it to people.
This is what I run in the setup:
Code: Select all
WiFi.mode(WIFI_AP_STA);
boolean result = WiFi.softAP("motion-sensor", "password", 8);
if(result == true) {
Serial.println("Ready");
} else {
Serial.println("Starting soft-AP Failed! Rebooting...");
delay(5000);
ESP.restart();
}
When my modest HTTP server receives an HTTP POST with the wifi credentials I run the following which is exactly when I start to see dropped packets:
Code: Select all
WiFi.begin(ssid.c_str(), password.c_str());
I have read that the channel can cause issues if its heavily used in your area. I have it set on channel 8 because it looked like it had the least amount of overlap from my scans.
As I mentioned, this works probably 85% of the time if not more, but I would really like to figure out why I get so many dropped packets once both the soft ap and the station are active.