Di Mini (ESP8266) Wi-Fi Status Codes

The ESP8266 using the Arduino Core reports Wi-Fi status with the WiFi.status() function. The D1M-WX1 Weather Station attempts to connect to Wi-Fi every 250 milliseconds until the “Connect” status is found. If this does not happen after 15 attempts, it prints the status to the Serial Monitor.

Normally, the LED on the ESP8266 flashes five or six times until the connection is made. The LED will be dark during the six or seven seconds it takes to post the weather data on the Internet.  It will flash three times before the station goes to sleep for 10 minutes. The code is in the logonToRouter() function of the weather station sketches.

If a Wi-Fi connection can not be made, the LED will flash 16 times and the exit code will appear on the Serial Monitor. The status codes are:

ESP8266 WiFi Result Codes

CodeMeaningDescription
1No SSID AvailableUnit is too far from the Wi-Fi access point, the SSID and/or password is incorrect, or the SSID is for a 5GHz-band access point.
2Scan CompletedScanning for available networks is completed.
3ConnectedSuccess
4Connection FailedThe opposite of success.
5Connection Lost
6Disconnected
255No ShieldUsed for compatibility with the Arduino WiFi Shield - not relevant to the ESP8266.

Reference: https://www.arduino.cc/en/Reference/WiFiStatus

Leave a Reply