WiFi Stopped connecting (ESP8266)

I am stumped. I have a few Wemos D1 Mini boards that were working on the local WiFi yesterday. Today none of them will connect. More puzzling is that I can flash Tasmota on them and they all connect to the WiFi, but none with the same sketch that was working yesterday. Just for grins, I flashed the same code to a NodeMCU, and got the same results.

Looking at the WiFi.status(), it starts with "6=WL_DISCONNECTED" for a few seconds, then "1=WL_NO_SSID_AVAIL".

Which is strange because

  1. Nothing here changed from yesterday, and
  2. The SSID is the same one that my PC, my Raspberry Pi's, and a dozen devices around the house use.

I tried compiling the sketch on another PC, and got the same results.

Yes, I logged on as admin and rebooted the router.
Now, it gets interesting.. I turned on a hotspot from my phone, and I can connect every time.

Again. Nothing changed from yesterday.

I am really at a loss to figure out what is wrong. Any tips would be appreciated.

Here is my WiFi setup code that hasn't changed.

void setup_wifi() {
  //Connect to WiFi network so we can reach the MQTT broker and publish messages to topics.
  delay(10);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(wifi_ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(wifi_ssid, wifi_password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.print(F("WiFi connected, "));
  Serial.print(F("IP address: "));
  Serial.println(WiFi.localIP());
}

your RF settings on the esp8266 flash are lost or wrong. it can happen if you erase the flash or if you upload a sketch or firmware build with different version of Espressif SDK

Juraj:
your RF settings on the esp8266 flash are lost or wrong. it can happen if you erase the flash or if you upload a sketch or firmware build with different version of Espressif SDK

What RF settings?

To troubleshoot this, I downloaded the IDE to a laptop that never had the Arduino IDE installed. I installed the ESP8266 boards and ran WiFiscan.ino from the ESP8266WiFi Examples in the IDE. The scan finds my AP: “Kaywinnet (-58)”. Next, I ran my WiFi_Test.ino that just connects to the WiFi. Instead of printing dots while waiting for the WiFi.status() to connect, I print WiFi.status(). Here I see a few “6 WL_DISCONNECTED” followed by “1 WL_NO_SSID_AVAIL” forever.

Here is my test sketch:

#include <ESP8266WiFi.h>                // Include the Wi-Fi library 


char ssid[] = "Kaywinnet";
const char* password = "806194xxxx";     // The password of the Wi-Fi network

void setup() {
  Serial.begin(115200);                  // Start the Serial communication to send messages to the computer
  delay(10);
  Serial.println('\n');

  WiFi.disconnect();
  delay(100);

  //Serial.setDebugOutput(true);            // Watch the connection attempts

  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(WiFi.status()); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());
  Serial.println();
  WiFi.printDiag(Serial);
  Serial.println();

}

void loop() { }

SteveMann:
What RF settings?

wifi radio power settings. the settings are stored in dedicated area on the flash. they are usually flashed as esp_init_data_setting.bin

blank.bin 0x1FB000
Initializes RF_CAL parameter area.

esp_init_data_default.bin 0x1FC000
Stores default RF parameter values, has to be downloaded into
flash at least once.
If the RF_CAL parameter area is initialized, this bin has to be
downloaded too.

my experience is that this setting are not always found by sketch or firmware. maybe because of wrong flash size information in the flashed application or because SDK versions incomapatibility

Juraj:
wifi radio power settings. the settings are stored in dedicated area on the flash. they are usually flashed as esp_init_data_setting.bin

my experience is that this setting are not always found by sketch or firmware. maybe because of wrong flash size information in the flashed application or because SDK versions incompatibility

I am a simple IDE user- where do I find these settings?

It also defies the fact that on Tuesday night, the sketches were loading to the Wemos and NodeMCU and connecting to the WiFi. The next morning, they weren't. Nothing was changed.

At some point I did try "erase all flash contents".

When I select the Lolin Wemos D1 mini or NodeMCU boards, the flash size is preselected for me.

Solved. (sort of). This is a working workaround.

I have determined that if I use ESP8266WiFi library Version 2.5.0 or later, all I get from WiFi.status() is WL_NO_SSID_AVAIL.

By reverting to ESP8266WiFi library Version 2.4.2, I can get a connection with the same sketch.

how do you upload the Tasmota firmware? (as IDE user)

sorry, I didn't know that Tasmota firmware is an Arduino sketch.

try to remove WiFi.disconnect()

SteveMann:
I am stumped. I have a few Wemos D1 Mini boards that were working on the local WiFi yesterday. Today none of them will connect. More puzzling is that I can flash Tasmota on them and they all connect to the WiFi, but none with the same sketch that was working yesterday. Just for grins, I flashed the same code to a NodeMCU, and got the same results.

Looking at the WiFi.status(), it starts with "6=WL_DISCONNECTED" for a few seconds, then "1=WL_NO_SSID_AVAIL".

Which is strange because

  1. Nothing here changed from yesterday, and
  2. The SSID is the same one that my PC, my Raspberry Pi's, and a dozen devices around the house use.

I tried compiling the sketch on another PC, and got the same results.

Yes, I logged on as admin and rebooted the router.
Now, it gets interesting.. I turned on a hotspot from my phone, and I can connect every time.

Again. Nothing changed from yesterday.

I am really at a loss to figure out what is wrong. Any tips would be appreciated.

Here is my WiFi setup code that hasn't changed.

void setup_wifi() {

//Connect to WiFi network so we can reach the MQTT broker and publish messages to topics.
 delay(10);
 Serial.println();
 Serial.print("Connecting to ");
 Serial.println(wifi_ssid);
 WiFi.mode(WIFI_STA);
 WiFi.begin(wifi_ssid, wifi_password);

while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
 }

Serial.println("");
 Serial.print(F("WiFi connected, "));
 Serial.print(F("IP address: "));
 Serial.println(WiFi.localIP());
}

SteveMann:
Solved. (sort of). This is a working workaround. https://192-168-0-1.us

I have determined that if I use ESP8266WiFi library Version 2.5.0 or later, all I get from WiFi.status() is WL_NO_SSID_AVAIL.

By reverting to ESP8266WiFi library Version 2.4.2, I can get a connection with the same sketch.

I'm looking for the same problem, solved.