:link_to_translation:`zh_CN:[中文]`
body {counter-reset: h2} h2 {counter-reset: h3} h2:before {counter-increment: h2; content: counter(h2) ". "} h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "} h2.nocount:before, h3.nocount:before, { content: ""; counter-increment: none }Test result:
- Test board: ESP32-DevKitC V4.
- Wi-Fi mode: station.
- PHY rate is 1 Mbps by default.
- Around 214 Kbps in opened environment.
- Around 555 Kbps in shielding box.
- If you require a higher rate, it's feasible to configure the rate through esp_wifi_config_espnow_rate.
- ESP-NOW is a connectionless communication protocol defined by Espressif.
- In ESP-NOW, application data is encapsulated in action frames from different vendors and then transmitted from one Wi-Fi device to another without a connection.
- ESP-NOW is ideal for smart lights, remote control devices, sensors, and other applications.
- Yes, but it should be noted that the channel of ESP-NOW must be the same as that of the connected AP.
You may use the esp_wifi_config_espnow_rate() function to configure the rate, such as esp_wifi_config_espnow_rate(WIFI_IF_STA, WIFI_ PHY_RATE_MCS0_LGI)
.
You can use broadcast packets and provide the destination addresses in the payload. The number of addresses would then not be affected by the limited number. You only need to configure the correct broadcast address.
This depends on the specific communication method:
- If unicast packets are used, up to 20 devices can be paired and controlled at the same time.
- If ESP-NOW encrypted mode is used, up to 6 devices can be paired and controlled at the same time.
- If broadcast packets are used, theoretically there is no limitation in the number of devices that can be controlled. You only need to configure the correct broadcast address and take care of the interference issue when too many devices are paired.
ESP-NOW interacts directly from device to device and does not require a router to forward data.
- The maximum length does not support configuration. ESP-NOW uses one vendor-specific element field of action frame to transmit ESP-NOW data, whose length field is only 1 byte (0xff = 255) as defined by IEEE 802.11. Thus, the maximum length of ESP-NOW data is limited to 250 bytes.
- Alternatively, you may try with API
esp_wifi_80211_tx()
to send and use sniffer mode to receive. This way could fulfill the need of working only base on Wi-Fi stack without involving TCP/IP stack.
- The device cannot switch channels after connecting to Wi-Fi. It can only transmit and receive data on the current Wi-Fi channel.
- After the device enters Modem-sleep mode, it cannot receive data from ESP-NOW.
- You can use the following methods to reduce power consumption:
- If you use ESP-IDF in versions earlier than v5.0, when the AP is not connected, you can configure the wake-up window size and interval using the esp_now_set_wake_window() and esp_wifi_set_connectionless_wake_interval() functions respectively to save power.
- If you use ESP-IDF v5.0 or the latest master version, the functions are different from the other versions. Whether the AP is connected or not, you can use the esp_now_set_wake_window() and esp_wifi_connectionless_module_set_wake_interval() functions to set the wake-up window size and interval, respectively.
- Note that the issue of window synchronization between the sending end and receiving end needs to be considered in the application layer design. In this way, the chip will wake up at every “interval” and work for a period of time equalling the value of "window size". Under this situation, you also need to configure CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y in sdkconfig.defaults.
In addition to wireless communication through ESP-NOW, is there any other better way to realize one-to-one and one-to-many communication?
One-to-one and one-to-many communication can also be realized by using SoftAP + Station. The master device applies Wi-Fi SoftAP mode to establish connections with multiple slave devices (Wi-Fi Station) at the same time.
Yes, please refer to ESP-NOW documentation.
Are there any special procedures required if I intend to use ESP-NOW for commercial purposes? Could you provide technical documentation on ESP-NOW? To evaluate the quality of wireless communication, I would like to know relevant information about parameters including CSMA/CA, modulation method, and bit rate.
- The application for ESP-NOW does not require any special procedures.
- For technical documentation, please refer to ESP-NOW User Guide. You can use examples in ESP-NOW SDK for testing.
- The default bit rate of ESP-NOW is 1 Mbps.
I tested the application esp-idf/examples/wifi/espnow using ESP32. Does it only support connecting to 7 encrypted devices at the maximum?
- In the esp-now application, ESP32 supports connecting to no more than 17 encrypted devices, and the default value is 7. For more details, please refer to "Add Paired Devices".
- If you want to change the number of paired encryption devices, set
CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM
in WiFi component configuration menu.
- You can use wifi_pkt_rx_ctrl_t to get the corresponding RSSI.
- You can achieve it by modifying the espnow_frame_head_t g_initiator_frame() function with .forward_ttl and .forward_rssi parameters. For corresponding parameter descriptions, please see esp-now/src/espnow/include/espnow.h.