Preliminary queries on using ESP NOW

Hello,
I am looking for advise on whether this is doable.
I am planning to use the ESP NOW, to connect about 50 sensors to a dashboard. Each of the sensors will be having a ESP32. Also the dashboard will be a ESP32 as a receiver.
Each of the sensor nodes would be about 20mtrs apart in a square grid. The sensors would transmit randomly without any synchronization. The data per sensor would be in time periods of about 5secs.
So my doubts are :
A) Is this a feasible idea with ESP NOW ?
B) Does ESP NOW handle data collisions

esp_err_t result = esp_now_send(broadcastAddress, (const uint8_t *)m......
if (result == ESP_OK) {
Serial.println("Sent with success");
}
else {
Serial.println("Error sending the data");
}

Is the above a way of detecting collisions ?

TIA

make it easy:
let the "master" ask each "sensor node" and you have avoided any collision by design.
the master could ask one node by node every 100ms ... which will wraparound every 5 seconds.

Messages are sent to a target MAC address, or the special all-0xFF address as a broadcast to everyone (on the channel). But these addresses, including broadcast, must also be registered as a peer. The maximum number of paired peers at a given time is 20. There are functions to remove a peer, but I don't know how well it handles churn if you want to cycle through 50 (or 31) of them.

esp_now_send can return a failure code, but you also need to register for the send callback to see if the message was actually received.

Thank you for the replies !
The maximum [number of paired peers] at a given time is 20.
I did not know they have to be paired. I was watching this :

I thought that if you know the MAC id of the receiver the data will be received.Thanks for the heads up.
I can split the number of sensors into groups less than 20, and have a separate master for each group. That should help I guess.
esp_now_send can return a failure code, but you also need to register for the send callback to see if the message was actually received.
The send callback would be sent by the receiver node ? Can you post a link for this ?
I am just getting started and I will do my own work, but just some pointers should help... :slight_smile:
TIA

could you use ESP-MESH

Imho not necessary.
Master sends a (broadcast) message with the node ID he wants
only that node with that ID responds (with another broadcast).

Not sure about the actual mechanics, but it happens automatically. You register a callback function on the sender. If the esp_now_send returns ESP_OK, then it should get called, perhaps many milliseconds later, with the result: either success or fail. As I recall, it will be on the other core. Not the main "app" core, but the other "protocol" core which runs the WiFi stack.

Hello,
I did some preliminary trials with a ESP32 and ESPNOW. I am getting a range of 15~20 mtrs , LOS. Does that sound right ?
For what I was looking for, at least about 100mtrs is desired.
Would appreciate any suggestions !

if the individual ESP32s are within 20mtrs of each other ESP-MESH could be the answer

Thank you for the idea. I will read up on it.
But I cannot say that for sure. I would be more comfortable with at least 50mtrs between 2 nodes, as they could be placed randomly.

Not really. ESP-NOW should work further then IP based protocols.

Blockquote Not really. ESP-NOW should work further then IP based protocols.

Ok let me work on it... Any pointers would be appreciated as well :slight_smile:
Does Long Range ESP32 work with ESP-NOW ?
I just read your post about using broadcast, it got subsumed in all the messages. Great idea, should work for me , Thank you !

I didn't get a fast success with ESP Now Long Range so I have abandoned this idea.
But do your own testing: How To Enable ESP NOW Long Range Mode in Arduino - ESP32 Forum

can you post a drawing how you have placed your ESP including the distances between these ESPs? How does the Grid look like? Where is the master?

What kind of sensor data do you want to transmit? a 16bit integer, a float, several values?!?

But do your own testing: How To Enable ESP NOW Long Range Mode in Arduino - ESP32 Forum

Thanks for the link. They are using library : #include <esp_wifi.h>
I dont know if it is applicable for ESP NOW as well. It compiles fine. I dont have access to my modules for a couple of days, so I will test and post if the is any improvement.

Can you post a drawing how you have placed your ESP including the distances between these ESPs?

For testing I used only 2 ESP32 in LOS in a corridor about 15mts long.

What kind of sensor data do you want to transmit? a 16bit integer, a float, several values?!?

It will be about 20bytes of data, should be integers mostly pertaining to some machine parameters.

Meanwhile I am modifying my ESP32 modules by swapping out the WROOM-32 to WROOM-32U which has provision for external antenna. The pinouts seem to be the same, so hopefully it should work.

@noiasca
I did some further trials with WROOM-32U and external antenna : Antenna
I was able to get 100mtr LOS with zero packet loss. The sender was broadcasting packets every 500mS. Only one receiver was used. I will try the concept with maybe about 10 nodes in the network eventually.

that sounds much more like what I would have awaited from ESP-NOW.

Can you place all nodes within this 100 m radius to the master?

Its still line of sight though. So I would have to probably mount the units so that they can see each other. 100mtrs is quite good enough.
Any thoughts on using LoRa or nRF24 modules for this use case?

You might not fit to the airtime limits of LoRa when you send every 5 seconds 20 bytes.

When ESP Now works - use it.

You told nearly nothing about your usecase so far.
You have not provided a schematic/overview of the placement of your nodes and the master.
You have not described why you need 50 separate nodes at all.

2.4Ghz LoRa would work for sure, that will go long distances. Several kilometers at high data rates if you have LOS, 80km + at low data rates if you have LOS.

And since its 2.4Ghz, no duty cycle issues.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.