4

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 ?

Pratik Kumar
  • 2,211
  • 1
  • 17
  • 41
  • 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 May 23 '17 at 16:09
  • 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 May 23 '17 at 16:59
  • Weak signal maybe? Do a SSID scan with https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino 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 May 23 '17 at 17:03
  • RSSI value lies between -49 to -51 , mostly -50 – Pratik Kumar May 23 '17 at 17:29
  • Ensure you use 2.4Ghz Hotspot. 5Ghz not supported. – pds Jun 17 '21 at 12:59

3 Answers3

2

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.

Erik HB
  • 61
  • 4
  • When I tried with another hotspot, the connection was faster. But I'll try your solution with the previous hotspots which delayed the connection and let you know, if it helps.. – Pratik Kumar May 27 '17 at 06:03
0

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

pds
  • 2,242
  • 1
  • 22
  • 20
0

I think the library <ESP8266WiFi.h> you are using have problems, you can use older versions of it.

hung le
  • 1
  • 5