ESP-NOW is Espressif's own protocol for sending short messages straight from one ESP chip to another over the Wi-Fi radio. There is no access point, no IP address, no DHCP and no MQTT broker in the path. A board wakes up, fires off a packet to a known MAC address and can go back to sleep. That makes it a good fit for a battery button, a sensor in the garden shed or a remote for a DIY lamp - as long as every device in the conversation is an Espressif chip.

Below: what the protocol actually does, the limits worth knowing before you design around it, a working sender/receiver pair for the Arduino core, and the channel problem that catches almost everyone who builds a gateway.

What ESP-NOW is, and what it isn't

According to the ESP-IDF documentation, ESP-NOW wraps application data in a vendor-specific Wi-Fi action frame and transmits it "without connection". The default bit rate is 1 Mbps. Two versions exist:

  • v1.0 carries up to 250 bytes per packet.
  • v2.0 carries up to 1470 bytes. A v2.0 device receives packets from both versions; a v1.0 device receives v2.0 packets only up to 250 bytes and truncates or drops anything longer.

The sending side gets a callback that reports success when the frame was received at the MAC layer. That is a radio-level acknowledgement, not proof that your code on the other side processed the data. Espressif's own advice is to send an application-level ack if you need one, retransmit on timeout and add a sequence number so the receiver can drop duplicates.

Espressif lists the ESP8266, ESP32, ESP32-S and ESP32-C series as supported. Chips without their own Wi-Fi radio cannot do it: the ESPHome docs point out that the ESP32-H2 (802.15.4 and Bluetooth LE only) fails validation, and the ESP32-P4 needs a Wi-Fi co-processor over ESP-Hosted.

What ESP-NOW is not: a standard. A Zigbee, Thread or Matter device from another vendor will never hear it, and Home Assistant cannot talk to it directly. You need an ESP board somewhere that translates ESP-NOW into Wi-Fi, MQTT or a serial link.

Limits to design around

  • Same channel or nothing. Both sides must be on the same Wi-Fi channel. A peer's channel can be set to 0, which means "whatever channel the interface is on right now".
  • Peer list size. The ESP-IDF allows up to 20 paired devices, of which at most 17 can use encryption. The default limit for encrypted peers is 7 and is raised with CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM. A receiver doesn't need to add a sender as a peer to get broadcast or unencrypted unicast packets.
  • Callbacks run in the Wi-Fi task. Both the send and receive callbacks run from a high-priority Wi-Fi task. Copy the data into a buffer or queue and return; don't print long strings, write to flash or do network calls from inside them.
  • Don't burst. The docs recommend waiting for the send callback of one packet before sending the next, because very short gaps can reorder the callbacks.

Espressif's marketing numbers are worth reading as what a tuned product achieved, not as a promise. Its ESP32-C2 coin-cell switch reference design responds within 150 ms and, according to Espressif, runs up to 5 years on a CR2032 at about 10 presses a day. For its ESP-NOW remote control it quotes transmit power up to +21 dBm and control at 200 m in open space. Indoors, through walls, expect much less, the same as with ordinary Wi-Fi.

When to pick it over Wi-Fi, Zigbee or BLE

ESP-NOW earns its place in a few specific situations:

  • Battery devices that wake rarely. A normal Wi-Fi sensor has to associate with the access point, get an IP address and connect to a broker after every deep sleep. An ESP-NOW sender skips all of that and transmits right after boot.
  • Places your Wi-Fi doesn't reach well, where a direct link to a nearby ESP board is enough.
  • Low-latency control between your own boards: a wall button toggling a relay board, a remote driving a robot, two boards mirroring each other.

Pick something else when you want devices from other brands, a self-healing mesh, or the option to replace a DIY node with an off-the-shelf product later. That is what Zigbee and Thread are for. If the board sits on mains power within good Wi-Fi coverage, plain Wi-Fi with MQTT or ESPHome is simpler to debug and to update over the air.

A sender and a receiver in the Arduino IDE

Arduino-ESP32 3.0 (released May 2024) added an ESP_NOW library with the header ESP32_NOW.h. It wraps the ESP-IDF calls in an ESP_NOW_Peer class that you subclass. The library docs say it is tested only on the ESP32 family and interoperability with the ESP8266 is not guaranteed, so use ESP32-series boards on both ends. The two sketches below compile against Arduino-ESP32 3.3.

First, flash the receiver and read its station MAC address from the serial monitor. It is printed at startup.

Receiver:

#include <Arduino.h>
#include <WiFi.h>
#include "ESP32_NOW.h"

#define ESPNOW_CHANNEL 6

typedef struct __attribute__((packed)) {
  uint8_t  version;
  uint32_t counter;
  int16_t  temp_c_x100;
  uint16_t battery_mv;
} SensorMsg;

volatile bool gotMsg = false;
SensorMsg lastMsg;
int lastRssi = 0;

// Runs in the Wi-Fi task: copy the data and return quickly
void onData(const esp_now_recv_info_t *info, const uint8_t *data, int len, void *arg) {
  if (len != sizeof(SensorMsg) || gotMsg) return;
  memcpy(&lastMsg, data, sizeof(SensorMsg));
  lastRssi = info->rx_ctrl->rssi;
  gotMsg = true;
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.setChannel(ESPNOW_CHANNEL);
  while (!WiFi.STA.started()) delay(100);
  Serial.println("Receiver MAC: " + WiFi.macAddress());

  if (!ESP_NOW.begin()) {
    Serial.println("ESP-NOW init failed, restarting");
    delay(3000);
    ESP.restart();
  }
  ESP_NOW.onNewPeer(onData, nullptr);
}

void loop() {
  if (gotMsg) {
    if (lastMsg.version == 1) {
      Serial.printf("#%lu  %.2f C  %u mV  RSSI %d dBm\n",
                    (unsigned long)lastMsg.counter, lastMsg.temp_c_x100 / 100.0,
                    lastMsg.battery_mv, lastRssi);
    }
    gotMsg = false;
  }
  delay(10);
}

The receiver never adds the sender as a peer. In this library, packets from devices that aren't on the peer list go to the onNewPeer callback, which is enough for unencrypted unicast. The callback only copies the bytes and sets a flag; printing happens in loop().

Sender: put the receiver's MAC address into RECEIVER_MAC.

#include <Arduino.h>
#include <WiFi.h>
#include "ESP32_NOW.h"

#define ESPNOW_CHANNEL 6

// Receiver's station MAC address, read from its serial output
const uint8_t RECEIVER_MAC[6] = {0x24, 0x6F, 0x28, 0xAA, 0xBB, 0xCC};

typedef struct __attribute__((packed)) {
  uint8_t  version;      // bump when the layout changes
  uint32_t counter;
  int16_t  temp_c_x100;  // 21.37 C -> 2137
  uint16_t battery_mv;
} SensorMsg;

class ReceiverPeer : public ESP_NOW_Peer {
public:
  ReceiverPeer(const uint8_t *mac) : ESP_NOW_Peer(mac, ESPNOW_CHANNEL, WIFI_IF_STA, nullptr) {}
  bool begin() { return add(); }
  bool sendMsg(const SensorMsg &m) { return send((const uint8_t *)&m, sizeof(m)) > 0; }
  void onSent(bool success) override {
    Serial.println(success ? "delivered (MAC ack)" : "not delivered");
  }
};

ReceiverPeer receiver(RECEIVER_MAC);
uint32_t counter = 0;

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.setChannel(ESPNOW_CHANNEL);
  while (!WiFi.STA.started()) delay(100);
  Serial.println("Sender MAC: " + WiFi.macAddress());

  if (!ESP_NOW.begin() || !receiver.begin()) {
    Serial.println("ESP-NOW init failed, restarting");
    delay(3000);
    ESP.restart();
  }
}

void loop() {
  SensorMsg m;
  m.version = 1;
  m.counter = counter++;
  m.temp_c_x100 = 2137;   // replace with a real reading
  m.battery_mv = 3950;
  receiver.sendMsg(m);
  delay(10000);
}

A few choices here are deliberate. The payload is a packed struct of fixed-width integers, so its layout doesn't depend on padding the compiler adds. Temperature travels as hundredths of a degree in an int16_t instead of a float. The version byte lets you change the layout later without old receivers misreading new packets. The counter lets the receiver spot lost or repeated packets. In a real battery sensor you would replace delay(10000) with deep sleep, keep the counter in RTC memory, and go to sleep only after onSent has fired.

The gateway and the channel trap

Sooner or later you want the data in Home Assistant, Node-RED or an MQTT broker, so the receiver also has to join your Wi-Fi. That is where most ESP-NOW projects stall.

A board connected to an access point uses the access point's channel. ESPHome states it plainly for its espnow component: the channel cannot be set when Wi-Fi is used, because ESP-NOW follows the Wi-Fi network. So the gateway is on whatever channel the router picked, and every sender must use the same one. If the router is set to automatic channel selection and moves from 6 to 11 overnight, all sensors fall silent.

There are two ways out:

  1. Fix the channel in the router (2.4 GHz band, a channel allowed in your country - 1 to 13 in Europe) and hard-code it in the senders.
  2. Let the senders find it. Before sending, scan for your network's SSID and switch to its channel:
uint8_t findChannel(const char *ssid) {
  int n = WiFi.scanNetworks();
  for (int i = 0; i < n; i++) {
    if (WiFi.SSID(i) == ssid) return WiFi.channel(i);
  }
  return 0;  // not found
}

Then call WiFi.setChannel(ch) before ESP_NOW.begin(). A scan takes time and energy, so a battery sender should do it once, store the channel in RTC memory, and rescan only when sends start failing.

Reliability on a gateway that is also a Wi-Fi client varies. One Arduino forum user reported that an ESP-NOW receiver connected to an access point accepted only 15-25% of the messages in their tests. Others run such gateways without trouble. Measure it on your hardware: the counter in the payload makes lost packets easy to count. If the numbers are poor, a common fallback is two boards: one listens to ESP-NOW only and passes data over UART to a second one that handles Wi-Fi.

Encryption

ESP-NOW can encrypt unicast frames with CCMP. Each device has a 16-byte primary master key (PMK), set with esp_now_set_pmk() or passed to ESP_NOW.begin(pmk) in the Arduino library, and each encrypted peer has its own 16-byte local master key (LMK). If you don't set an LMK for a peer, frames to that peer go out in clear text. Broadcast frames cannot be encrypted at all, and a receiver must add the sender as a peer with the same LMK to accept encrypted packets.

For a garden thermometer, clear text may be acceptable. For anything that opens a door or switches a heater, use encryption plus your own sequence number, so a recorded packet can't simply be replayed. The frame format has a random-value field meant to stop relay attacks, but a counter you check in your own code costs a few bytes and leaves no doubt.

If you use ESPHome, note that its espnow component does not implement ESP-NOW's link-layer encryption. The docs point to the ESP-NOW Packet Transport platform, which adds its own encryption on top.

Mistakes that cost an evening

  • Wrong MAC address. The station and soft-AP interfaces have different MAC addresses. Use the one for the interface you send on (WIFI_IF_STA in the examples above).
  • Channel mismatch. If the send callback reports failure every time, check the channel first, especially after the gateway joined Wi-Fi.
  • Sending a whole char buffer when you meant the string length, or a struct whose layout differs between the two firmware builds. Use one shared header file for the message struct.
  • Heavy work in callbacks. Serial prints, HTTP requests or MQTT publishes inside the receive callback cause missed packets and watchdog resets. Set a flag or push to a queue.
  • Treating "delivered" as "processed". The send callback confirms the radio ack only. If the receiver must act on the data, have it send an answer.