Comments on: ESP-NOW with ESP32: Send Data to Multiple Boards (one-to-many) https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 13 Aug 2025 20:08:19 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1081589 Wed, 13 Aug 2025 20:08:19 +0000 https://randomnerdtutorials.com/?p=95718#comment-1081589 In reply to Mike.

Hi.

For ESP32 core version before 3.3.0:
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {

For the latest ESP32 core version 3.3.0:
void OnDataSent(const wifi_tx_info_t *mac_addr, esp_now_send_status_t status) {

So, either downgrade the ESP32 core to the previous version or use the previous line that I shared.

We’re still waiting to see if there are more breaking changes in the new core before updating all our esp-now guides.

Regards,
Sara

]]>
By: Mike https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1081146 Tue, 12 Aug 2025 12:28:55 +0000 https://randomnerdtutorials.com/?p=95718#comment-1081146 In reply to Sara Santos.

Hello Sara, my Name is Mike. I have the same Problem.

This is your example code:

/*********
Rui Santos & Sara Santos – Random Nerd Tutorials
Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp32-esp8266/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/
#include <esp_now.h>
#include <WiFi.h>

// REPLACE WITH YOUR ESP RECEIVER’S MAC ADDRESS
uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t broadcastAddress2[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t broadcastAddress3[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

typedef struct test_struct {
int x;
int y;
} test_struct;

test_struct test;

esp_now_peer_info_t peerInfo;

// callback when data is sent
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
char macStr[18];
Serial.print(“Packet to: “);
// Copies the sender mac address to a string
snprintf(macStr, sizeof(macStr), “%02x:%02x:%02x:%02x:%02x:%02x”,
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
Serial.print(macStr);
Serial.print(” send status:\t”);
Serial.println(status == ESP_NOW_SEND_SUCCESS ? “Delivery Success” : “Delivery Fail”);
}

void setup() {
Serial.begin(115200);

WiFi.mode(WIFI_STA);

if (esp_now_init() != ESP_OK) {
Serial.println(“Error initializing ESP-NOW”);
return;
}

esp_now_register_send_cb(OnDataSent);

// register peer
peerInfo.channel = 0;
peerInfo.encrypt = false;
// register first peer
memcpy(peerInfo.peer_addr, broadcastAddress1, 6);
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println(“Failed to add peer”);
return;
}
// register second peer
memcpy(peerInfo.peer_addr, broadcastAddress2, 6);
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println(“Failed to add peer”);
return;
}
/// register third peer
memcpy(peerInfo.peer_addr, broadcastAddress3, 6);
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println(“Failed to add peer”);
return;
}
}

void loop() {
test.x = random(0,20);
test.y = random(0,20);

esp_err_t result = esp_now_send(0, (uint8_t *) &test, sizeof(test_struct));

if (result == ESP_OK) {
Serial.println(“Sent with success”);
}
else {
Serial.println(“Error sending the data”);
}
delay(2000);
}

The Error is:

Compilation error: invalid conversion from ‘void ()(const uint8_t, esp_now_send_status_t)’ {aka ‘void ()(const unsigned char, esp_now_send_status_t)’} to ‘esp_now_send_cb_t’ {aka ‘void ()(const wifi_tx_info_t, esp_now_send_status_t)’} [-fpermissive]

]]>
By: Sara Santos https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1076322 Wed, 30 Jul 2025 15:51:47 +0000 https://randomnerdtutorials.com/?p=95718#comment-1076322 In reply to Mike.

Hi.
What code exactly is giving you problems?

Regards,
Sara

]]>
By: Mike https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1075597 Mon, 28 Jul 2025 10:44:05 +0000 https://randomnerdtutorials.com/?p=95718#comment-1075597 Hi, thanks for all the tutorials! I’m beginning to work through the ESP32-now material.

I’ve added a line to the Getting the boards base MAC address where the MAC address is printed; I assume most users will copy the serial port output and paste into some code.
if (ret == ESP_OK) {
Serial.printf(“%02x:%02x:%02x:%02x:%02x:%02x and for C++ code “,
baseMac[0], baseMac[1], baseMac[2],
baseMac[3], baseMac[4], baseMac[5]);
Serial.printf(“{0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X}\n”,
baseMac[0], baseMac[1], baseMac[2],
baseMac[3], baseMac[4], baseMac[5]);
} else // etc

Since Espressif moved from boards version 3.2.1 to 3.3 the API for registering callbacks has changed. The compile errors seem to be about the callback definition; but my C++ coding knowledge is insufficient to disentangle the problem.
No doubt Espressif will release versions 3.3.1 etc. Can you help to update your examples to work with the 3.3.x API?

Many thanks

]]>
By: Michael https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1057026 Thu, 12 Jun 2025 19:34:12 +0000 https://randomnerdtutorials.com/?p=95718#comment-1057026 Thank you! Downgrading the board installation solved my problem.
Kind Regards,
Michael

]]>
By: Sara Santos https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1056465 Tue, 10 Jun 2025 21:34:02 +0000 https://randomnerdtutorials.com/?p=95718#comment-1056465 In reply to Michael.

Hi.
I’ll try it out again.
Meanwhile, try downgrading your ESP32 boards installations. Go to Tools > Boards > Boards Manager > Search for ESP32 and try previous versions.

Regards,
Sara

]]>
By: Michael https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-1056173 Mon, 09 Jun 2025 22:27:43 +0000 https://randomnerdtutorials.com/?p=95718#comment-1056173 Hi Rui and Sara,
Thank you for your excellent tutorials. I have been using ESP_NOW for several months successfully. This week the code no longer compiles on Arduino IDE.
I tried copying and compiling your sender example and received the same error:
Compilation error: invalid conversion from ‘void ()(const uint8_t, esp_now_send_status_t)’ {aka ‘void ()(const unsigned char, esp_now_send_status_t)’} to ‘esp_now_send_cb_t’ {aka ‘void ()(const wifi_tx_info_t, esp_now_send_status_t)’} [-fpermissive]

I assume there has been a change in a library somewhere. Can you help?
KInd Regards,
Michael

]]>
By: Pierre-Yves MULLER https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-924933 Thu, 13 Jun 2024 11:21:00 +0000 https://randomnerdtutorials.com/?p=95718#comment-924933 Hi,
I try your code (one ESP32 sender and 3 ESP8266 receiver) and it works fine ! Thank you.
But when I extend with 6 ESP8266 receiver I noticed on the Arduino IDE Serial Monitor of the ESP32 sender sent only 4 or sometime 5 “Delivery Success” message!
It looks like a timing jam… Do you have an idea why.
I would like to send data to 20 receivers IN THE SAME TIME! Can you provide me any help ?
Thank’s

]]>
By: ADAM SZCZUROWSKI https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-917597 Thu, 23 May 2024 15:39:05 +0000 https://randomnerdtutorials.com/?p=95718#comment-917597 Hi Sara.
I try to send data from One ESP32 Board to two ESP32
Exactly with your code. The problem is it sends data only for few meters distance.
In longer distance (~20m) I’m getting msg “Delivery Fail”
I use DEVKIT V1.
Could you tell me why?

]]>
By: whispers https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/#comment-875635 Mon, 04 Dec 2023 00:16:19 +0000 https://randomnerdtutorials.com/?p=95718#comment-875635 Great tutorial.. Is it possible to add “auto-peer” stuff to this? Or do you need to connect to a real/live ‘network’ (username/password required) to do such a thing?

Close to this tutorial:
https://randomnerdtutorials.com/esp-now-auto-pairing-esp32-esp8266/

but I dont need any ‘server’
no connect to a wifi/ssid (name/password)..etc (all just local ESP32 devices)

Q: Or do you -have- to connect to a network (name/password) to actually do the auto-pairing stuff in the other tutorial? (I liked everything but dont need server stuff..and no outside network connection…everything local to ESP32 boards) Adding the ‘peers’ to a list was nice so you can loop through or randomly pick one..etc.

In this tutorial.. only thing I dont understand yet is how to dynamically grab these ‘peers’ addresses… and build a list dynamically?

THANKS!

]]>