Use ESP NOW to transfer a sensor value between two ESPs in blynk

Hi, I want to send an int value from ESP 8266 to ESP 32 using the ESP NOW protocol.
But when I use this protocol (ESP NOW) in blynk I can not find any value

This is my ESP 32 code
blynk_iot_cloud_v2.ino - Pastebin.com

This is my ESP 8266code

I can not access the variable sent by ESP 8266 when I use BLYNK
I’m sure my ESP NOW protocol is working properly because when I use the following code in ESP 32 everything is fine

Note: I can send commands from ESP 32 to ESP 8266 with this protocol. But I can not do the contrary
Note: If you want to test the code, change the MAC address and BLYNK_TEMPLATE_ID

ESP code 32 without using Blink which works properly (ESPNOW protocol only)

You can try Node-RED which is more advanced way

1 Like

For information, I never download code from websites that don’t allow the code to be previewed beforehand.
I’d suggest you use GitHub or PasteBin.

Pete.

3 Likes

I must use this protocol for something

I corrected the links.Sorry

This has to be at the very beginning of your code…

#define BLYNK_TEMPLATE_ID "TMPLADtP2oUc"
#define BLYNK_DEVICE_NAME "SZA room blynk"

But, I don’t think that will fix your problem (although that’s difficult to say, as you haven’t shared any other info).

I don’t think you can run ESP NOW and Blynk simultaneously.

Pete.

1 Like

Thank you. I basically want to set up a ds18b20 temperature sensor.
Read its value with ESP 8266. Transfer it to my ESP 32 with the ESPNOW protocol.
And display it on BLYNK

Do i understand you correctly as you:

  1. You CAN - Send from ESP32 to ESP8266 OK. And this ESP8266 can also communicate over WiFi with Blynk at the same time. In same sketch.

  2. You CANNOT - send from ESP8266 to ESP32 when this ESP also is using WiFi to communicate with Blynk at the same time.

if so,
Q: Can you send to ESP8266 to ESP32 OK when you are NOT using Wifi to communicate with Blynk at the same time?

Why I ask?

  • It is not “just like that” to use ESP-Now and Wifi in same sketch and communicate at the same time with ESP8266 and ESP32.
    It is possible - but it requires a few tricks.

In my systems I have ESP32’s receiving on ESP-Now from ESP32 and ESP8266 as well as communicating with Blynk over Wifi. I also have ESP8266’s receiving on ESP-Now from ESP32 and ESP8266 as well as communicating with Blynk over Wifi.

I have published a solution on GitHib. This solution is not communicating with Blynk (in this example) but it communicates over WiFi.

- If interested, you could have a look and try to understand the tricks to use to get it working.

Link to GitHub: https://github.com/jonasbystrom/ESP-Now-Sensor-system-with-WiFi

// I only RECEIVE on ESP-Now on the device also using WiFi. I have never tried to also SEND on ESP-Now on same device using WiFi. Maybe this requires even more tricks. I don’t know.

1 Like

I see this new after my previous replay above.

My github code is designed for this case. You have to add the Blynk code but it should not be a problem.

1 Like

Can you explain more about your setup, why you need to use ESP NOW, and why two devices are used rather than one?

Pete.

1 Like

Because the free panel can’t add more than two divais.
I want to connect multiple divas using the esp now protocol.
Note: If I add two divais, I can’t control them in one panel and I have to use two panels. And this is difficult for the user (come out of a panel and go to the next panel and …)

Currently, I can use this protocol to send information to other divas. (Send from esp32 to esp8266) but I can’t get information from other divais(Send from esp8266 to esp32 not done)

hello. Unfortunately, I can’t work with your code. :man_facepalming:t2: Do you have a training video of your code?
(I’m weak in English, I don’t understand some of your explanations, sorry )
Thank you. :white_heart:

I’d suggest starting with a very basic sketch first to make sure it’s working.

1 Like

This article might help you

If you mean the espnow protocol, I did it, and this protech alone has no problems.
Note: I also put the code above for you

The simplest way is to use the HTTP(S) API to send data from multiple “slave” devices to one “master” device.

Example sketch for ESP32…

Example Sketch for ESP8266…

Obviously, in your situation your “slave” devices wouldn’t have any Blynk code or libraries in them, they’d just establish a WiFi connection then use the API to send data to Blynk.

Pete.

3 Likes

yes. Your explanation is absolutely correct. I’ll check now.
I had worked with https protocol in an example, and I had a problem with the system being very slow.
I hope I can solve this problem with your explanations.
Thank you. :white_heart:

The HTTPS protocol is slower when you create the connection each time you want to write data, but HTTP is quite quick, as you’ll see if you read the topic in full.

Pete.

1 Like

Thank you.