Close

08/02/19 - First two-way communication Success!

A project log for My attempt at an ESP-NOW Mesh

Designing a custom mesh for sensors, home automation and remote controlling using Espressif's ESP-NOW

david-mDavid M. 08/02/2019 at 21:220 Comments

In my pursuit to find the two-way communication solution, I have made three posts on the most applicable forums I could find. 

https://arduino.stackexchange.com/questions/67621/esp-now-master-and-slave-at-the-same-time

https://esp32.com/viewtopic.php?f=19&t=11752

https://esp32.com/viewtopic.php?f=13&t=11765

I have also read through the ESP-NOW API reference to check if I have missed something from my view.

https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/network/esp_now.html

A little bit more digging around, I found a few pages indicating that two-way communication is indeed possible:

https://www.esp8266.com/viewtopic.php?t=10647

https://hackaday.io/project/164132-hello-world-for-esp-now/log/160570-esp-now-introduction

https://github.com/espressif/esp-idf/issues/1461

Update! For some reason, I turn on the same exact modules I programmed yesterday which didn't work no matter how I tried, now work first try. The problem must be in how I structure my code, and the timings of function execution. I hope I will find the issue which caused it.

Anyway, now that it works, let's take a look at how it functions:

Fig. 24 - Two-way communication between Node A and Node B. Captured with Five Wire.

After the nodes discover each other using the ScanForSlave function, Node A sends out the first packet in my case, containing a 0x00 (Green pin). After some time, Node B receives it (Light-blue pin), and right after, Node A gets a confirmation message that it has indeed been received (Pink pin). Also, right after receiving the 0x00, Node B increments it to 0x01 and sends it back (Brown pin). After some time, Node A receives the 0x01, after which it also increments it by one and sends it back.

This is how my two-way communication works for now. What I wonder about is whether it would be possible to transmit and receive packets at the same time by taking the advantage of using different channels, but I'm not exactly sure if that is possible at all on such a device.

Discussions