Directly connect 2 ESP Easy's without AP?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
johndoe39274
Normal user
Posts: 14
Joined: 28 Nov 2021, 21:05
Location: Belgium

Directly connect 2 ESP Easy's without AP?

#1 Post by johndoe39274 » 15 Jun 2022, 19:37

Hey,

Is there a way to directly connect 2 ESP Easy's without connecting each of them to a wifi access point? Are there any tutorials available on how to do this?

I'm making a model rocket launch controller, and would like to connect a handheld ESP to a remote ESP in the launcher's base. The controller would have controls to trigger a simple packet and send it to the base. The ESP in the base would check the packet and then trigger a relay that fires the rocket. Obviously this needs to work in the field where there are no wifi access points available.

Also for the transport layer I found the ESPEasy P2P Networking plugin (https://espeasy.readthedocs.io/en/lates ... /C013.html) which sounds like it fits the bill. Unfortunately the documentation is a bit sparse. Would there be any tutorials available that show how to set this up?

Thanks in advance!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Directly connect 2 ESP Easy's without AP?

#2 Post by TD-er » 15 Jun 2022, 21:29

The p2p protocol still needs a network layer, thus being connected to an access point.

I am working (still...) on implementing a p2p layer using ESP-NOW, which is probably what you would need to have.
But so far it is not yet merged as I keep running into issues regarding the WiFi radio (ESP-NOW uses the WiFi radio to perform the p2p communication of very short packets directly between nodes)

johndoe39274
Normal user
Posts: 14
Joined: 28 Nov 2021, 21:05
Location: Belgium

Re: Directly connect 2 ESP Easy's without AP?

#3 Post by johndoe39274 » 17 Jun 2022, 13:11

Ok thanks for the info. No worries, ESPeasy can't do everything and there is already so much it does well!

Thanks for the pointer to ESP-NOW. I managed to get two-way communications working based on this tutorial: https://randomnerdtutorials.com/esp-now ... ion-esp32/

What kind of issues are your running into with ESP-NOW and the wifi radios?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Directly connect 2 ESP Easy's without AP?

#4 Post by TD-er » 17 Jun 2022, 20:54

The main issues I'm having is to combine WiFi and ESP-NOW as you still want one of the nodes act as a gateway.

Also in the STA mode, you can't set the channel, as that's determined by the access point (AP).
So in order to get ESP-NOW working reliable, you must communicate via the AP mode of the radio.
For this you need to set the channel, but you can't work on 2 channels at the same time.
The gateway node must therefore connect to the AP in STA mode and this determines the channel.
Then the gateway node must also tell the rest of the nodes in the mesh which channel will be used.

So far so good and all makes perfect sense.

Now the reality.

If another ESP-now peer was once added, the ESP does keep track of the channel it was seen on.
But this does cause some issues since it does happen every now and then that a node trying to communicate on channel 2 is heard by another node while it is set to operate on channel 1.
Not entirely sure why this does happen, but it does.
So it might happen that the gateway node is hopping between channels which makes the connection very unstable for all.

Another issue is that the get channel function on at least the ESP32 is not always returning the actual channel.
This is for sure a bug somewhere, but no idea where.
What I do know is that this appears to be happening after a WiFi scan.
So the following use case will for sure lead to issues:
- ESP32 node tries to connect to a known AP, but cannot find it
- ESP32 node then switches to ESP-NOW only mode pinging around for its peers on various channels
- ESP32 node does see a peer on some channel, but since we're not entirely sure the other peer is at the same channel, we exchange some packets to tell each other what channel we're using.

Even this may lead to issues like:
- Both nodes agree on using channel X, but since one of them has once seen the other on another channel, the ESP-NOW core code may still use that channel even though channel X is set.
- One of the nodes was sending on channel Y, but thinks it was on channel X and thus tells the other peer it is on channel X. Both are happy and continue using the wrong channel and thus continuously hop between channels hurting performance.

There are more issues, but those mainly apply when using multiple nodes in a self organizing mesh I'm working on.

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests