[GH-ISSUE #1396] ESP32 wont connect to WiFi #1197

Open
opened 2026-02-28 01:28:57 +03:00 by kerem · 10 comments
Owner

Originally created by @sommerper on GitHub (Apr 16, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1396

Basic Infos

Hardware

WiFimanager Branch/Release: v2.0.10-beta #9182622

Esp32:

Hardware: ESP Wroom 32

Description

After connecting to the AP created by the ESP32 I select my network and enter the password. WiFiManager tries to connect 4 times and fails.

Settings in IDE

Platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
upload_speed = 921600
monitor_speed = 115200
lib_deps =
  https://github.com/tzapu/WiFiManager.git#9182622
#BEGIN
#include <Arduino.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

void setup()
{
  WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
  // it is a good practice to make sure your code sets wifi mode how you want it.

  // put your setup code here, to run once:
  Serial.begin(115200);

  // WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wm;

  // reset settings - wipe stored credentials for testing
  // these are stored by the esp library
  wm.resetSettings();

  wm.setHostname("Sensor2");
  wm.setConnectRetries(4);

  // Automatically connect using saved credentials,
  // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
  // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
  // then goes into a blocking loop awaiting configuration and will return success result

  bool res;
  // res = wm.autoConnect(); // auto generated AP name from chipid
  // res = wm.autoConnect("AutoConnectAP"); // anonymous ap
  res = wm.autoConnect("ap", "12345678"); // password protected ap

  if (!res)
  {
    Serial.println("Failed to connect");
    // ESP.restart();
  }
  else
  {
    // if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");
  }
}

void loop()
{
  Serial.println("In loop");
  delay(5000);
  // put your main code here, to run repeatedly:
}

Debug Messages

======================== [SUCCESS] Took 21.00 seconds ========================
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
�*wm:[1] resetSettings 
*wm:[1] SETTINGS ERASED 
*wm:[1] AutoConnect 
*wm:[1] No Credentials are Saved, skipping connect 
*wm:[2] Starting Config Portal 
*wm:[2] AccessPoint set password is VALID 
*wm:[2] Disabling STA 
*wm:[2] Enabling AP 
*wm:[1] StartAP with SSID:  ap
*wm:[1] AP IP address: 192.168.4.1
*wm:[2] setting softAP Hostname: Sensor2
*wm:[1] Starting Web Portal 
*wm:[2] HTTP server started 
*wm:[2] Config Portal Running, blocking, waiting for clients... 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
*wm:[2] <- HTTP Root 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
*wm:[2] <- HTTP Wifi 
*wm:[2] WiFi Scan SYNC started 
*wm:[2] WiFi Scan completed in 5515 ms
*wm:[1] 11 networks found
*wm:[2] AP:  -50 wlan4142412
*wm:[2] AP:  -51 ********************
*wm:[2] AP:  -59 ********************
*wm:[2] AP:  -69 ********************
*wm:[2] AP:  -77 ********************
*wm:[2] AP:  -77 ********************
*wm:[2] AP:  -83 ********************
*wm:[2] AP:  -84 ********************
*wm:[2] AP:  -86 ********************
*wm:[2] AP:  -91 ********************
*wm:[2] AP:  -95 *********************
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
*wm:[2] NUM CLIENTS:  1
*wm:[2] <- HTTP WiFi save  
*wm:[2] processing save 
*wm:[2] Connecting as wifi client... 
*wm:[2] setSTAConfig static ip not set, skipping 
*wm:[1] Connect Wifi, ATTEMPT # 1 of 4
*wm:[1] Connecting to NEW AP: wlan4142412
*wm:[1] connectTimeout not set, ESP waitForConnectResult... 
*wm:[2] Connection result: WL_DISCONNECTED
*wm:[1] Connect Wifi, ATTEMPT # 2 of 4
*wm:[1] Connecting to NEW AP: wlan4142412
*wm:[1] connectTimeout not set, ESP waitForConnectResult... 
*wm:[2] Connection result: WL_DISCONNECTED
*wm:[1] Connect Wifi, ATTEMPT # 3 of 4
*wm:[1] Connecting to NEW AP: wlan4142412
*wm:[1] connectTimeout not set, ESP waitForConnectResult... 
*wm:[2] Connection result: WL_DISCONNECTED
*wm:[1] Connect Wifi, ATTEMPT # 4 of 4
*wm:[1] Connecting to NEW AP: wlan4142412
*wm:[1] connectTimeout not set, ESP waitForConnectResult... 
*wm:[2] Connection result: WL_DISCONNECTED
*wm:[0] [ERROR] Connect to new AP Failed 
*wm:[2] Processing - Disabling STA 
*wm:[2] NUM CLIENTS:  1
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
[E][WebServer.cpp:633] _handleRequest(): request handler not found
*wm:[2] <- Request redirected to captive portal 
*wm:[2] NUM CLIENTS:  1
Originally created by @sommerper on GitHub (Apr 16, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1396 ### Basic Infos #### Hardware WiFimanager Branch/Release: v2.0.10-beta #9182622 Esp32: Hardware: ESP Wroom 32 ### Description After connecting to the AP created by the ESP32 I select my network and enter the password. WiFiManager tries to connect 4 times and fails. ### Settings in IDE Platformio.ini ``` [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino upload_speed = 921600 monitor_speed = 115200 lib_deps = https://github.com/tzapu/WiFiManager.git#9182622 ``` ```cpp #BEGIN #include <Arduino.h> #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager void setup() { WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // it is a good practice to make sure your code sets wifi mode how you want it. // put your setup code here, to run once: Serial.begin(115200); // WiFiManager, Local intialization. Once its business is done, there is no need to keep it around WiFiManager wm; // reset settings - wipe stored credentials for testing // these are stored by the esp library wm.resetSettings(); wm.setHostname("Sensor2"); wm.setConnectRetries(4); // Automatically connect using saved credentials, // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"), // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect()) // then goes into a blocking loop awaiting configuration and will return success result bool res; // res = wm.autoConnect(); // auto generated AP name from chipid // res = wm.autoConnect("AutoConnectAP"); // anonymous ap res = wm.autoConnect("ap", "12345678"); // password protected ap if (!res) { Serial.println("Failed to connect"); // ESP.restart(); } else { // if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } } void loop() { Serial.println("In loop"); delay(5000); // put your main code here, to run repeatedly: } ``` ### Debug Messages ``` ======================== [SUCCESS] Took 21.00 seconds ======================== --- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time --- More details at https://bit.ly/pio-monitor-filters --- Miniterm on /dev/ttyUSB0 115200,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- �*wm:[1] resetSettings *wm:[1] SETTINGS ERASED *wm:[1] AutoConnect *wm:[1] No Credentials are Saved, skipping connect *wm:[2] Starting Config Portal *wm:[2] AccessPoint set password is VALID *wm:[2] Disabling STA *wm:[2] Enabling AP *wm:[1] StartAP with SSID: ap *wm:[1] AP IP address: 192.168.4.1 *wm:[2] setting softAP Hostname: Sensor2 *wm:[1] Starting Web Portal *wm:[2] HTTP server started *wm:[2] Config Portal Running, blocking, waiting for clients... [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal *wm:[2] <- HTTP Root [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal *wm:[2] <- HTTP Wifi *wm:[2] WiFi Scan SYNC started *wm:[2] WiFi Scan completed in 5515 ms *wm:[1] 11 networks found *wm:[2] AP: -50 wlan4142412 *wm:[2] AP: -51 ******************** *wm:[2] AP: -59 ******************** *wm:[2] AP: -69 ******************** *wm:[2] AP: -77 ******************** *wm:[2] AP: -77 ******************** *wm:[2] AP: -83 ******************** *wm:[2] AP: -84 ******************** *wm:[2] AP: -86 ******************** *wm:[2] AP: -91 ******************** *wm:[2] AP: -95 ********************* [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal *wm:[2] NUM CLIENTS: 1 *wm:[2] <- HTTP WiFi save *wm:[2] processing save *wm:[2] Connecting as wifi client... *wm:[2] setSTAConfig static ip not set, skipping *wm:[1] Connect Wifi, ATTEMPT # 1 of 4 *wm:[1] Connecting to NEW AP: wlan4142412 *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_DISCONNECTED *wm:[1] Connect Wifi, ATTEMPT # 2 of 4 *wm:[1] Connecting to NEW AP: wlan4142412 *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_DISCONNECTED *wm:[1] Connect Wifi, ATTEMPT # 3 of 4 *wm:[1] Connecting to NEW AP: wlan4142412 *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_DISCONNECTED *wm:[1] Connect Wifi, ATTEMPT # 4 of 4 *wm:[1] Connecting to NEW AP: wlan4142412 *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_DISCONNECTED *wm:[0] [ERROR] Connect to new AP Failed *wm:[2] Processing - Disabling STA *wm:[2] NUM CLIENTS: 1 [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal [E][WebServer.cpp:633] _handleRequest(): request handler not found *wm:[2] <- Request redirected to captive portal *wm:[2] NUM CLIENTS: 1 ```
Author
Owner

@tablatronix commented on GitHub (Apr 24, 2022):

how is that the same issue?

<!-- gh-comment-id:1107833197 --> @tablatronix commented on GitHub (Apr 24, 2022): how is that the same issue?
Author
Owner

@tablatronix commented on GitHub (Apr 24, 2022):

@sommerper change this to true and see if it connects, also enable esp debugging this sounds like a known esp issue

https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.h#L487

<!-- gh-comment-id:1107833404 --> @tablatronix commented on GitHub (Apr 24, 2022): @sommerper change this to true and see if it connects, also enable esp debugging this sounds like a known esp issue https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.h#L487
Author
Owner

@MythicalForce commented on GitHub (Apr 24, 2022):

how is that the same issue?

it was the wrong issue xD

<!-- gh-comment-id:1107839551 --> @MythicalForce commented on GitHub (Apr 24, 2022): > how is that the same issue? it was the wrong issue xD
Author
Owner

@sommerper commented on GitHub (Apr 24, 2022):

@tablatronix I've been pulling my hair out for several days now. Tried 4 different routers and set up an openwrt network on my pi to see if it was the network somehow.

Turns out something is interfering with the esp32 wifi when connected to an external power source.

If I'm powering the esp32 with USB only there is no problem.
If I'm powering the esp32 with USB and a 5V laboratory power source it doesn't work.

I can't pinpoint what it is but at this point I'm pretty sure it has nothing to do with this library and I'm sorry for taking your time.
If I find the reason for this error I will update the thread but I think we can close the issue.

Thanks! (for an awesome library)

<!-- gh-comment-id:1107888853 --> @sommerper commented on GitHub (Apr 24, 2022): @tablatronix I've been pulling my hair out for several days now. Tried 4 different routers and set up an openwrt network on my pi to see if it was the network somehow. Turns out something is interfering with the esp32 wifi when connected to an external power source. If I'm powering the esp32 with USB only there is no problem. If I'm powering the esp32 with USB _and_ a 5V laboratory power source it doesn't work. I can't pinpoint what it is but at this point I'm pretty sure it has nothing to do with this library and I'm sorry for taking your time. If I find the reason for this error I will update the thread but I think we can close the issue. Thanks! (for an awesome library)
Author
Owner

@tablatronix commented on GitHub (Apr 24, 2022):

Interesting, I know analog read breaks wifi makes me wonder if it has something to do with wifi calibration and vref

<!-- gh-comment-id:1107922707 --> @tablatronix commented on GitHub (Apr 24, 2022): Interesting, I know analog read breaks wifi makes me wonder if it has something to do with wifi calibration and vref
Author
Owner

@OTHMANERAH commented on GitHub (Jun 6, 2022):

HELP MEE PLEASE?????

Arduino : 1.8.9 (Windows 10), Carte : "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

c:\temp\arduino_modified_sketch_122643\sketch_jun06a.ino: In function 'void setup()':

sketch_jun06a:39:10: error: 'class WiFiClass' has no member named 'softAP'

 WiFi.softAP(ssid, password);

      ^

sketch_jun06a:41:23: error: 'class WiFiClass' has no member named 'softAPIP'

IPAddress IP = WiFi.softAPIP();

                   ^

exit status 1
'class WiFiClass' has no member named 'softAP'

Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.

<!-- gh-comment-id:1147828634 --> @OTHMANERAH commented on GitHub (Jun 6, 2022): HELP MEE PLEASE????? Arduino : 1.8.9 (Windows 10), Carte : "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200" c:\temp\arduino_modified_sketch_122643\sketch_jun06a.ino: In function 'void setup()': sketch_jun06a:39:10: error: 'class WiFiClass' has no member named 'softAP' WiFi.softAP(ssid, password); ^ sketch_jun06a:41:23: error: 'class WiFiClass' has no member named 'softAPIP' IPAddress IP = WiFi.softAPIP(); ^ exit status 1 'class WiFiClass' has no member named 'softAP' Ce rapport pourrait être plus détaillé avec l'option "Afficher les résultats détaillés de la compilation" activée dans Fichier -> Préférences.
Author
Owner

@tablatronix commented on GitHub (Jun 17, 2022):

suspected #1067

<!-- gh-comment-id:1159062623 --> @tablatronix commented on GitHub (Jun 17, 2022): suspected #1067
Author
Owner

@tablatronix commented on GitHub (Jun 17, 2022):

What versions you using ?
'class WiFiClass' has no member named 'softAP'

<!-- gh-comment-id:1159062985 --> @tablatronix commented on GitHub (Jun 17, 2022): What versions you using ? 'class WiFiClass' has no member named 'softAP'
Author
Owner

@pa0o commented on GitHub (Feb 28, 2023):

Wifimanager can not connect to Wlan same here.
Using ESP32 Wroom 30 pin
both of them will not connect with Wlan saved credetial as the monitor text below shows

The same sketch did work with ESP8266 and an othe ESP32 wroom 38pin type
I have tried al i could think of and on a friends PC with his IDE old IDE 1.8x or new 2.04
no clue yet
awaiting an other mini ESP32 and hope it connects

serial monitor shows:

*wm:[2] NUM CLIENTS: 1
*wm:[2] <- Request redirected to captive portal
*wm:[2] NUM CLIENTS: 1
Now listening at IP 0.0.0.0, UDP port 4210

*wm:[1] AutoConnect
*wm:[2] ESP32 event handler enabled
*wm:[2] Connecting as wifi client...
*wm:[2] setSTAConfig static ip not set, skipping
*wm:[1] Connecting to SAVED AP: Eminent
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
*wm:[2] [EVENT] WIFI_REASON: 2
*wm:[2] [EVENT] WIFI_REASON: 2
*wm:[2] [EVENT] WIFI_REASON: 2
*wm:[2] Connection result: WL_DISCONNECTED
*wm:[1] AutoConnect: FAILED
*wm:[2] Starting Config Portal

<!-- gh-comment-id:1448570725 --> @pa0o commented on GitHub (Feb 28, 2023): Wifimanager can not connect to Wlan same here. Using ESP32 Wroom 30 pin both of them will not connect with Wlan saved credetial as the monitor text below shows The same sketch did work with ESP8266 and an othe ESP32 wroom 38pin type I have tried al i could think of and on a friends PC with his IDE old IDE 1.8x or new 2.04 no clue yet awaiting an other mini ESP32 and hope it connects serial monitor shows: *wm:[2] NUM CLIENTS: 1 *wm:[2] <- Request redirected to captive portal *wm:[2] NUM CLIENTS: 1 Now listening at IP 0.0.0.0, UDP port 4210 *wm:[1] AutoConnect *wm:[2] ESP32 event handler enabled *wm:[2] Connecting as wifi client... *wm:[2] setSTAConfig static ip not set, skipping *wm:[1] Connecting to SAVED AP: Eminent *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] [EVENT] WIFI_REASON: 2 *wm:[2] [EVENT] WIFI_REASON: 2 *wm:[2] [EVENT] WIFI_REASON: 2 *wm:[2] Connection result: WL_DISCONNECTED *wm:[1] AutoConnect: FAILED *wm:[2] Starting Config Portal
Author
Owner

@pa0o commented on GitHub (Feb 28, 2023):

connectTimeout not set that is the complain... could that be our common issue?
I did not have to set anything extra at WifiManager
but only manager autoconnect("ESP32_AP , "password" )

question how to set this "connectTimeout ?
is it Wifimanager.set connecttimeout=5 ore anything like that?
where are those hidden pameters documented?

<!-- gh-comment-id:1448741941 --> @pa0o commented on GitHub (Feb 28, 2023): connectTimeout not set that is the complain... could that be our common issue? I did not have to set anything extra at WifiManager but only manager autoconnect("ESP32_AP , "password" ) question how to set this "connectTimeout ? is it Wifimanager.set connecttimeout=5 ore anything like that? where are those hidden pameters documented?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1197
No description provided.