• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP-NOW and maximum peers

Q&A Forum › Category: ESP32 › ESP-NOW and maximum peers
0 Vote Up Vote Down
Michele Barbone asked 5 years ago

Hi guys,

your tutorials are awesome.

I’ve a question about the ESP-NOW protocol and the maximum number of allowed peers.

In my application I have to send just ONE byte from many peers to one single Master.

The Peers does not transmit all together at the same time, so the concurrency is quite low.

I’ve read the documentation and it says that the maximum allowed non encrypted peers is 20.

I’ve used your example with 2 peers and one Master in it works just fine.

My question is:

In the esp_now.h file is defined ESP_NOW_MAX_TOTAL_PEER_NUM    20.

If I change that value, let’s say to 100 and then recompile both Peers board and Master board, this is enough to let 100 peers to communicate to the Master?

What is then the real limit (I suppose the memory) for such type of changing?

Thank you for an answer.

Question Tags: ESP-NOW PEERS
4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Michele.
Honestly I don’t know the answer for your question.
I’ve tested 5 ESP32 boards sending data to one board and it worked fine.
The documentation says that the maximum number of peers is 20.
But, in your case, each sender board only has one peer (the receiver).
So, in theory, the receiver would be able to receive from “infinite” boards as long as they don’t send packets at the same time (this is me guessing, I’m not sure if that’s the case in reality).
I haven’t tested such scenario, so I’m not sure if it will work.
Thanks for following our work.
Regards,
Sara

0 Vote Up Vote Down
Michele Barbone answered 5 years ago

Thank you Sara for your answer.
From what I’ve understood from the code, it seems that the “peer” is the sender.
The reason why I’m saying that is because this chunk of code of the your sender example:

  // Register peer                                
  esp_now_peer_info_t peerInfo;      // Warning for everybody: this variable MUST be publicly reachable !!!!
  memcpy(peerInfo.peer_addr, broadcastAddress, 6);
  peerInfo.channel = 0;  
  peerInfo.encrypt = false;
  
  // Add peer      
  if (esp_now_add_peer(&peerInfo) != ESP_OK){
    Serial.println(“Failed to add peer”);
    return;
  }
So, it seems that the terminlogy “peer” is for the sender. I’m wrong?

 
BTW, as side note, I’ve added also a warning in the code about the peer variable that if not set as public, could cause the error:
“E (1212) ESPNOW: Peer interface is invalid”

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Michelle.
From what I understand, the peer is the receiver (you add the receiver MAC address on the sender code).
The sender only has one peer that is the receiver board. However, I’m not sure if the sender board also becomes a peer of the receiver automatically …
This is what I understand, I might be wrong.
Thanks for telling me about the peer variable.
Regards,
Sara
 
 

0 Vote Up Vote Down
Michele Barbone answered 5 years ago

Hi Sara,
thank you for your answer.
There is a way to get the source code of the esp_now.cpp?
I tried to search it on the disk but not found it.
The only way to be sure is to setup more than 20 senders then….

Regards,
Michele

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.