Monday, 1 October 2018

Am I barking up the wrong tree?

After a successful test of painlessMesh at the weekend I posted about it on the ESP8266 Facebook group and somebody wondered if I'd considered ESP-NOW.

Which I may have seen mentioned a couple of years ago but have never fiddled with and completely forgotten.

While painlessMesh is doing what I want I have in the back of my mind that it's layering heavyweight stuff together (AP associations, WPA2 encryption, TCP servers, NTP-like time sync) to give you a simple messaging protocol.

Despite my assertion I didn't want to get sucked into writing my own networking code I had actually been Googling to see if you could send/receive packets directly between ESP8266 stations without actually associating with an AP at all. Most of the chatter about that is building antisocial Wi-Fi de-auther devices, and it didn't look a very fruitful route.

Of course this is exactly what ESP-NOW is. It's a proprietary messaging protocol that's part of the Espressif suite of dev tools for the ESP8266/32. It leverages standards compliant 'vendor action frames' which allow vendors to send frames directly between stations for their own proprietary reasons.

As this is very low level ESP-NOW supports star networks with 20 nodes, rather than the 5 nodes of the full WPA2 encrypted IP connection that painlessMesh is built on. So a very similar 'star of stars' mesh built out of ESP-NOW connections should scale more gracefully. It also leaves some resource for a conventional IP device to bridge in to the mesh and talk to it. It is unencypted by default but you can switch this on and it lowers the capacity to 10 nodes.

As painlessMesh seems to handle scaling quite well, I'm more interested in the greater power efficiency and range promised by ESP-NOW.

If you've ever noticed you can see a Wi-Fi SSID way outside the range you can make useful connections to it, that's the kind of range ESP-NOW promises. It's not doing all the encryption, background keepalive and management work needed for a full AP association, so it's much more tolerant and fewer packets means less power.

Digging deeper there is also ESP-MESH in the dev tools which the documentation promises is a self organising mesh built out of ESP-NOW connections.

Why have I not noticed these protocols before?

The answer seems to be nobody in the 'maker' community bothers with either ESP-NOW or ESP-MESH. I've found a handful of people talking about it but very much proof of concept builds of the example code, no mention of big mesh projects. I guess the IoT spin that's put on the ESP product lines has meant the non-IP protocol suite is mostly ignored.

As this is all changeable in the code I'm going to continue working with painlessMesh, build the rest of my static nodes and start on the wearable GPS-equipped nodes. This will allow me to conduct a bigger test including them at the end of October. If I subsequently find a way to drop in ESP-MESH or engineer my own thing with ESP-NOW it'll be a 'range upgrade'.

No comments:

Post a Comment