Fast wifi station connect?

gatisp
Posts: 19
Joined: Thu May 26, 2016 11:49 am

Fast wifi station connect?

Postby gatisp » Mon Feb 20, 2017 8:17 pm

I am considering using ESP32 for battery powered wifi sensor device so the power consumption is important.

As I have observed after the board boots up and esp_wifi_connect() is called it usually takes about 1.1 seconds till SYSTEM_EVENT_STA_CONNECTED happens. After that everything seems to work quick - DHCP acquires address in about 0.1 seconds and so on.

So it seems that wifi lib does a full scan of all the channels to look for appropriate/best accesspoint.

This makes me want to have some kind of "hinted" esp_wifi_connect() mode where it first scans just the channel it was last connected to the AP. And if the AP is still there (on same channel) proceed to connecting without scanning the other channels.

Such feature would allow to dramatically cut down "modem active" time and give big power saving in an application that requires just a few packet exchanges.

Is there such a feature planned?
What is esp_wifi_clear_fast_connect() about?

I was not able to find an SDK roadmap here.
Thanks in advance,

gatisp
Posts: 19
Joined: Thu May 26, 2016 11:49 am

Re: Fast wifi station connect?

Postby gatisp » Wed Feb 22, 2017 10:00 pm

Ok, this is interesting.

Now I found that security takes a big part of connecting to AP.

I am running ESP32 at 240Mhz and best I got is 0.8 secs with WPA2 PSK till connected event on 2412 channel.

Without security I get connected to AP in 0.2 secs on 2412 channel.

Now the point about channel hint is still valid because when I set my AP to 2452 channel it takes ~1.4 seconds to connect without security. And ~2.0 seconds to connect with WPA2 PSK.

It is obvious that there is channel scanning overhead involved which I would like to avoid.

Not sure about the security overhead though. Because when security enabled connection time increases when I reduce cpu speed.
So at 80Mhz cpu speed it takes to 2.2secs to connect with security on 2412 channel.

Lets say 0.2sec per channel scan time.
0.8 - 0.2 = 0.6
2.2 - 0.2 = 2.0

2.0 / 0.6 roughly equals 240Mhz / 80Mhz.

Yeah. Probably since the modem takes more power than cpu (which is still on while doing security key calculation) it is better to run the cpu at 240Mhz.


In my application there is no way to avoid connecting to secured APs but I still would like to save more than 1 sec of modem on time while scanning to save power.

Please advise on how to improve wifi connection speed. Maybe there will be an option for a user provided scan-list? There already is the country setting, so it is kind of there already.

Thanks for info.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Fast wifi station connect?

Postby WiFive » Thu Feb 23, 2017 9:20 am

Yes it would be nice to provide an ordered channel list when doing station connect and the option to either connect to first matching ssid or complete the scan and choose highest rssi.

Also coming up here in a different way https://esp32.com/viewtopic.php?f=13&t=1192

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 221 guests