ESP-NOW is a wireless communication protocol developed by Espressif Systems, specifically designed for devices based on ESP32 and ESP8266 chips.
ESP-NOW is a point-to-point (P2P) system that allows ESP32 and ESP8266 devices to exchange data without the need to connect to a Wi-Fi network.
Main features of ESP-NOW
- Low latency: ESP-NOW is designed to quickly transmit data, with very low response times.
- Low power consumption: Since it does not require a full Wi-Fi connection, ESP-NOW consumes less energy, making it ideal for battery-powered devices.
- Direct connection: Devices communicate directly with each other, without needing an Access Point or router.
- Security: ESP-NOW uses AES encryption to ensure that transmitted data is secure.
- Easy implementation: With libraries and examples provided by Espressif, it is easy to implement ESP-NOW in ESP32 projects.
Comparison with other protocols
ESP-NOW is optimized for transmitting small data packets with low latency and low power consumption (unlike other protocols like Wi-Fi or Bluetooth)
Protocol | Latency | Consumption | Range | Complexity |
---|---|---|---|---|
ESP-NOW | 🟢Low | 🟢 Low | 🟡 Medium | 🟢 Low |
Wi-Fi | 🟡Medium | 🔴 High | 🟢 High | 🔴 High |
Bluetooth | 🟡Medium | 🟡 Medium | 🔴 Short | 🟡 Medium |
As we can see, ESP-NOW offers a balance between latency, power consumption, and ease of use, making it a very good option for many IoT applications.
Message size: Make sure the message is not too large. ESP-NOW has a limit of 250 bytes per message.
How ESP-NOW works
ESP-NOW works by creating a direct link between two or more ESP32 devices.
This link is established using MAC addresses (Media Access Control), which are unique identifiers for each device on a network.
To get the MAC of your device, you can run this code
#include "WiFi.h"
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_MODE_STA);
Serial.println(WiFi.macAddress());
}
void loop()
{
}
MAC Addresses: MAC addresses must be unique and correctly configured on all devices.
How to use ESP-NOW
ESP-NOW is integrated into the ESP32 core, so you don’t need any hardware or to install any library.
You simply need two ESP32 devices. It can be any model of ESP32. And have the IDE correctly set up and installed (the usual stuff).
In the following posts, we will see different examples of ESP-NOW, sending different contents (json, structs) and in different configurations (1 to 1, 1 to many, etc).