ESP32 Development Log 01: WiFi Latency Testing

ESP32 Development Log 01: WiFi Latency Testing

The current project I am working is related to real-time control with ESP32 over wireless interface. Naturally I would like to use the WiFi onboard directly as it will not require an extra pair of radio transceivers for my host PC and the ESP32 microcontroller. However, due to the very nature of real-time control, wireless latency is key here.

Test setting

To get a grasp of ESP32 WiFi in terms of latency, I ran a simple ping test using the uping script from here. The test setting is very simple: send 2048 packets to the router IP address in order to measure the first-hop latency. I conducted the experiment in two different setting: 1) the ESP32 is in my room with a wall between it and the router and 2) the ESP32 is right next to the router.

Experiment results

ESP32 in room

Quantile 0.99 0.95 0.90 0.50
Latency Cutoff (ms) 114.1619 55.5873 42.5778 16.231

ESP32 next to router

Quantile 0.99 0.95 0.90 0.50
Latency cutoff (ms) 46.95 30.56 23.62 13.29


Clearly the ESP32 WiFi is not a good interface to communicate real-time control signals due to it long and varying latency. Even when the module is right next to the router, the latency still exceeds 10ms, resulting sampling rate of at most 100 Hz. However, upon further research, Espressif has its own WiFi protocol called ESP-NOW, which claimed to be low-latency. According to the post here, the ESP-NOW could achieve latency of ~3-5 ms, which is much better than the original WiFi. Still, further investigation is needed to determine whether this protocol is enough for real-time control application.

Subscribe to TheXYZLab Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.