Skip to content

+49 1626571232

info@openelab.io

🚀 Free Shipping from 50€ in EU / 80€ Worldwide

Learn

ESP-NOW: Eight Points You Must Know

ESP-NOW is a wireless communication protocol developed specifically for its ESP8266 and ESP32 microcontrollers. It provides a low-power, secure, low-cost and straightforward wireless communication solution for ESP32 devices. With ESP-NOW, multiple ESP32 devices can communicate with each other without the need for WiFi or routers, creating a mesh network of devices.
 
 

What is ESP-NOW?

 
esp-now is a lightweight communication protocol designed to provide an efficient and reliable connectionless communication solution. It is designed for embedded devices and is particularly suitable for Espressif Systems' ESP family of chips.
 
esp-now utilizes existing Wi-Fi hardware to provide direct communication between one-to-many and many-to-many devices without the need to go through a router or other intermediary device.
 
With ESP-NOW, we can have unidirectional or even bidirectional communication between ESP MCU devices without the need for a Wi-Fi network. It allows low-overhead point-to-point wireless data transfer, but with smaller packets. Up to 250 bytes of data can be transferred. Therefore, if a large amount of data needs to be transmitted, then using this protocol is not useful.
 
With ESP-NOW, the connection protocol is simplified, which reduces power consumption because less time is required for data transmission. In addition, ESP-NOW uses the same 2.4 GHz band as Wi-Fi, but does not require a connection or interfere with the local network connection. It is a fast and convenient communication protocol for transmitting smaller amounts of data.
 

  

Working principle of ESP-NOW

The working principle of esp-now is relatively simple, it is based on the MAC layer implementation of Wi-Fi. The following is the workflow of esp-now:
  • Initialization: Initialize the esp-now library and configure the role of the device (sender or receiver).
  • Pairing: Before communication, the sender and receiver need to perform pairing operation. During the pairing process, the sender sends its MAC address to the receiver to establish a trust relationship. 3.
  • Send Data: The sender sends a packet to the receiver using the API provided by the esp-now library. The packet can be any type of data, such as network configuration information, firmware upgrade file or debugging information.
  • Receive Data: The receiver listens to the Wi-Fi channel and receives packets from the sender. Once the packet is received, the receiver will trigger the callback function () to process it. 5.
  • Processing Data: The receiver processes the received packet through the callback function. Depending on the type of the packet, the receiver can perform corresponding operations, such as updating the network configuration, performing a firmware upgrade, or performing debugging.
 

Characteristics of ESP-NOW

esp-now has the following features that give it an advantage in large-scale data transmission:
  • Low Latency: esp-now utilizes Wi-Fi to communicate directly without going through a router or other intermediate devices, thus reducing transmission latency.
  • High Reliability: esp-now utilizes the reliable ARQ() (Automatic Retransmission Request) mechanism to ensure reliable data transmission.
  • Low Power Consumption: esp-now utilizes a low-power design for embedded devices to reduce energy consumption while maintaining communication quality.
  • Flexibility: esp-now supports one-to-many and many-to-many device connection and control, which can meet the needs of different application scenarios.
  • Ease of Use: esp-now's easy-to-use API allows developers to quickly integrate and deploy the protocol.
  • One-to-one data transfer (encrypted and unencrypted).
  • Support for encrypted and unencrypted peer devices. For encrypted devices, there are up to 10 peers in Workstation mode and up to 6 peers in SoftAP or a mix of both modes. However, for unencrypted devices, a maximum of 19 devices are allowed with no restriction on their mode of operation.
  • A maximum of 250 bytes of data can be transmitted in small packets.
  • It generates a callback function that informs the application layer whether the data transfer was successful.
To initialize the ESP-NOW connection, we must first pair the ESP32 boards. The connection will remain regardless of any board reboot and the transfer will continue without any problems.

 

What Factors Affect ESP-NOW?

The range of ESP-NOW depends on a number of factors, including antenna design and configuration and operating environment. In general, ESP-NOW can have a range of up to 220 meters (772 feet); however, these ranges are approximate and may vary greatly depending on the circumstances.
Factors that may affect the ESP-NOW range include:
  • RF Interference: ESP-NOW operates in the 2.4 GHz band, which is shared with other wireless technologies such as Bluetooth and WiFi. This means that there may be interference from other devices operating in the same band.
  • Operating Environment: The range of the ESP-NOW may be affected by physical barriers such as walls, ceilings and floors, as well as environmental factors such as temperature, humidity and atmospheric pressure.
  • Antenna Design: The range of ESP-NOW may be affected by the type and design of the antenna used. For example, the use of a directional antenna may increase the range of the ESP-NOW, while the use of an omni-directional antenna may decrease the range.
 

Is ESP-NOW Secure?

You can secure ESP-NOW communications in a number of ways to keep them safe and private:
  • Encrypting Data: Encrypting data is one of the most useful ways to secure ESP-NOW communications. You can encrypt the data using different encryption algorithms, such as AES or RSA. Encrypting the data will prevent anyone from intercepting and reading the transmitted data.
  • Using Security Keys: ESP-NOW supports the use of security keys to authenticate and establish connections between devices. By using security keys, you can ensure that only authorized devices can communicate with each other.
  • Use secure communication protocols: If the security of your application requires more advanced security measures, you may want to consider using a different communication protocol, such as WiFi, which has built-in support for encryption and authentication.
  • Use a separate security layer: In some cases, it may be useful to use a separate security layer on top of ESP-NOW to provide additional security. For example, you can use a secure tunneling protocol, such as HTTPS, to protect data transmitted over ESP-NOW.What types of communication are available with ESP-NOW?
 

ESP32 ESP-NOW One-Way Communication

In one-way communication, one peer device acts as a sender/master and the other as a receiver/slave. In this case, we can have multiple configurations for the sender-receiver.
  • One ESP32 board sending data to another ESP32 board
As shown in the figure below, one ESP32 board acts as a transmitter and the other board receives data and therefore acts as a receiver.
Usage: Sending sensor data, controlling ESP outputs, including LEDs, relays, buzzers, etc.

  • One ESP32 transmitter board sending data to various other ESP32 receiver boards
In this case, one ESP32 board will act as a transmitter/master and send data to multiple ESP32 boards acting as receiver/slave devices.
Usage: Remote Control
  • One ESP32 board receives data from various other ESP32 transmitter boards
Finally, in this case, one ESP32 board (receiver/slave) receives data from multiple ESP32 boards (transmitter/master).
Purpose: To receive sensor data from various sensors.

Or even have a network of ESP32 boards to transfer data:
 
 

In What Areas Can ESP-NOW Be Used?

ESP-NOW has a wide range of applications in various application scenarios, especially in large-scale data transfer. The following are some common application scenarios:
  • Network Configuration: esp-now can be used to quickly transfer network configuration information so that devices can easily connect to a specified Wi-Fi network.
  • Firmware Upgrade: Through esp-now, devices can receive firmware upgrade files and perform the upgrade operation accordingly - Debugging and Remote Control: esp-now can be used to remotely debug and control the device, which is convenient for developers to carry out troubleshooting and function testing.
  • Sensor Data Transmission: esp-now can be used to transmit sensor data, such as temperature, humidity, etc., to perform real-time monitoring and data collection.
  • Smart Home Control: esp-now can be used for communication and control between smart home devices, such as smart light bulbs, smart sockets, etc.
  • Industrial Automation: esp-now has potential in the field of industrial automation for real-time data transmission and control between devices.

 

You May Also Want to Ask

What is the one-to-one bit rate for ESP32 in ESP-NOW mode?

Test result:
  • Test board: ESP32-DevKitC V4.
  • Wi-Fi mode: station.
  • PHY rate is 1 Mbps by default.
  • Around 214 Kbps in an open 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.
 

Can Wi-Fi be used with ESP-NOW at the same time?

Yes, but it should be noted that the channel of ESP-NOW must be the same as that of the connected AP.
 

How do I set the rate at which ESP-NOW data is sent?

You may use the esp_wifi_config_espnow_rate() function to configure the rate, such asesp_wifi_config_espnow_rate(WIFI_IF_STA, WIFI_ PHY_RATE_MCS0_LGI).
 

ESP-NOW allows pairing with a maximum of 20 devices. Is there a way to control more devices?

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.
See the documentation for more questions:ESP-NOW

 

Prev Post
Next Post

Leave a comment

All blog comments are checked prior to publishing

Someone recently bought a

Thanks for subscribing!

This email has been registered!

Shop the look

Choose Options

Edit Option
Back In Stock Notification
this is just a warning
Login
Shopping Cart
0 items
RuffRuff App RuffRuff App by Tsun