The ESP8266 supports operating as a Wi-Fi station (station mode), an access point (softAP mode), and can even do both at the same time (softAP+station mode). However, there is one important detail that must be understood or else it will come back to bite you: the radio in the ESP8266 only supports one hardware channel at a time.
What does this mean? Well, 802.11b/g/n operating on 2.4GHz has 14 different channels that can be used (though, in North America, we can only use channels 1-11 due to regulations). The radio in the ESP8266 can only connect to one of those at a time.
This really only presents a problem when you run in softAP+station mode. Suppose that you start up the softAP on channel 6 and stations connect to it (i.e. maybe you’re using the End User Setup module of NodeMCU as a way to allow the user to set its station configuration). Then you configure the ESP’s Wi-Fi Station to connect to an access point on channel 1. What’s going to happen is that the station configuration will win, and the softAP will switch over to channel 1 also. This will drop the stations that had been previously connected to your softAP.
As mentioned above, the station mode configuration takes precedence. So, if the ESP’s Station is already connected to an access point on channel 1, then trying to start up the softAP on channel 6 will not work as planned (the softAP will start on channel 1, too). Usually, this is not a problem for your client stations, because they will do a channel scan to locate the softAP by SSID.
Finally, one of the trickier situations to troubleshoot is when the ESP8266 has a non-existent access point configured and is set to auto-reconnect (e.g., maybe it was previously connected to your work’s Wi-Fi network, and now the device is at your home). The ESP will continue to perform channel scans to locate that non-existent access point, resulting in the softAP channel changing, too. This usually presents itself as being difficult to connect to the softAP, or once connected, the client station may spontaneously disconnect, or communications may be slow or interrupted. The fix is to either clear out the station configuration to remove the non-existent access point, or to just disable the auto-reconnect for the station so that it does not keep trying.
Latest posts by Falafel Posts (see all)
- Matching Complex Query String Rewrite Rule in IIS - March 22, 2017
- Disable Content Filters in Sitefinity - March 8, 2017
- On Sitefinity Custom Widget Caching - February 22, 2017
- Dynamic Content Detail Widget Templates in Sitefinity - February 8, 2017
- Using Google Services in UWP C# Apps – Part 2 - February 7, 2017