Page 1 of 1

ESP32 mesh with manual scanning and no Router

Posted: Thu Dec 31, 2020 9:29 am
by Magnetuz
Hello. I am trying to set up a manual scaning mesh network with no Router. The idea is the node will scan for a mesh network and in case none is found, it will set itself as the root node. And in case the node finds a mesh notwork, it will connect to it and become a normal node.

I am using 2 Esp32 devices and basically what I did until now was to use the Mesh Manual Networking Example [https://github.com/espressif/esp-idf/bl ... esh_main.c] for the root device and a modified version for the node device (with an empty router ssid so the node will not connect to any router).

I expected the node device to scan, find the mesh network (softAP) and connect to it, but what happens is that the node is just scanning "normal wifi" networks and the mesh network is not listed in the scan results.

Is it possible to manually scan the softAPs from other Esp32 devices?

PS.: I did the same test using the Mesh Internal Communication Example [https://github.com/espressif/esp-idf/tr ... munication] and it works. However this example uses the auto scan.

Re: ESP32 mesh with manual scanning and no Router

Posted: Sat Oct 19, 2024 1:51 pm
by gpylgr
Hi there,
Have you succeeded in establishing a mesh network without the router and a node establishing itself as root node?
I have been trying to do this as well without success.

Re: ESP32 mesh with manual scanning and no Router

Posted: Mon Sep 15, 2025 2:17 pm
by Magnetuz
Hi @gpylgr

Somehow yes, but a bit of a ugly solution as workaround.

You need to:
1 - Setup manual scanning;
2 - After some scan rounds without finding the router, you need to force the esp32 as a root node (there are some examples on the idf github of manual mesh networking);
3 - When the router comes back online, you need to remove the forced state by setting the esp32 as back an IDLE node;
4 - If it might happen that multiple esp32 are powered up at the same time, they will not assemble a mesh, but multiple "forced roots". To workaround this, you can use the esp-now as a beacon:
4a - implement some unique priority value generation algorithm;
4b - on the state "forced root without a router (item 2)", broadcast a esp-now message with the unique value each N seconds;
4c - upon receiving such esp-now message, the esp32 must check the received priority with its own value. In case it is lower, the esp32 must reboot (after reboot it will find the root node parent and connect to it). In case it is higher, the esp32 broadcast a esp-now message.

This should be enough to have it working.

Live and code.