-->
Page 1 of 1

ESP8266 Wemos D1 mini wifi won't connect until new wifi CH

PostPosted: Mon Sep 26, 2022 12:19 pm
by fruitamadeusgollum
Hi there,

i have a Wemos D1 mini with ESP8266 on it and can connect to my wifi with the following code:

Code: Select all#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <string>

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

const char* SSID = "MYSSID";
const char* PSK = "MYPSK";

WiFiClientSecure espClient;         /* Secure client connection class, as opposed to WiFiClient */
PublicKey key(pubkey);

void setup_wifi() {
    WiFi.mode(WIFI_STA);
    WiFi.begin(SSID, PSK);
    Serial.println("Try to connect to wifi ");
    while (WiFi.status() != WL_CONNECTED) {
        delay(100);
    }   
    Serial.println(WiFi.localIP());
    espClient.setX509Time(timeClient.getEpochTime());
    Serial.write(timeClient.getEpochTime());
}

void setup() {
     
    // Serial Monitor
    Serial.begin(115200);
   
    // STATUS LED
    pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output

    // WIFI
    setup_wifi(); 
}

 
void loop()
{     
 
}


So far, everything is fine, it connects as expected and it. But when i turn off the power supply of the ESP and restart it a few hours (or a day) later then the only solution to get an wifi connection again is to go to my routers settings and change the wifi channel from 11 to 10 or something else below 11. After that channel change the ESP is properly connecting to wifi again. Without changing the wifi channel, there will no wifi connection be established.

Is this a known issue or can someone help me out?

Thanks and best regards from germany.