[Experience Sharing] "2024 DigiKey Creative Competition" 3. ESPNOW single packet sending time test
[Copy link]
Preface
ESP-NOW (Espressif Now) is a fast, low-power wireless communication protocol developed by Espressif Systems, designed for Wi-Fi MCUs such as ESP8266 and ESP32. ESP-NOW allows data to be transferred directly between devices without having to connect through a traditional Wi-Fi network. This protocol is ideal for fast communication between Internet of Things (IoT) devices, especially in application scenarios that require low latency and high reliability.
1. Test Purpose
Since the underlying implementation of ESPNOW is unknown, we also don't know what the underlying process is when espnow sends data. In the process of using espnow, I found that the less interference there is in the on-site environment, the lower the average delay. However, the delay of a single packet is sometimes high and sometimes low. I want to know whether the data is sent immediately after executing the esp_now_send function.
2. Test methods
By recording the sending time before sending, and then recording the sending completion time in the callback function after the sending is completed, you can know how long it takes to send the data.
Next, in the callback function of sending completion, record the completion time and then output
3. Results
From the results, we can see that espnow is not something that can be sent whenever you want. Normally, the shortest time to send a 60-word packet is about 1300us, and sometimes some packets take about 3ms to send. When the interference is serious, it may even take more than ten ms to send. Currently, the broadcast mode is used to send data, which means that it can be sent without pairing and connecting devices, regardless of whether other devices have received the data. In this mode, you still cannot send whenever you want. Based on the abnormal length of the sending time, it is speculated that it is related to the interference of 2.4G signals such as wireless routers, mobile phones, etc. used in the home. Based on the actual packet loss of espnow in my previous personal evaluation, I personally think that espnow should have an anti-collision mechanism, that is, if there is a device still sending data on the current channel, the espnow device will delay sending until the channel is not occupied by other devices, and then send the data out.
|