If you've ever worked with ESP32 and ESP-NOW, you probably realized something quickly:
ESP-NOW is powerful… but building a reliable and scalable system on top of it is not trivial. ESP-NOW is powerful… but building a reliable and scalable system on top of it is not trivial.
Handling acknowledgments, retries, multiple devices, and network state quickly turns into repetitive and error-prone work.
That’s exactly why ESPNowProtocol was created.
What is ESPNowProtocol?ESPNowProtocol is a lightweight communication layer built on top of ESP-NOW, designed to simplify and standardize device-to-device communication between ESP32 boards.
Instead of dealing with low-level packet handling, you get a structured and reliable system with features typically found in higher-level protocols.
It provides a complete solution for device-to-device communication, including:
- Generic payload messaging
- Reliable delivery (ACK + retry)
- Message queue (non-blocking)
- Multi-device networking
- Automatic peer discovery
- Device lifecycle management (online/offline)
- Link diagnostics (RSSI + quality)
The communication flow is simple:
ESP32 (Sender) → ESP-NOW → ESP32 (Receiver)But internally, ESPNowProtocol adds:
- Message types (DATA, ACK, HELLO, HEARTBEAT)
- Sequence control
- Logical addressing (node IDs)
- Network awareness
Each message can be sent using ACK + retry:
protocol.sendReliable(dest, msg_id, data, len);This ensures delivery even in noisy environments.
2. Logical Addressing SystemEach device has a node ID, independent of MAC address:
src → sender
dest → receiver (255 = broadcast)This makes your application logic much cleaner.
3. Auto Discovery (Plug & Play Network)Devices can automatically discover each other:
protocol.enableAutoDiscovery(true);No need to manually register every peer.
4. Device Lifecycle ManagementThe library tracks:
- When a device comes online
- When it goes offline (timeout detection)
Example logs:
[ENP] New peer: 23
[ENP] Peer offline: 235. Link Quality MonitoringEach packet includes RSSI:
int8_t rssi;You can also query:
protocol.getPeerRSSI(id);
protocol.getLinkQuality(id);This is extremely useful for:
- Diagnostics
- Adaptive systems
- Signal quality analysis
The internal queue ensures your application doesn’t freeze.
Just make sure to call:
protocol.loop();continuously.
Quick StartStep 1 — Install the LibraryUsing Arduino IDE:
- Go to Library Manager
- Search for ESPNowProtocol
- Install
#include <ESPNowProtocol.h>
ESPNowProtocol protocol;
uint8_t peer[] = {0x10,0x52,0x1C,0x68,0x15,0x28};
void setup()
{
Serial.begin(115200);
protocol.begin();
protocol.setNodeId(1);
protocol.addPeer(2, peer);
}
void loop()
{
protocol.loop();
int value = 42;
protocol.sendReliable(2, 1, (uint8_t*)&value, sizeof(value));
}Step 3 — Basic Receiver#include <ESPNowProtocol.h>
ESPNowProtocol protocol;
void onData(uint8_t src, uint8_t id, const uint8_t *data, uint8_t len, int8_t rssi)
{
int value;
memcpy(&value, data, sizeof(value));
Serial.print("From: ");
Serial.print(src);
Serial.print(" | RSSI: ");
Serial.println(rssi);
Serial.println(value);
}
void setup()
{
Serial.begin(115200);
protocol.begin();
protocol.setNodeId(2);
protocol.onReceive(onData);
}
void loop()
{
protocol.loop();
}Use CasesESPNowProtocol is especially useful for:
- Wireless sensor networks
- Distributed embedded systems
- Remote control applications
- Real-time telemetry
- ESP32 clusters
protocol.loop()must run continuously- Avoid blocking delays
- Max payload: 32 bytes
- Each device must have a unique nodeId
What really differentiates ESPNowProtocol is that it treats ESP-NOW like a real network, not just a packet pipe.
You get:
- Network formation
- Device awareness
- Communication reliability
- Diagnostics
All without Wi-Fi infrastructure.
RoadmapPlanned features include:
- Peer event callbacks (online/offline)
- Advanced link metrics (latency, packet loss)
- Automatic best-peer selection
- Mesh routing (multi-hop)
ESPNowProtocol removes a lot of the friction when building real-world ESP-NOW systems.
Instead of reinventing the wheel every time, you can focus on what actually matters:
your application logic.
If you're building anything beyond a simple point-to-point ESP-NOW demo, this library is worth trying.









Comments