Uploaded June 2022 | Updated November 2026, 20 hours ago
As always we're sponsored by 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 - dfrobot.com/product-2521.html You can drive it using the U8G2 library 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 - patreon.com/atomic14
KoFi - 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 - amazon.com/?tag=atomic14-20
You can also join us on Discord here: discord.gg/h2DDnDdjD2
As always we're sponsored by 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 - dfrobot.com/product-2521.html You can drive it using the U8G2 library 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 - patreon.com/atomic14
KoFi - 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 - amazon.com/?tag=atomic14-20
You can also join us on Discord here: discord.gg/h2DDnDdjD2
![ESP32 Deep Sleep: Ultra-Low Power Coprocessor
Were taking an even deeper loop into deep sleep in this video. As always, big thanks to PCBWay for sponsoring this video - check them out at https://www.PCBWay.com/?from=atomic.
Were following on the previous deep sleep deep dive video (https://youtu.be/YOjgZUg_skU) and taking a look at the Ultra Low Power (ULP) coprocessor.
The ULP coprocessor is a really interesting part of the ESP32 device. Its a really powerful additional processor that can run even when the main device is in deep sleep.
I had to learn how to use this to get deep sleep working well in my DIY e-Reader project (https://youtu.be/VLiCgB0odOQ).
There is a plugin for the Arduino IDE that will add support for the ULP assembler - https://github.com/duff2013/ulptool and theres also a C compiler that will generate ULP assembly code - https://github.com/jasonful/lcc
[0:00] Why are we here?
[1:14] What are we doing in this video?
[2:14] What is this ULP thing anyway?
[3:00] The ULP instruction set
[6:30] How to use it with PlatformIO
[8:50] How to use it with the Arduino IDE
[9:13] Waking up the main processors
[10:13] Reading GPIO pins from the ULP
[13:00] Sharing data between the ULP coprocessor and the main processors
[14:02] Writing to GPIO pins - Blink on the ULP
GitHub repo with the code is here: https://github.com/atomic14/esp32-ulp
Thanks for watching - Ill see you in the next video!
Patreon: https://www.patreon.com/atomic14
ko-fi: https://ko-fi.com/atomic14 ESP32 Deep Sleep: Ultra-Low Power Coprocessor](https://i.ytimg.com/vi/KQS_xDDWfLw/mqdefault.jpg)









