ESP-NOW Sensor Networks: Building a Multi-Node Gateway Without Wi-Fi Infrastructure
Wi-Fi is overkill for a battery-powered sensor that reports a temperature reading every few minutes. Associating with an access point, obtaining a DHCP lease, and opening a TCP or MQTT connection can take 500ms-2 seconds and burn a disproportionate amount of energy compared to the few bytes of payload actually being sent — and if your router is down, restarting, or simply out of range of a weak corner of the shop, the whole sensor network goes dark with it. ESP-NOW sidesteps all of that: it's a connectionless, low-latency protocol built into Espressif's Wi-Fi radio stack that lets ESP32 and ESP8266 boards exchange small packets directly, peer to peer, with no router, no SSID, and no IP stack involved at all. This guide covers building a multi-node sensor network on ESP-NOW with a dedicated gateway node that bridges the readings onto your existing network over Wi-Fi or Ethernet.
Why ESP-NOW Instead of MQTT-over-Wi-Fi Directly on Every Node
The appeal isn't just speed — it's architecture. With ESP-NOW, only one device (the gateway) needs to speak conventional Wi-Fi and maintain an MQTT or HTTP connection. Every sensor node stays off your Wi-Fi network entirely, which means:
- Sensor nodes can wake from deep sleep, take a reading, transmit it, and go back to sleep in under 50ms of active radio time — compared to 1-3 seconds for a full Wi-Fi association and MQTT publish cycle. On a coin-cell or small LiPo powered node, this is the difference between a battery lasting weeks versus a year or more.
- Your router's DHCP table and Wi-Fi association slots aren't consumed by a dozen sensor nodes, some routers start dropping or deprioritizing devices past 20-30 simultaneous associations.
- Range can actually be better in a noisy environment, since ESP-NOW doesn't need the back-and-forth handshaking that a full Wi-Fi association requires, and works even if nodes are slightly out of range of your actual access point as long as they're in range of the gateway.
- If your home network goes down (router reboot, ISP outage, VLAN reconfiguration), the sensor mesh between nodes and gateway keeps working independently; only the final bridge to the broader network is affected.
The tradeoff is that ESP-NOW has no built-in reliable delivery, retry, or payload fragmentation (packets are capped around 250 bytes), and it has no native authentication beyond an optional shared encryption key for a specific peer — it's a transport layer, and you build the reliability you need on top of it.
Step 1: Establish the Addressing Scheme
ESP-NOW addresses peers by MAC address. Before building anything, get the MAC address of every node and the gateway with a short sketch that prints WiFi.macAddress() at boot, and keep a table mapping MAC to a human-readable node ID and location. This table lives on the gateway so incoming packets can be matched to a name without each sensor node needing to transmit its own identity string every time (saving bytes and power).
| Node | MAC Address | Location | Sensor |
|---|---|---|---|
| node-01 | 24:6F:28:AA:BB:01 | Garage bay | DHT22 temp/humidity |
| node-02 | 24:6F:28:AA:BB:02 | Filament cabinet | SHT31 temp/humidity |
| node-03 | 24:6F:28:AA:BB:03 | Driveway gate | Door/reed switch |
| gateway | 24:6F:28:AA:BB:F0 | Workshop network rack | — |
Step 2: Define a Compact Packet Struct
Keep every packet a fixed-size struct rather than a variable-length string — this makes parsing trivial on the gateway and keeps packets well under the 250-byte ESP-NOW payload limit:
typedef struct {
uint8_t node_id; // maps to the name/location table on the gateway
uint8_t msg_type; // 0=periodic reading, 1=low battery, 2=door event
float value1; // e.g. temperature
float value2; // e.g. humidity (0 if unused)
uint16_t battery_mv; // battery voltage in millivolts, for health monitoring
uint32_t uptime_s; // seconds since this node last rebooted
} sensor_packet_t;
Step 3: Configure Sensor Nodes to Send and Sleep
Each sensor node's full wake cycle is: initialize WiFi in station mode (required even though you're not associating to anything, since ESP-NOW rides on the Wi-Fi radio), initialize ESP-NOW, register the gateway as a peer, take the sensor reading, send the packet, and immediately call esp_deep_sleep_start() for your reporting interval. Register a send-callback to confirm delivery, and on failure, retry once or twice before giving up and sleeping anyway — a missed reading every so often is rarely worth draining the battery over.
esp_now_peer_info_t peer = {};
memcpy(peer.peer_addr, gateway_mac, 6);
peer.channel = 1; // must match the gateway's Wi-Fi channel exactly
peer.encrypt = false; // set true + configure LMK/PMK for sensitive data
esp_now_add_peer(&peer);
sensor_packet_t pkt = { NODE_ID, 0, read_temp(), read_humidity(), read_battery_mv(), millis()/1000 };
esp_now_send(gateway_mac, (uint8_t*)&pkt, sizeof(pkt));
delay(50); // allow the send callback to complete before sleeping
esp_sleep_enable_timer_wakeup(REPORT_INTERVAL_US);
esp_deep_sleep_start();
Step 4: The Gateway — ESP-NOW In, MQTT Out
The gateway is the one node that stays powered and associates to your real Wi-Fi network (or runs Ethernet via an add-on module). It registers an ESP-NOW receive callback, decodes each incoming packet by matching the MAC address against its lookup table, and republishes the value as an MQTT message on a topic like sensors/garage-bay/temperature. Because the gateway is mains-powered, it can afford to run both the ESP-NOW receiver and a persistent MQTT connection simultaneously without worrying about sleep cycles. If you already run Home Assistant or Node-RED, this is also the natural point to add MQTT discovery payloads so new nodes show up automatically.
A Critical Gotcha: Channel Alignment
ESP-NOW peers must be on the same Wi-Fi channel, but the gateway's channel is dictated by whatever channel your router happens to be using when the gateway associates — which can silently change if your router does automatic channel selection. If your sensor nodes stop reporting after a router reboot or firmware update, a channel mismatch is the first thing to check. The more robust fix is to lock your router to a fixed channel for the SSID the gateway joins, or have the gateway read its own current channel at boot and have sensor nodes scan briefly for the gateway's advertised channel rather than hardcoding one — at the cost of some of the power savings from skipping Wi-Fi scanning.
Range and Scaling Expectations
Expect reliable ESP-NOW range similar to or slightly better than standard Wi-Fi from the same hardware — typically 30-60m line of sight, less through multiple walls or metal enclosures (CNC and laser cabinets are particularly bad for this). ESP-NOW officially supports up to 20 encrypted peers or around 250 unencrypted peers per device, which is far beyond what a single shop or home sensor network typically needs; if you do need to scale past a few dozen nodes or extend range significantly, look at ESP-NOW's mesh-relay capability (nodes forwarding other nodes' packets) rather than trying to talk to every node directly from one gateway.
The result is a sensor network that survives a router reboot, sips battery power for months at a time on a single 18650 cell, and still lands its data in the same Home Assistant dashboard or MQTT broker you're already running — the gateway is the only part of the system that needs to know your Wi-Fi password.