ESP-NOW Mesh: Wireless Sensor Networks Without WiFi
What ESP-NOW Actually Is
A connectionless, low-latency wireless protocol built into ESP32/ESP8266 that operates independent of your WiFi network entirely — no router, no SSID, no IP addresses. Devices talk peer-to-peer directly via MAC address. This makes it genuinely well-suited for sensor networks where you want simplicity and low power over internet connectivity at the individual sensor node level.
Why Not Just Use WiFi Directly
- ESP-NOW has dramatically lower latency and power overhead than establishing a full WiFi connection for each transmission — no DHCP, no TCP handshake, just a direct radio packet.
- Works even without a router present at all — genuinely useful for remote sensor placements outside WiFi range of your main network, using a relay node instead (see mesh pattern below).
- Multiple sensors can broadcast to one receiver without any network configuration/pairing beyond knowing each other's MAC address.
Basic Sender (Sensor Node)
#include <esp_now.h> #include <WiFi.h> uint8_t receiverMAC[] = {0xAA, 0xBB, 0xCC, 0x11, 0x22, 0x33}; // target device's MAC typedef struct { float temperature; float humidity; } SensorData; void setup() { WiFi.mode(WIFI_STA); esp_now_init(); esp_now_peer_info_t peer = {}; memcpy(peer.peer_addr, receiverMAC, 6); peer.channel = 0; esp_now_add_peer(&peer); } void loop() { SensorData data = { readTemp(), readHumidity() }; esp_now_send(receiverMAC, (uint8_t*)&data, sizeof(data)); esp_deep_sleep_start(); // send and sleep — see deep sleep guide }Basic Receiver (Hub Node)
void onDataReceived(const uint8_t* mac, const uint8_t* data, int len) { SensorData* sensorData = (SensorData*)data; Serial.printf("Temp: %.1f Humidity: %.1f\n", sensorData->temperature, sensorData->humidity); // forward to MQTT/Home Assistant here } void setup() { WiFi.mode(WIFI_STA); esp_now_init(); esp_now_register_recv_cb(onDataReceived); }Finding a Board's MAC Address
Serial.println(WiFi.macAddress());Run this once on each board to get the address you need for peer configuration on the other end — write these down as you build out a multi-node network, since you're hardcoding peer addresses rather than using discovery.
Building an Actual Mesh (Multi-Hop)
ESP-NOW itself is peer-to-peer, not automatically meshing — for genuine multi-hop coverage (sensor A can't reach the hub directly, but can reach relay node B which forwards to the hub), you build this yourself: a relay node runs both a receiver callback (from sensors) and a sender routine (forwarding to the next hop), effectively acting as a simple store-and-forward bridge. Libraries like painlessMesh handle this networking complexity for you if you don't want to build custom relay logic — worth using once you're past a simple single-hop sensor-to-hub setup.
Bridging ESP-NOW to Your Real Network
The hub node (receiving ESP-NOW data) typically also runs normal WiFi simultaneously, forwarding received sensor data on to MQTT/Home Assistant over your actual network — ESP32 can genuinely run ESP-NOW and standard WiFi concurrently on the same radio, making this bridge pattern straightforward.
Related Guides
- Scaling Up: A Multi-Node LoRa Sensor Network with a Raspberry Pi Gateway
- Build a Meshtastic Off-Grid Mesh Messaging Node with ESP32 and LoRa
- How to Program Addressable LED Strips: WS2812B Patterns, Effects, and Power Design
- I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols
- How to Use Sensors with Arduino and ESP32: Temperature, Distance, Load, Current, and Hall Effect
- How to Control Motors with Arduino and ESP32: Stepper, DC, and Servo Drivers
- How to Hack Wi-Fi and Bluetooth with the Flipper Zero and Wi-Fi Marauder
- ESP32: Setting Up for Arduino IDE