There is a communication method for the ESP32 that is quite useful in practice, even though it is not covered extensively in general guidebooks.
That is ESP-NOW.
ESP-NOW is an Espressif proprietary protocol for allowing ESP32-series devices to communicate directly with each other without a Wi-Fi router.
It is not a method of connecting to an access point and performing socket communication like standard TCP/IP communication.
Therefore, it is suitable for applications where you want to send short data quickly.
To give you the main points first, ESP-NOW is strong in the following situations:
- Periodic transmission from sensor terminals to a master unit
- Immediate control of equipment from a remote controller
- Lightweight data exchange between multiple ESP32s
- Status notification in places where wiring is difficult
Conversely, it is not suitable for the following applications:
- Web communication
- Cloud connection
- Large data transfer
- Designs based on general IP networks
ESP-NOW works using a method different from standard IP communication, even while using Wi-Fi hardware.
Understanding this difference makes it easier to decide which communication method to choose for the ESP32.
1. Overview of ESP-NOW
ESP-NOW is a connectionless wireless communication method provided by Espressif.
You can exchange data directly between ESP32s without connecting to a Wi-Fi router.
The term "connectionless" here means that it is not communication based on establishing a connection like TCP.
In other words, it is not a heavy mechanism where you open a socket and establish a session with the communication partner every time, but rather an image of sending light messages when necessary.
Sensibly, it is much easier to understand as:
- HTTP / MQTT: Communication connected to a network or cloud
- ESP-NOW: Communication that connects ESP32s lightly and quickly at close range.
2. Features of ESP-NOW
■ Communication possible without an AP
A major feature of ESP-NOW is that a Wi-Fi router is not required.
Even if there is no access point in your home or factory, you can exchange data directly between ESP32s.
Actual communication is performed by specifying the MAC address of the partner.
Therefore, while the terms "master unit" and "slave unit" are often used, it is more accurate to think of it as peer-to-peer communication where you send to a partner whose MAC address you know.
■ Low latency and easy to handle
Since it does not assume connection establishment or IP layer processing, it is suitable for applications where you want to send short data quickly.
For example, button presses, status notifications, sensor value transmissions, etc.
"I want to send it immediately when the device status changes"
"I want to send data of a few bytes to several tens of bytes lightly"
It is very compatible with situations like these.
■ Easy to design for power saving
ESP-NOW is a communication method that is easy to configure for low power consumption applications.
In particular, for battery-powered sensor nodes, the advantage is that it is easy to configure as:
- Sleep and wait
- Wake up at a fixed cycle
- Measure
- Send immediately and sleep again
However, some caution is needed here.
This does not mean that "power consumption is always low because it is ESP-NOW." Actual power consumption varies greatly depending on:
- Transmission cycle
- Sleep design
- Reception standby time
- Conditions for concurrent use with Wi-Fi
Therefore, it is safe to understand it precisely as
"easier to design for power saving than a configuration that maintains a constant Wi-Fi connection."
■ Supports encryption
ESP-NOW can also support encryption if necessary.
If configured properly, it is not just a mechanism that uses plain text in plain sight.
However, just because encryption is enabled does not mean that safety design for the entire system is unnecessary.
In practice, it is necessary to consider key management, pairing management, retransmission, spoofing countermeasures, etc.
3. How does it work?
ESP-NOW is a mechanism that sends application data in Wi-Fi vendor-specific action frames.
This is a major difference from general IP communication such as HTTP or MQTT.
In other words, although ESP-NOW uses Wi-Fi hardware, it is important to understand that:
- It is not a mechanism for free communication using IP addresses
- It is not intended for direct interoperability with PCs or general Wi-Fi devices
- It is a method specialized for lightweight communication between ESP32-series devices
For this reason, while it is strong for short-range, lightweight, and responsiveness-oriented communication, it is not suitable for applications where you connect freely to PCs and clouds like ordinary network equipment.
4. What is it suitable for?
Typical practical applications are as follows:
- Wireless push buttons
- Wireless remote controls
- Collection of temperature, humidity, contact, and analog values
- Simple sensor networks with multiple slave units connected to one master unit
- Status notification in places where wiring is difficult
- Very lightweight device-to-device I/F between ESP32s
For example, in a factory or facility, if the conditions are:
- Difficult to route cables
- It is sufficient to send values every few seconds to several tens of seconds
- Faster response is better
- You do not want to make the infrastructure too elaborate
then it becomes a very strong option.
5. What is it not suitable for?
On the other hand, there are areas where ESP-NOW is not strong.
- Large data such as video and audio
- Designs centered on Web servers or cloud integration
- Interconnection with general IP devices
- Mass transmission of long logs
- Applications where you want to delegate all complex communication quality management from the start
Basically, ESP-NOW should be used as a lightweight wireless link.
It is not a substitute for high-performance network communication.
Also, as an important point,
just because a transmission success callback is returned does not guarantee that the receiving application has processed it.
This is a point that beginners often misunderstand.
Transmission success only indicates success at a low layer, and
it does not guarantee that "the other party received it, interpreted the content, and completed the processing."
Therefore, if reliability is required in practice,
- Sequence numbers
- ACK responses
- Timeouts
- Retransmission control
- Duplicate reception countermeasures
are often designed on the application side.
6. Relationship with Wi-Fi
ESP-NOW uses Wi-Fi hardware, but its role is different from normal STA or AP connections.
This is quite important.
In practice, you might want to consider the following configuration:
- Collect data from child devices to a parent device using ESP-NOW
- The parent device sends it to an upper-level server using a normal Wi-Fi connection
This configuration itself is often used.
However, when using ESP-NOW and normal Wi-Fi simultaneously, you need to be properly aware of channel design and coexistence conditions.
If you are vague about this,
- It works in one environment
- It is unstable in another environment
- It does not reproduce during mass production
are things that tend to happen.
Therefore,
instead of "just trying both,"
organizing and designing the communication method and channel conditions from the start
is important in practice.
7. Development Methods
ESP-NOW can currently be developed mainly using the following systems:
- ESP-IDF's ESP-NOW API
- Arduino-ESP32's ESP-NOW API
For beginners to try, starting with the Arduino IDE is sufficient.
On the other hand, if you are looking at product-oriented development, fine control, or overall system design, there are many situations where ESP-IDF is easier to handle.
In other words,
- Want to get it running and understand it first -> Arduino IDE
- Want to consider mass production design or full-scale implementation -> ESP-IDF
It is good to think about it with this distinction.
8. How to understand it for beginners
To put ESP-NOW in a nutshell, it is
"a lightweight, short-range, immediate-response wireless message communication dedicated to ESP32."
Since this is a bit abstract, it is easier to understand by comparing it with common communication methods.
Differences from HTTP / MQTT
- HTTP / MQTT
- Good at connecting over a network to the cloud or a PC
- Assumes IP communication
- Highly versatile
- ESP-NOW
- Good at connecting ESP32s to each other lightly and quickly
- Easy to operate even without a router
- Suitable for lightweight inter-device communication
In other words, it is not a matter of which is superior; the applications are different.
9. Design image in practice
For example, the following configuration is compatible with ESP-NOW:
- Child device: Battery-powered ESP32 + sensor
- Parent device: ESP32
- Child device sends measurement values via ESP-NOW every 30 seconds
- Parent device receives, displays on LCD, and saves to SD
- If necessary, only the parent device relays to the upper level via normal Wi-Fi / MQTT
The good thing about this configuration is that the division of roles is clear.
- Terminal nodes are lightweight and power-saving oriented
- The parent device is responsible for aggregation, display, storage, and upper-level connection
In other words, you can divide the work so that the terminals use ESP-NOW and only the gateway uses normal Wi-Fi. This is a configuration that is quite easy to handle in practice.
10. Thinking about data length
Although it tends to be omitted in articles for beginners, ESP-NOW does not mean "you can send any large data."
What is particularly important is that if you are crossing between different partners or versions, it is safer to design with smaller data.
As a sense of scale, it is suitable for sending
- A few bytes
- Several tens of bytes
- At most a small structure
For example,
- Temperature
- Humidity
- Pressure
- Status flags
- Counters
- Short commands
Conversely, it is not suitable for sending
- Long logs
- Large JSON
- Images or audio
- Huge structures
Basically, think of ESP-NOW as a mechanism for exchanging small messages lightly.
11. Minimum send/receive sample of ESP-NOW running on Arduino IDE
From here on, this is the minimum sample you can try with the Arduino IDE.
Prepare a sender and a receiver respectively.
This time, I will explain using the minimum configuration of WiFi.h + esp_now.h, which is widely used in the Arduino environment.
What to do first
The procedure is as follows:
- Write to the receiver
- Check the MAC address on the receiver's serial monitor
- Paste that MAC address into the sender code
- Write to the sender
- Success if received data appears on the receiver's serial monitor
■ Receiver Sketch
The receiver displays the received string and counter value on the serial monitor.
#include <WiFi.h> #include <esp_now.h> #include <esp_wifi.h>
typedef struct struct_message
int counter;
char text[32];
struct_message;
struct_message incomingData;
// STA MACアドレス表示用
void printStaMac()
uint8_t mac[6];
esp_wifi_get_mac(WIFI_IF_STA, mac); // または環境によって ESP_IF_WIFI_STA
Serial.printf("My MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
// 受信コールバック
void onDataRecv(const esp_now_recv_info_t *info, const uint8_t *data, int len)
if (len != sizeof(incomingData))
Serial.println("=== Receive Error ===");
Serial.print("Invalid data length: ");
Serial.println(len);
Serial.println();
return;
memcpy(&incomingData, data, sizeof(incomingData));
Serial.println("=== Receive ===");
Serial.print("From MAC: ");
for (int i = 0; i < 6; i++)
Serial.printf("%02X", info->src_addr[i]);
if (i < 5) Serial.print(":");
Serial.println();
Serial.print("counter = ");
Serial.println(incomingData.counter);
Serial.print("text = ");
Serial.println(incomingData.text);
Serial.println();
void setup()
Serial.begin(115200);
delay(1000);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
Serial.println();
Serial.println("ESP-NOW Receiver");
printStaMac();
if (esp_now_init() != ESP_OK)
Serial.println("ESP-NOW init failed");
return;
esp_now_register_recv_cb(onDataRecv);
Serial.println("Receiver ready");
void loop()
// 何もしない
■ Transmitter-side sketch
Please rewrite receiverMac[] to the MAC address displayed on the receiver-side serial monitor.
#include <WiFi.h> #include <esp_now.h> #include <esp_wifi.h>
typedef struct struct_message
int counter;
char text[32];
struct_message;
struct_message sendData;
int sendCounter = 0;
// ===== 送信先(受信機)のMACアドレスを設定 =====
// 受信側シリアルモニタに表示された MAC をここへ入れてください
uint8_t receiverMac[] = 0x24, 0x6F, 0x28, 0x12, 0x34, 0x56;
// STA MACアドレス表示
void printStaMac()
uint8_t mac[6];
esp_err_t err = esp_wifi_get_mac(WIFI_IF_STA, mac);
if (err != ESP_OK)
Serial.print("esp_wifi_get_mac failed: ");
Serial.println(err);
return;
Serial.printf("My MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
// 送信結果コールバック
void onDataSent(const wifi_tx_info_t *info, esp_now_send_status_t status)
Serial.println("=== Send Result ===");
if (info != nullptr)
Serial.print("To MAC: ");
for (int i = 0; i < 6; i++)
Serial.printf("%02X", info->des_addr[i]);
if (i < 5) Serial.print(":");
Serial.println();
if (status == ESP_NOW_SEND_SUCCESS)
Serial.println("Status : Success");
else
Serial.println("Status : Fail");
Serial.println();
// peer追加
bool addPeer(const uint8_t *peerMac)
esp_now_peer_info_t peerInfo = ;
memcpy(peerInfo.peer_addr, peerMac, 6);
// channel = 0 : 現在のWi-Fiチャネルを使用
peerInfo.channel = 0;
peerInfo.ifidx = WIFI_IF_STA;
peerInfo.encrypt = false;
if (esp_now_is_peer_exist(peerMac))
return true;
esp_err_t result = esp_now_add_peer(&peerInfo);
if (result != ESP_OK)
Serial.print("esp_now_add_peer failed: ");
Serial.println(result);
return false;
return true;
void setup()
Serial.begin(115200);
delay(1000);
// Wi-FiをSTAモードで開始
WiFi.mode(WIFI_STA);
WiFi.disconnect();
Serial.println();
Serial.println("ESP-NOW Sender");
printStaMac();
// ESP-NOW初期化
if (esp_now_init() != ESP_OK)
Serial.println("ESP-NOW init failed");
return;
// 送信コールバック登録
esp_now_register_send_cb(onDataSent);
// 送信先peer登録
if (!addPeer(receiverMac))
Serial.println("Peer add failed");
return;
Serial.print("Peer added: ");
for (int i = 0; i < 6; i++)
Serial.printf("%02X", receiverMac[i]);
if (i < 5) Serial.print(":");
Serial.println();
Serial.println("Sender ready");
void loop()
sendCounter++;
sendData.counter = sendCounter;
snprintf(sendData.text, sizeof(sendData.text), "Hello ESP-NOW %d", sendCounter);
Serial.println("=== Send ===");
Serial.print("counter = ");
Serial.println(sendData.counter);
Serial.print("text = ");
Serial.println(sendData.text);
esp_err_t result = esp_now_send(receiverMac, (uint8_t *)&sendData, sizeof(sendData));
if (result != ESP_OK)
Serial.print("esp_now_send failed: ");
Serial.println(result);
Serial.println();
delay(3000);
12. Key points of this minimal sample
This sample focuses only on the following basics:
・ESP-NOW initialization
・Peer addition
・Send callback
・Receive callback
In other words, it is the minimal configuration for understanding ESP-NOW.
Point 1: First, set to STA mode
Before using ESP-NOW, we first set Wi-Fi to STA mode.
WiFi.mode(WIFI_STA); WiFi.disconnect();
This is a basic pattern that frequently appears in ESP-NOW samples.
Point 2: Register the communication partner as a peer
Before sending, register the partner's MAC address as a peer.
esp_now_peer_info_t peerInfo = ; memcpy(peerInfo.peer_addr, receiverMac, 6); peerInfo.channel = 0; peerInfo.encrypt = false; esp_now_add_peer(&peerInfo);
Rather than broadcasting to anyone and sending whatever you want, it is easier to understand ESP-NOW if you think of it as being aware of and registering your communication partner.
Point 3: Sending with a structure is closer to practical use
This time, we are sending a structure called
typedef struct struct_message
int counter;
char text[32];
struct_message;We are sending a structure like this.
In ESP-NOW, a design that sends a small structure like
"counter + sensor value + flag"
is often used in practical applications.
Point 4: It is safer to include a len check
On the receiving side, we include a length check like
if (len != sizeof(incomingData))
...
Although it is sometimes omitted in minimal samples, it is safer to include it from the beginning in practical applications because it helps detect different data formats, version differences, and incorrect reception.
ESP_NOW_SEND_SUCCESS
Even if you get a success message, it is not a guarantee that the partner application has completely processed it.
If necessary, please add a design such as:
・Returning an ACK from the receiver side
・Including a sequence number
・Retransmitting after a certain period of time
14. Points where beginners often get stuck
Here are some points where people often get stuck when they start trying out ESP-NOW.
Incorrectly pasting the MAC address
This is the most common issue at first. Please check if the receiver's MAC address has been correctly transcribed to the transmitter side.
Data structure does not match between sender and receiver
If the contents of the structure differ between the sender and receiver, it cannot be received correctly. For example, discrepancies such as:
・Different item order
・Different types
・Different array lengths
can cause malfunctions.
Channel issues when using Wi-Fi simultaneously
When using ESP-NOW and regular Wi-Fi together, instability such as "sometimes it can send/receive and sometimes it cannot" can be caused by channel conditions.
We will not cover this in depth in the minimal sample, but it becomes important when moving to practical applications.
Assuming it reached the partner
It is also typical to feel relieved just by looking at the transmission success display. If it is important data, please be sure to consider a mechanism for reception confirmation.
14. Who is ESP-NOW suitable for?
ESP-NOW is suitable for people such as the following:
- People who want to try connecting ESP32s to each other easily first
- People who want to build multiple sensor nodes
- People who want to reduce wiring
- People who want a wireless link with light response
- People who want to aggregate data at a master unit and connect to a higher-level system if necessary
Conversely, if you:
- Want to build a cloud-centric system from the start
- Want to perform general-purpose IP communication with smartphones or PCs
- Want to send large amounts of data
- Want to leave all communication reliability to the protocol side
then other methods may be more suitable.
15. Summary
ESP-NOW is a lightweight communication method for connecting ESP32-series devices directly to each other without a Wi-Fi router.
To summarize its features again, they are as follows:
- Easy to use without an AP
- Easy to send short data with low latency
- Easy to incorporate power-saving designs
- Suitable for device-to-device communication between ESP32s
- However, it is not a substitute for IP communication
- Application-side design is important for high reliability
In short, ESP-NOW becomes very easy to use when understood as
"a tool for connecting ESP32s to each other lightly, quickly, and over short distances"
.