Introduction to ESP-NOW Scheme
Overview of ESP-NOW Scheme
The ESP-NOW protocol aims to provide direct communication between low-power, high-efficiency devices. It is suitable for IoT devices with ESP chips, which need to exchange data simply and quickly without connecting to traditional wireless networks (such as Wi-Fi routers).
The underlying dependency of the ESP-NOW application component is the connectionless communication protocol ESP-NOW defined by Espressif, which can directly, quickly, and low-power control smart devices without a router. It coexists with Wi-Fi and Bluetooth LE, supports multiple series of SoCs such as Espressif ESP8266, ESP32, ESP32-S, and ESP32-C. ESP-NOW is widely used in smart home appliances, remote control, and sensors. The features of ESP-NOW are as follows:
Quick response
Ultra-low power consumption
High compatibility
Long-distance communication
Multi-hop control
Common Application Scenarios of ESP-NOW
Espressif ESP-NOW wireless communication scheme: ESP-NOW is a wireless communication protocol based on the data link layer defined by Espressif, which can coexist with Wi-Fi and Bluetooth LE. It can not only achieve stable device connection and control but also serve as an independent auxiliary module to provide device provisioning, debugging, and firmware upgrade functions for the system.
ESP32-C2 button battery switch: The low-power Wi-Fi button battery wireless switch solution based on ESP32-C2 can solve problems such as wireless switch response lag and the need for a gateway in Bluetooth LE, Zigbee, etc. It can be used with ESP-NOW without a gateway, with a sensitive response speed. The ESP32-C2 button battery switch not only supports ultra-long standby but also is not limited by the battery volume in product form.
ESP32 Wi-Fi remote control: A Wi-Fi handheld remote control built based on ESP-NOW, supports instant control of smart devices equipped with ESP32, such as toy cars, small planes, robots, etc., can achieve millisecond-level control delay, and achieve a control distance farther than Bluetooth transmission.
Batch provisioning
Batch OTA
Product production testing
How to Enable ESP-NOW
ESP-NOW has a simple and clear enable process. Refer to the ESP-NOW get-started example to understand the enable process of ESP-NOW:
Call the espnow_storage_init() function to initialize the storage system of ESP-NOW. The ESP-NOW storage system is used to store the information of devices that have established communication, including the MAC address of the device, security keys, etc. This function initializes before starting to use ESP-NOW to ensure that the storage system is available.
Initialize Wi-Fi.
Create an espnow_config_t structure, which will be used to initialize ESP-NOW. And use the ESPNOW_INIT_CONFIG_DEFAULT() macro to initialize the structure. ESPNOW_INIT_CONFIG_DEFAULT() is a macro provided by ESP-NOW to set default configuration parameters. Users can redefine this macro by undefining it.
Call espnow_init to initialize ESP-NOW.
Call the espnow_set_config_for_data_type() function to set the received data type, such as configuring it as ESPNOW_DATA_TYPE_DATA type. The second parameter is set to true, indicating that the data packet of this type is allowed to be received, and the third parameter is the pointer to the callback function. This means that when a data packet of type ESPNOW_DATA_TYPE_DATA is received, the callback function will be called to notify the received data.
ESP-NOW Reference Materials
In addition, we currently have some public ESP-NOW materials, as follows:
ESP-NOW Performance Test Data Appendix
This part can refer to the ESP-NOW User Guide.