As always we’re sponsored by https://www.PCBWay.com/?from=atomic. I’ve got some PCBs manufactured for the next video so don’t forget to subscribe.
Time - what’s it’s all about - it’s a mystery. How do we know what time it is? More importantly, how does our computer know what the time it is?
I’ve been messing around with time on the ESP32 and it’s surprisingly easy to get it to talk to an NTP server. And if you’re talking to an NTP server, it’s more than likely that you are getting your time from an atomic clock - pretty amazing!
A few people have asked for clarification on the formulas.
Imagine NTP time is 0:30 and our local clock is 10seconds behind at 0:20
We send a request at 0:20 it takes 1second to reach the server and the server records the request received as 0:31.
The server takes 1 second to process the request so sends its reply at 0:32
It takes 1 second for the reply to reach us so we recorded the receive time as 0:23
If we now apply the formula for theta we have.
0.5 x ((0:31 - 0:21) + (0:32 - 0:23)) = 0.5 x (10+10) = 10
So we have 10 seconds as our offset from the server time.
Applying the formula for delta:
(0:23 - 0:20) - (0:32 - 0:31) = 2
We have a total network delay of 2 seconds.
My transparent OLED display came from DFRobot - https://www.dfrobot.com/product-2521.html You can drive it using the U8G2 library https://github.com/DFRobot/U8g2_Arduino
0:00 A transparent OLED display 0:41 Why is this interesting? 1:08 Are we really talking to an atomic clock? 1:50 The Network Time Protocol 3:51 Let’s see it in action 4:21 Yes! We really are talking to an atomic clock! 4:44 How does it work? 5:24 Can time go backwards? 6:03 Two lines of code! 6:43 Some caveats
If you’d like to help support the channel then I have a Patreon and a KoFi page:
Patreon - https://www.patreon.com/atomic14 KoFi - https://ko-fi.com/atomic14
And if you’re shopping on AliExpress or Amazon then if you click on these links I will get a little bit of affiliate money:
Aliexpress - https://s.click.aliexpress.com/e/_Ac05mF Amazon - https://www.amazon.com/?tag=atomic14-20
You can also join us on Discord here: https://discord.gg/h2DDnDdjD2