Flakey WiFi on ESP SoCs
For YEARS I’ve been having a WiFi issue. My Asus RT-AX3000 has some kind of compatibility problem with ESP WiFi chips. ESP8266, ESP32, DIY boards with custom software, commercial products. All would connect at first, but eventually loose IP connectivity. My IR blaster would dropout within 24 hours, my solar inverter once every 6 months or so. These tasmota power switches/monitors couldn’t last 30 minutes.
They would still appear on the router’s client list, their software would continue to think it was connected, but no TCP/ping connections would work. These ESP modules with their tiny antennas aren’t the most reliable things, but since this same issue was repeated on so many different chips in different circuits and firmwares it can’t be a fault with a particular design. I figured it was some kind of weird incompatibility with the Asus router.
My quest on the internet unearthed many remedies by changing a setting on the router. “No spaces in the SSID”, “disable IPv6”, “enable roaming mode”. All of these would appear to work since they involved restarting the access point and reset all connections. Thanks to these Tasmota plugs disconnecting so quickly, I could rule out these fixes in mere hours.
Salvation⌗
Turns out if the ESP module connects with 802.11g instead of 802.11n, it works fine. I still don’t know exactly what goes wrong when talking 11n, but now I can avoid it. Tasmota has a command to limit the mode to g: wifi 3
. My IR blaster needed reflashing so the WiFiESP8266WiFi
library can be told to use g. Just add WiFi.setPhyMode(WIFI_PHY_MODE_11G);
in your setup()
function.
I’m okay leaving it there, none of these devices need the higher bandwidth and I’m able to adjust this setting on all of my devices. An alternative might be some kind of watchdog to notice dropouts and force them to reconnect. Rather than restarting the entire WiFi network, you can run wl -i eth5 dissac MA:CA:DD:RE:SS
on the router to kick off the troublesome device and force it to reconnect again. A custom script on the router can constantly ping the ESP clients and boot them when needed. If you’re not running Merlin, you’ll need something else on the network to do the monitoring and use the webui to boot clients. Or just buy a different router at that point I guess.