Many-to-One ESP-NOW Datalogger: Collect Data from Multiple ESP Devices to One Receiver
ESPHow ToIoT HardwaresIoT ProtocolsProgrammingTutorials/DIY

Many-to-One ESP-NOW Datalogger: Collect Data from Multiple ESP Devices to One Receiver

Introduction

In IoT and wireless sensor network projects, one common requirement is to gather data from multiple sensor nodes into a single central unit for logging or monitoring. Traditional methods use Wi-Fi routers and MQTT servers, but these approaches increase cost, power consumption, and complexity.

ESP-NOW, developed by Espressif Systems, offers a powerful alternative. It is a connectionless wireless communication protocol that allows ESP8266 and ESP32 boards to exchange data directly without needing an internet connection or Wi-Fi infrastructure.

A Many-to-One ESP-NOW Datalogger setup enables multiple ESP-based transmitters to send sensor readings to one receiver ESP board, which stores or displays the data. This architecture is ideal for smart agriculture, industrial monitoring, home automation, and research experiments.


What is a Many-to-One ESP-NOW System?

A Many-to-One ESP-NOW configuration consists of:

  • Multiple Sender Nodes – ESP8266/ESP32 devices connected with sensors
  • One Receiver Node – A central ESP device acting as datalogger
  • Direct wireless packet transmission using ESP-NOW
  • Optional storage on SD card, EEPROM, SPIFFS, or Serial Monitor

This topology forms a mini wireless sensor network (WSN) where:

  • Each node operates independently
  • No pairing handshake is required
  • Data packets include node identification
  • The receiver processes incoming messages from all nodes

Why Use ESP-NOW for Datalogging?

Considering the context that you are an IoT developer working on edge devices and WSN experiments, this method fits perfectly with your professional workflow.

Key Advantages

  • Works without router or internet
  • Very low latency
  • Lower power usage
  • Supports both ESP32 and ESP8266
  • Encrypted communication possible
  • Range up to 100+ meters
  • Simple broadcast architecture

Compared to HTTP or MQTT logging, ESP-NOW is lightweight and efficient for localized data acquisition.


System Architecture

Components Required

Sender Side (per node):

  • ESP8266 or ESP32 board
  • Sensors such as:
    • DHT11/DHT22 (Temperature & Humidity)
    • Soil Moisture Sensor
    • BMP280 (Pressure)
    • Analog sensors
  • Battery or USB power

Receiver Side:

  • ESP32 (recommended)
  • SD card module (optional)
  • OLED display (optional)
  • Serial interface for PC logging

Working Principle

  1. Every sender reads its connected sensor
  2. It packs data into a structured message
  3. Message contains:
    • Node name
    • Sensor values
  4. Packet is sent via ESP-NOW
  5. The receiver accepts packets from all MAC addresses
  6. Data is logged with timestamp

Identifying ESP-NOW Nodes

For proper logging, the receiver must know which device sent the data.

Typical identification methods:

  • Use unique MAC address
  • Include node ID in structure
  • Assign names like:
    • Node A
    • Node B
    • Node C

The receiver maps MAC → Node Name


Getting the MAC Address

Before coding the system, you need MAC addresses of all boards.

Upload this simple sketch to each ESP device to print its MAC:

MAC Finder Code

#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  Serial.println(WiFi.macAddress());
}

void loop() {}

Use the printed address in sender programs.


Coding the Many-to-One ESP-NOW Datalogger


Data Structure Design

All senders will use a common structure so that the receiver can decode packets uniformly.

Example:

typedef struct struct_message {
  char node[10];
  float temperature;
  float humidity;
  int sensorValue;
} struct_message;

Sender Node Program

Each transmitter runs similar firmware with only the node name changed.

Example Sender Code (ESP8266)

#include <ESP8266WiFi.h>
#include <espnow.h>
#include "DHT.h"

#define DHTPIN 5
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

uint8_t receiverAddress[] = {0x24, 0x6F, 0x28, 0xAA, 0xBB, 0xCC};

typedef struct struct_message {
  char node[10];
  float temperature;
  float humidity;
  int sensorValue;
} struct_message;

struct_message dataToSend;

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);

  dht.begin();

  if (esp_now_init() != 0) {
    Serial.println("ESP-NOW Init Failed");
    return;
  }

  esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
  esp_now_add_peer(receiverAddress, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);

  strcpy(dataToSend.node, "NodeA");
}

void loop() {
  dataToSend.temperature = dht.readTemperature();
  dataToSend.humidity = dht.readHumidity();
  dataToSend.sensorValue = analogRead(A0);

  esp_now_send(receiverAddress, (uint8_t *) &dataToSend, sizeof(dataToSend));

  delay(5000);
}

Scaling to More Nodes

You can duplicate this sketch for:

  • NodeB
  • NodeC
  • NodeD

Only modify:

strcpy(dataToSend.node, "NodeB");

Everything else remains the same.


Receiver (Central Datalogger) Code

The receiver ESP board listens to all nodes and logs their data.

ESP32 Receiver Sketch

#include <WiFi.h>
#include <esp_now.h>

typedef struct struct_message {
  char node[10];
  float temperature;
  float humidity;
  int sensorValue;
} struct_message;

struct_message receivedData;

void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
  memcpy(&receivedData, incomingData, sizeof(receivedData));

  Serial.print("From: ");
  Serial.println(receivedData.node);

  Serial.print("Temp: ");
  Serial.println(receivedData.temperature);

  Serial.print("Humidity: ");
  Serial.println(receivedData.humidity);

  Serial.print("Sensor: ");
  Serial.println(receivedData.sensorValue);

  Serial.println("--------------------");
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);

  esp_now_init();
  esp_now_register_recv_cb(OnDataRecv);
}

void loop() {}

Logging Options

Once data reaches the receiver, you can extend the project in several directions.

Possible Storage Methods

  • Log to PC via Serial Terminal
  • Save on:
    • SD Card
    • SPIFFS filesystem
    • LittleFS
    • Google Sheets (with gateway)
  • Display on OLED dashboard
  • Store in CSV format

Example Output Format

On the receiver serial monitor:

From: NodeA  
Temp: 28.40  
Humidity: 62.10  
Sensor: 512  
--------------------
From: NodeB  
Temp: 27.90  
Humidity: 60.50  
Sensor: 498  
--------------------

This confirms successful Many-to-One communication.


Practical Applications

A Many-to-One ESP-NOW Datalogger can be used for:

  • Farm field monitoring with distributed nodes
  • Factory floor data collection
  • Multi-room temperature logging
  • Power interference mitigation experiments
  • Local sensor aggregation hubs

Given that you work on reducing signal interference, ESP-NOW logs can help you test channel performance in real environments.


Limitations to Consider

While designing production systems, keep in mind:

  • Maximum peers (ESP8266: 20, ESP32: 10 in encrypted mode)
  • No automatic retransmission
  • Packet size limit 250 bytes
  • Works only on 2.4 GHz band

For most datalogging needs, these limits are more than sufficient.


Enhancements You Can Add

Future improvements:

  • Add timestamps using RTC module
  • Include battery level from each node
  • Acknowledge packets
  • Implement deep sleep on senders
  • Web dashboard on receiver
  • Auto node discovery

Conclusion

Building a Many-to-One ESP-NOW Datalogger is one of the most efficient ways to create a private wireless sensor network using low-cost ESP boards. It reduces dependency on external infrastructure and keeps the entire system offline and secure.

This communication model perfectly suits edge-based IoT experiments and real-world data acquisition tasks.


Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *