ESP32 not connected to WiFi

aruffato
Posts: 4
Joined: Mon Feb 27, 2023 3:25 am

ESP32 not connected to WiFi

Postby aruffato » Mon Feb 27, 2023 4:53 am

Hi, my name is Adrian
I'm spanish spoken, and new with programs ESP32 from ARDUINO IDE 2.0.3
I have bought FOUR ESP32 module >> One of them has ->
* Chip is ESP32-D0WD-V3 (revision 3)
* Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
* Crystal is 40MHz
* MAC: 40:22:d8:f0:ee:bc
At first, each of the module could connect to my WiFi, then suddenly, one each other module DO NOT CONNECT anymore and I got the same lines in the compiler >>>

01:25:47.950 -> Wait for WiFi...
01:25:50.983 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
01:25:51.015 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 2 - AUTH_EXPIRE
01:25:51.015 -> [WiFi-event] event: 5
01:25:51.015 -> Disconnected from WiFi access point
01:25:51.015 -> WiFi lost connection. Reason: 2
01:25:54.052 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
01:25:54.052 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 2 - AUTH_EXPIRE
01:25:54.052 -> [WiFi-event] event: 5

At the same moment, an ESP8266 WiFi module, could connect without problem, with the same SSID and PASSWORD

The same thing with EACH of four ESP32 modules ???
Have anyone a guide to discover why it does not connect anymore ????

Always using ARDUINO IDE 2.0.3, because I become to make programs, best regards

Adrian

noweare
Posts: 72
Joined: Tue Jul 02, 2019 11:35 am

Re: ESP32 not connected to WiFi

Postby noweare » Mon Feb 27, 2023 4:44 pm

Are you using an example program to connect? Does your esp use an built-in antenna, it is etched in the pcb of the esp32.
You can try erasing flash completely and then reflash the chip with your code.

aruffato
Posts: 4
Joined: Mon Feb 27, 2023 3:25 am

Re: ESP32 not connected to WiFi

Postby aruffato » Mon Feb 27, 2023 9:05 pm

Good afternoon,
I'll send your doubts in order ->

1) Are you using an example program to connect?
Yes all the examples in Folder WiFi, and in my proper development that WORKS OK, for a few days and then COLLAPSE.
WifiClientEvents, WifiAccessPoint, WifiClient, WifiClientBasic, WifiClientStaticIP, WifiMulti.ino ...

2) Does your esp use an built-in antenna, it is etched in the pcb of the esp32.
Yes it is.
Perhaps you think is poor signal, but it doesn't. As I previous comment, beside the ESP32 module, reside an ESP8266 NodeMCU LUA V3.0 with the same sketch (obviusly adapted for ESP8266), and this ESP8266 connect with my WiFI without problem.
Same SSID, same password

3) You can try erasing flash completely and then reflash the chip with your code.
Yes, several times. And keeping information in a lot of forum (Arduino, ESP32, ESPHome, ...) I ADD delay(2000); time between "SCAN" and "Connect" with NO RESULT.

4) This is the link of web page in aliexpress.com ->https://es.aliexpress.com/item/1005001621773806.html

5) The connection to my PC is with cable USB Type-C, an it is a STRONG cable

6) I have NO probblem with the connection PORT, it's is recognize when I plug IN the module

7) Are there a simple sketch to RUN ?
Please SEE the code attach below !!!!

8) Curiously the Blink.ino works, SCAN Wifi Works, Timer interrupts every 60 [secs] displaying the date and time, that I set with -> #include <ESP32Time.h>
ESP32Time rtc;

"rtc clocks" WORKS !!!!!!! All of them in separate sketches, but with these sentences inside a New Sketch -> With Or WithOut the delay's (it is does not affect, I think so ...)

Code: Select all

#include "WiFi.h"

#define WIFI_NETWORK "network"
#define WIFI_PASSWORD "password"
#define WIFI_TIMEOUT_MS 40000

void ConnectToWiFi(){
  int iCOUNT=0;
    Serial.println("Connecting to WiFi");
    WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);

    unsigned long startAttemptTime = millis();

    while(WiFi.status() != WL_CONNECTED && millis() - startAttemptTime < WIFI_TIMEOUT_MS){
      if ((iCOUNT%5) == 0){
        Serial.print(iCOUNT);
        } else {
          Serial.print(F("."));
      }
      iCOUNT++;
      delay(1000);
    }
    Serial.println(F(""));
    if(WiFi.status() != WL_CONNECTED) {
      Serial.println(F(" Failed!!!"));
      } else {
          Serial.print(F("Connected!!!"));
          Serial.println(WiFi.localIP());
    }
}

void setup(){
    Serial.begin(115200);
    //delay(1000);
    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    //delay(5000);
    WiFi.disconnect();
    //delay(2000);
    Serial.println("Setup done");
    delay(100);
    scanWiFi();
    //delay(5000);
    ConnectToWiFi();
}

void loop(){
}
9) Ever appear (in compile with Verbose mode), the sentences ->
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 2 - AUTH_EXPIRE
over and over again !!!!!!!!

10) If you Comment the line ConnectToWifi, and put something inside loop(), it's work OK but NOT CONNECTED, and this is the reaso why I bougth ESP32 module, because the facility to connect to my Wifi and send the data of multiple sensors to MySQL.
This point with module NodeMCU LUA v3.0 have NO problems.

I hope I clarify your doubts, and could find a solution to "my problem", thanks so much for your time ...

Best regards,

Adrian

Who is online

Users browsing this forum: No registered users and 85 guests