ESP NOW and Wi-Fi - using ESP-8266

Hello everyone! Hope you're well!

I was developing a project where I need to set a point2point network based on ESP-8266, on which, many ESP-8266 (using ESP-NOW protocol) will collect and send data from one to another untill it gets to the final one, where the data will be uploaded to a Google Sheets file, via Wi-Fi (thanks to IFTTT services).

So, as you may know to this point, ESP-NOW doesn't work simultaneously with Wi-Fi (at least, not easily), although, this is not a problem to me, since I don't need them to work at the same time.

This, because in my final ESP-8266, the one that receives all my data to upload it to the Google Sheets file, all I need to do is to activate/deactivate ESP-NOW or Wi-Fi according to what I need, which will go as shown below:

  1. Turn on ESP-NOW in my final board.
  2. Via ESP-NOW, I receive the data collected throughout the other circuits.
  3. Turn off ESP-NOW.
  4. Turn on Wi-Fi connection and connect to my Wi-Fi router.
  5. Upload the data using amn IFTTT service.
  6. Turn off Wi-Fi connection.
  7. Repeat.

And naturally, I know the documentation to activate the ESP-NOW and the Wi-fi connections, but don't know the ones to deactivate them (except for Wifi.disconnect(), but honestly, I don't know if that will work for me). I would thank a lot if you could grant them to me, or at least, tell me a more effective way to do it.

Another outcome for this situation I was thinking about, was to use a pair of ESP-8266 as the "final receiver", one that gets the data collected via ESP-NOW and sends it via wire to the second one (via RX and TX pins of the board), which will finally upload it to the Google Sheets file, but I don't now if there's a way to do such thing (i.e., send data through the ESP-8266 pins).

Anyway, I would appreciate any advice regarding this topic!

that is a simple software-serial-connection
There is a library softwareserial which can do that.

best regards Stefan

1 Like

I'll check it out. I would like it to work this way in the pair of ESP-8266 (let's say ESP-1 and ESP-2) at the end of my system:

  1. Via ESP-NOW, ESP-1 receives the data collected throughout the other circuits.
  2. Create and set my variable to be sent (a JSON Object, if I'm not mistaken).
  3. "Serialize" my variable.
  4. Send it to ESP-2 through TX pin.
  5. "Deserialize" my variable.
  6. Upload the data via Wi-Fi.

a JSON-object sound like it will be several hundred or even thousand bytes.
This is doable but it might need sending the data in several chunks or to increase the receive-buffer of the ESP-2 that the receive-buffer can hold the whole content.

Serial sends the data bytewise. There might be some details to tweak but I guess this kind of tweaking is pretty interesting to the advanced users here.

So if you encounter a problem just post it here.

best regards Stefan

1 Like

Well, actually my variable is a struct message (consists of 5 integers and the time it gets from a RTC module), but I said it was a JSON by mistake, sorry about that.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.