Notifications
Clear all

How to calculate the time between the sender and receiver in espnow

4 Posts
4 Users
0 Likes
442 Views
(@abdul)
Member
Joined: 1 year ago
Posts: 14
Topic starter  

I have successfully modified the library for the sender(ESP32 wroom d1) and receiver(ESP8266 nodemcu) with the MPU6050 sending its accelerometer values. I am confused about how to calculate the delay between the data sent and when received


   
Quote
Topic Tags
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2507
 

Posted by: @abdul

I have successfully modified the library for the sender(ESP32 wroom d1) and receiver(ESP8266 nodemcu) with the MPU6050 sending its accelerometer values. I am confused about how to calculate the delay between the data sent and when received

It's kind of hard to answer your question when you don't give us your code. Generally speaking delay times between being sent and retrieved is calculated by subtracting the time sent from the time received.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1653
 

Hi @harri_son,

   Welcome to the forum.

I am sorry, but if you would like some help, I think we will  need a lot more information.

Please post exactly what you are trying to do, and where or how you are confused.

If you are basing it on something on the web, then please provide exact reference.

Thanks and good luck, Dave


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

What kind of accuracy are you needing?  It also might be helpful if you describe why you need to know the send time... if for no other reason, than I'm curious. 😆 I've not used ESPNow, but, I would assume it is obviously on their 2.4GHz WiFi channels.  So I'm guessing that it is an TCP based protocol under the covers.  As such there is latency and there is the chance that the differential is not consistent... especially if resends are necessary at the TCP layer. 

That being said, when I have had need to know the travel time, I usually set up a hand-shaking when they startup so that you synchronize some time base... say based on the micros() call method.  Once you've done that, you can get a time hack when you send the message and send that as part of your packet.  When your receiver gets it, it can take a time hack and get a micro seconds accurate difference.  

Hope this helps.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote