ESPnow trials

If doesn't fit into any other category ....
Post Reply
bugs
Posts: 184
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 85 times
Been thanked: 72 times

ESPnow trials

Post by bugs »

Trying ESPnow for the first time and came across some problems. Searching the forum, found a post by Dompie who also noticed the ESP32 reluctance to always work. I did some tests between two ESP32s, two ESP8266s and one of each with the results ( screendump) showing that ESP8266s can talk to each other but introducing the ESP32 had to specify the MAC address of a receiver. The "FF" represents the broadcast FF:FF:FF:FF:FF receiver address.
The test was carried out with all pairs of modules connected to the wifi router channel so that I could use wlog on each.
The arrows show which direction of communication worked.
ESPNOW.jpg
.

What am I misunderstanding?
You do not have the required permissions to view the files attached to this post.
BeanieBots
Posts: 550
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 313 times
Been thanked: 178 times

Re: ESPnow trials

Post by BeanieBots »

A distant memory about ESPnow when using a ESP32 is that the ESP32 has to be in AP mode for it to work reliably.
Again, just a vague memory but it has something to do with the ESP32 effectively sleeping the WiFi module when not in use. AP mode keeps it active.
My implementation only uses ES8266 devices and is rock solid.
Give AP mode a try and see if things improve.
BeanieBots
Posts: 550
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 313 times
Been thanked: 178 times

Re: ESPnow trials

Post by BeanieBots »

I just checked what I actually have as a setup which has been running non-stop for a few years now.
It's a battery operated ESP8266 sender using ESPnow to send to a SonOff (ESP8266).
The SonOff is a hub which recieves from several devices.
The SonOff then sends the recieved data to a display (AZdelivery wall enclosure with 2.8" TFT + ESP32 + SDcard)
The transmission from SonOff to ESP32 is via UDP. I must have had the same issue you are seeing!
bugs
Posts: 184
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 85 times
Been thanked: 72 times

Re: ESPnow trials

Post by bugs »

I was just about to reply to your previous message this morning when your later one arrived.
I was going to try the AP mode as you suggested. Since then I have tried a pair of ESP32 in both wifi mode 2 and 3 (AP and STA+AP) and neither unit received a transmission from the other when FF:FF used as broadcast address.
I could understand if the ESP32 turned of wifi and so could not receive if in STA mode and not AP.

Anyway, I have spent enough time testing and really need to get on with the job.
I am using ESP8266 (on battery) as remote but need an ESP32 locally in order to save to SD card. So no router/network needed.
I can work around the problem by using a fixed MAC address so will just do that.

I did consider something like your system (last post) but could not justify using two devices locally.
Its raining here so back to programming for a while...

George
BeanieBots
Posts: 550
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 313 times
Been thanked: 178 times

Re: ESPnow trials

Post by BeanieBots »

Whilst having a browse around, I noticed one guy suggested he was using "00:00:..." for 'broadcast'.
Never seen that before but might be worth a try if broadcast solves your problem before giving up completely on that method.
bugs
Posts: 184
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 85 times
Been thanked: 72 times

Re: ESPnow trials

Post by bugs »

I did a quick web search and found some fairly heated arguments about that IP address - mostly above my head.
Tried it anyway and ESP32/Annex treated it as valid single address and gave the ESPNOW error when it was not acknowledged.
I will just put it down to an ESP32 quirk and move on...

My project pair have been working on the bench so next step is to program the remote and carry on fiddling with a TFT screen and HTML indoors.
BeanieBots
Posts: 550
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 313 times
Been thanked: 178 times

Re: ESPnow trials

Post by BeanieBots »

I too saw the "debates" over the address!
Not tried it myself so can't comment. FF:FF... worked for me but IMHO 'broadcast' should only ever be used for testing/configuration.
Imagine if everyone in your neighbourhood was using 'broadcast'. Every device would be perpetually responding and having to filtering out.
Anyway, good luck with your project and please let us know how things work out.
Post Reply