Slow WiFi Connection Time in ESP-IDF vs Arduino IDE

manchancleta
Posts: 5
Joined: Thu Jan 02, 2025 4:20 pm

Slow WiFi Connection Time in ESP-IDF vs Arduino IDE

Postby manchancleta » Thu Mar 27, 2025 7:19 pm

Hello everyone,

I’ve migrated a project from the old Arduino IDE to ESP-IDF v5.1.5 with the Arduino component. I’ve noticed that the WiFi connection time using the WiFi.h library in the Arduino IDE version is around 200ms, whereas in the ESP-IDF version using the functions provided by the framework, it takes about 1200ms.

I’ve managed to reduce the connection time to that number by switching from WIFI_ALL_CHANNEL_SCAN to WIFI_FAST_SCAN, but I'm still not getting the connection time I need. I’m currently measuring the time from when I start the WiFi to when I get an IP address.

I understand that using a static IP might help reduce connection time, and I’ve tried it — it works. However, I’m not sure if this is a viable solution for every use case. Additionally, the Arduino IDE version doesn’t use a static IP, so I’m curious why the connection time is significantly lower there.

Since this is a battery-powered device, minimizing operation time is crucial while maintaining a reliable connection. The device acts as a data logger: it reads some data, connects to WiFi, sends the data via MQTT, disconnects, enters deep sleep, and then repeats after some time.

Is there anything else I can do to further reduce the WiFi connection time on the ESP-IDF version?

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: Slow WiFi Connection Time in ESP-IDF vs Arduino IDE

Postby ahsrabrifat » Fri Mar 28, 2025 8:35 am

Using a static IP reduces DHCP negotiation time.

Who is online

Users browsing this forum: ChatGPT-User and 2 guests