3
votes

I am using an ESP8266 for a project which requires the ESP to establish a connection to the Access Point , with as less delay as possible, but as of now it takes a minimum of 4-5 mins for establishing the connection which is too much delay. I have tried to set a static ip, gateway, subnet and DNS by passing them as parameter to WiFi.config() function, still no success. Would someone help me regarding this issue ?

2
A station connect on the ESP8266 should take at max 2.5 seconds. Something is horribly wrong on either your ESP8266 hardware, the software (though if you're using the arduino framework and the WifI class I don't think that's the case) or your network environment. Does the problem appear with all hotspots? You have tried connecting to, say, a hotspot from your smartphone?Maximilian Gerhardt
Thankyou for your reply, I tested it earlier with my phone's hotspot and an ad-hoc hotspot from my laptop which didn't work, but now I connected with a hotspot from my mom's phone, it connected with a delay of 500milliseconds .Pratik Kumar
Weak signal maybe? Do a SSID scan with github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/… and tell us the RSSI value. If the signal is good and you still can't connect, it must be something with the settings on the router.Maximilian Gerhardt
RSSI value lies between -49 to -51 , mostly -50Pratik Kumar
Ensure you use 2.4Ghz Hotspot. 5Ghz not supported.pds

2 Answers

2
votes

I have seen lengthy delays on ESP8266 WiFi connection if the WiFi is persisting its configuration to the flash memory. Anywhere from a few seconds to a minute or so. Try to call WiFi.persistent( false ) before you call WiFi.mode() and WiFi.begin().

At the very least, that will help you narrow down the cause of the problem.

0
votes

Ensure access point frequency is 2.4Ghz (not 5Ghz). This will cause prolonged connection time (never connecting).

"The ESP8266 is not designed for 5 GHz." Source

NodeMCU V1.0 (as pictured) uses an ESP8266's (ESP-12E) chip, Antenna is configured for 2.4 Ghz only. enter image description here