Though components like bandwidth, energy utilization, and the variety of (kilo)meters attain are necessary issues with wi-fi communication for microcontrollers, latency ought to be one other necessary issue to concentrate to. That is very true for initiatives like controllers the place round-trip latency and immediate response to an enter are important, however the place do you discover the latency quantity in datasheets? That is the place [Michael Orenstein] and [Scott] over at Electrical UI discovered a scarcity of information, particularly when taking software program stacks into consideration. In different phrases, it was time to do some critical benchmarking.
The query to be answered right here was particularly how briskly a one-way wi-fi person interplay will be throughout three ranges of payload sizes (12, 128, and 1024 bytes). The efficient latency is measured from when the enter is supplied on the transmitter, and the receiver has processed it and triggered the related output pin. The interior latency was additionally measured by having a spread of framework implementations reply to an exterior interrupt and drive a GPIO pin excessive. Even this check on an STM32F429 MCU already confirmed that, for instance, the STM32 low-level (LL) framework is far quicker than the stm32duino one.
After a bit extra checking for overhead inside the MCU itself with varied approaches, the precise exams had been carried out. The exams concerned modules for SiK, LoRa, nRF24, Bluetooth SPP (ESP32, HC-5), Bluetooth LE (Bluedroid & NimBLE on ESP32, in addition to the nRF52), ESP-NOW (ESP32), 802.15.4 (utilized by Zigbee, Matter, Thread, and so forth.) and naturally WiFi. The software program stack used had a big effect on a few of these, comparable to for BLE, however WiFi differed rather a lot on the ESP32, whether or not utilizing TCP or overlaying Websockets (about 10x slower).
What’s clear is that to get low latency with wi-fi communication you have to do extra than simply choose the proper know-how or module, but additionally perceive and work with your entire software program stack to tweak and optimize it for the most effective efficiency. For these within the uncooked information, firmware, and post-processing scripts, these will be discovered on GitHub.