Home / Blog / ESP-NOW mesh
Embedded Networking and IoT

ESP-NOW Mesh Networks: Build Reliable Local Sensor Systems

ESP-NOW can send small Wi-Fi action-frame payloads between devices without joining a conventional access point. That does not make every group of ESP32 boards a mesh: forwarding, route selection, duplicate suppression, delivery guarantees and recovery are application or higher-layer responsibilities. Define the delivery contract before deciding whether relays are worth their airtime and maintenance cost.

Separate the radio link from the network

A report moves through explicit forwarding and delivery stages
1 / SampleRead sensor; attach node ID, sequence and timestamp quality.
2 / RelayValidate sender, hop limit and duplicate cache before forwarding.
3 / GatewayQueue locally, then bridge to MQTT when a route is available.
4 / ConfirmReturn an application acknowledgement; retry within a budget.

Espressif describes ESP-NOW as connectionless communication using vendor-specific action frames. Its API provides peer management and send/receive callbacks, but a callback does not prove the destination application stored a measurement. Model link delivery, application acceptance and backend persistence as separate states.

Define a small, versioned packet

Include protocol version, message type, source ID, sequence number, hop limit, payload length and a compact integrity/authentication strategy. Keep telemetry bounded and compatible with the oldest device in the fleet. Payload limits depend on ESP-IDF and ESP-NOW versions; v1 devices have a smaller frame limit than v2. Verify the target documentation and negotiate capabilities rather than assuming every node was upgraded together.

Use sequence numbers to deduplicate retransmissions and a finite hop count to stop loops. A relay should remember recently seen source/sequence pairs for a bounded time, reject expired or malformed packets, and avoid forwarding its own traffic back toward the origin. Persistent sequence state needs a wear-aware design; a RAM-only counter can reset after power loss.

Route intentionally instead of flooding forever

Flooding is easy to prototype but can multiply transmissions rapidly. For a small fixed installation, a coordinator or preconfigured parent tree may be easier to reason about. If nodes move or links vary, route discovery needs metrics, aging, loop prevention and repair. Track link quality over time rather than choosing from one successful packet. A relay can become a single point of failure or a battery bottleneck.

Set a per-node transmission budget and schedule retries with jitter so one missed beacon does not synchronize every sensor into a collision burst. Test dense deployments, hidden nodes, interference and simultaneous alarms. Channel planning matters: ESP-NOW peers need a compatible channel, and coexistence with a Wi-Fi access point can constrain choices.

Security is more than a shared network name

ESP-NOW supports CCMP protection for configured peers. Provision unique device identities and keys through a controlled process, define rotation and revocation, and protect the gateway-to-cloud path independently. Broadcast discovery and unencrypted frames should not carry secrets or safety-critical commands. Authenticate command origin, include freshness or anti-replay state, and fail closed for actuation when trust cannot be established.

ConcernProtocol designField evidence
DeliveryApplication ACK, bounded retry, sequence IDACK rate and duplicate count
RoutingHop limit, route age and loop guardPath changes and relay load
CapacityCompact frames and traffic classesChannel occupancy and queue delay
SecurityPeer keys, authenticated commands, revocationRejected frames and key lifecycle audit
RecoveryStore-and-forward policy and gateway backlogOldest queued sample and recovery time

Measure before scaling

Instrument per-link RSSI where available, delivery ratio, retries, end-to-end age, hop count, queue depth, reboot cause and battery voltage. Run soak tests with walls, interference, node loss, gateway outage and power cycling. A useful dashboard shows both connectivity and missing data; a green node indicator can conceal silent packet loss. Represent timestamp uncertainty explicitly when nodes lack synchronized clocks.

When another technology fits better

ESP-NOW can suit small local control or telemetry networks where infrastructure independence and modest payloads matter. It is not a drop-in replacement for Wi-Fi IP networking, Thread, Zigbee, BLE Mesh or LoRaWAN. Compare interoperability, range, sleep behavior, node count, airtime rules, commissioning and operational tooling. For a production mesh with many nodes, use a maintained protocol stack or managed design rather than extending a one-off flooding algorithm indefinitely.

In summary

Treat ESP-NOW as a useful connectionless transport, then implement and test the network semantics your application needs. Version packets, bound hops and retries, acknowledge at the right layer, secure peers and observe delivery end to end. A mesh is a routing and operations design, not a topology sketch.

References