Hi everyone,
excuse the noob question, but I'm trying to analytically determine the largest error possible using the standard LWIP implementation of SNTP which is included.
For my use-case I will be running an NTP sever on a local machine on a local network. For me it's very important that the delta between what the ESP thinks is the current time and the local machine is _VERY_ small - I don't know how to analytically measure this.
I set up a simple experiment in which two separate ESP32s connect to the NTP server, get the time, and then toggle a GPIO every second.
Looking at the GPIO waveform on a scope, I can se that the error between the two ESPs is fairly small (few ms) - however, I don't know how to measure the error between the ESP32 and the local machine. my local machine is running Ubunto and I don't know how to get a GPIO out of it, and even if I did I don't know what the delay is in terms of toggling a GPIO
How can I determine in this case? Does not sound easy!
Thanks!
SNTP accuracy
-
- Posts: 9770
- Joined: Thu Nov 26, 2015 4:08 am
Re: SNTP accuracy
Nothing noob-ish about that, it's actually a somewhat hard issue... my thought is that perhaps you don't want to get an output from the PC, but you can input data to your PC. Serial ports will have some latency (specifically in the USB-to-serial converter), so you may not want the obvious solution of using the serial channel to feed back data, but how about getting an old computer mouse, opening it up, and letting the GPIO output of the ESP32 short one of the mouse buttons? All you need on the PC side is something that prints out a timestamp when a click occurs. Should give you up to a millisecond of precision.
-
- Posts: 5
- Joined: Fri Jan 14, 2022 2:24 am
Re: SNTP accuracy
Thank you, mouse is a pretty good idea, creative thinking for sure
Another idea I had (in-case anyone ever is in the same spot as me) is to put the NTP server on a raspberry pi since then then it's possible to have close to single CPU cycle (well, close enough) of GPIOs.
I have enough to go and give it a try, will report back what I find in-case anyone else is curious in the future!
Another idea I had (in-case anyone ever is in the same spot as me) is to put the NTP server on a raspberry pi since then then it's possible to have close to single CPU cycle (well, close enough) of GPIOs.
I have enough to go and give it a try, will report back what I find in-case anyone else is curious in the future!
-
- Posts: 94
- Joined: Tue Sep 07, 2021 12:07 pm
Re: SNTP accuracy
I think the esp's default SNTP sync interval is an hour. The clocks could easily drift apart 100ms in an hour.
https://en.wikipedia.org/wiki/Network_T ... ol#History was a fun read.
https://en.wikipedia.org/wiki/Network_T ... ol#History was a fun read.
Craige
Who is online
Users browsing this forum: LiliumJSN and 64 guests