#67 Exact Time without RTC Module for the ESP8266: NTP Time

  Рет қаралды 96,533

Andreas Spiess

Andreas Spiess

Күн бұрын

Пікірлер: 392
@Ed19601
@Ed19601 8 жыл бұрын
The Swiss and time keeping... always a good combination ;-)
@SuperNathanTube
@SuperNathanTube 7 жыл бұрын
Andreas... kudos to your clear and nice explanation of the NTP stuff. Even complex topics look simple at the hands of experts ...Thanks !!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
You are welcome!
@Ed19601
@Ed19601 5 жыл бұрын
two years later and i finally needed this. Works swell, easy to use. Tnx
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome!
@FredrikOhlsson70
@FredrikOhlsson70 8 жыл бұрын
It is always so awesome to follow your videos and solve problems I have with my sketches :D
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
That is the intention.... I also learned and learn a lot with youtube.
@tanguasimtu5823
@tanguasimtu5823 2 жыл бұрын
This is an old video… But since I am a bit slow and have just started playing with the ESP8266 :-) this is still very useful… I am also playing with MQTT… On Linux I have a process which is subscribed to everything… using it to log status… right now I’m only turning the 8266 led on and off… I plans to have a dedicated 8266 with ntp… on MQTT subscribing to a topic getDate when it gets a message it will publish on the topic ntpDate…. The 8266 when told to turn the led on or off will also publish to getDate the response from the 8266 with ntp will respond and the process subscribed to all will see the led topic the getDate topic and the ntpDate … so I know when it happened… the mosquito command subscribing to all has its output appending to a status.txt file… thank you so much for your videos… I find them interesting, informative, clearly explained, and paced correctly.
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
You find many videos on MQTT, particularly on the Raspberry Pi on this channel.
@underwoodblog
@underwoodblog 7 жыл бұрын
I have tested the library yesterday and it works fine. Great work!!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
:-)
@johnhart6320
@johnhart6320 7 жыл бұрын
Awesome!! I have been working on a clock/temp combo and am adding this to my project. Your clock and a Wunderground API for local temp and this will be a MASTERPIECE. Have it displayed on an 8 digit Max7219 LCD wrapped up by a cool little Lego case. And for the icing on the cake, a RGB NeoPixel ring acting as a halo of sorts to light it all up. Thank You Again Andreas!!!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Sounds great!
@btcsys
@btcsys 5 жыл бұрын
John Hart Would you mind sharing the final code? Btw thank you Andreas
@mikeberger4276
@mikeberger4276 7 жыл бұрын
Thanks for this easy to use library and the video with the explanation. Works perfect for me. I have been looking for something like this for quite some time. Great stuff!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
You are welcome!
@gruneranfanger6947
@gruneranfanger6947 8 жыл бұрын
Gute Arbeit, Andreas. Fundiert, strukuriert, TOPP.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Danke!
@alejandrosantiago6080
@alejandrosantiago6080 6 жыл бұрын
Hi, Andreas, I install the libray and its working properly, thanks for the good work! Chers, form México. -Alex.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You are welcome!
@colfaxschuyler3675
@colfaxschuyler3675 8 жыл бұрын
Another great video. I knew about epoch time, I wasn't aware that UTC counted from 1/1/1900...
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Marc Visconte For me, it was the same. That was one of the reasons to give you some background...
@santiagovelezflorez1634
@santiagovelezflorez1634 4 жыл бұрын
Maestro muchas gracias, me funciono perfectamente, eres muy habilidoso profesor Andreas.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Glad it worked!
@christyinnovations
@christyinnovations 8 жыл бұрын
Well played sir. Very helpful. I have often thought of trying to create a library, this is another nudge
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Bob Christy (christyinnovations) This was my first library. I maybe make once a video on how to do it.
@jutiubi
@jutiubi 6 жыл бұрын
Andreas, I wish to thank you for what you are doing.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You are welcome!
@XerotoLabs
@XerotoLabs 8 жыл бұрын
what a great tool . very handy . ( as i look at my lonely RTC module that has not had a job since it arrived other than providing some small bit of extra ram LOL )
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
The last usage of my RTC was when I did my Nextion video. The "fish tank" example requested an RTC. So, I had to wire it up...
@nicklaspersson4687
@nicklaspersson4687 8 жыл бұрын
Great episode. Very useful stuff. Thanks for your great efforts.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
You're welcome. I am always glad if something is useful...
@norberthartmann5075
@norberthartmann5075 8 жыл бұрын
SUPER SACHE !! genau das was ich für den ESP8266 noch gesucht habe besten dank und weiter so !!!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Du kannst auch meine zweite Library nehmen. Die verwendet zusätzlich auch die interne (ungenaue) RTC. Aber sie muss nicht jedesmal aufs Netzwerk warten. github.com/SensorsIot/SNTPtime/
@norberthartmann5075
@norberthartmann5075 8 жыл бұрын
(y) habe sofort nachgesehen und runtergeladen, war gerade dabei im demo NTPtimeESP-sketsch die strings fürs display zu basteln :-)... ok, jetzt muss ich schauen was ich als standart nutze, oder warte auf dein nächstes filmchen.. hoffe das ganze funktioniert auch im nachfolger für den esp2866 ;-) Danke und happy hacking wirklich saubere arbeit !! Ps.: kann der status sommerzeit / winterzeit nicht auch noch zurückgegeben werden? oder habe ich was übersehen?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Norbert Hartmann von wem zurückgegeben? NTP Server können das nicht. Und die Library passt einfach die Zeit dementsprechend an.
@norberthartmann5075
@norberthartmann5075 8 жыл бұрын
an den nutzenden sketsch, dann kann man den status zb. im display darstellen.. ( oder ich sehe nicht wie sonst...)
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Kannst du sicher machen. Ich war einfach an der richtigen Zeit interessiert...
@pagutierrezn
@pagutierrezn 8 жыл бұрын
Thanks Andreas, your videos are great: polished, entertaining, accurate and always useful. I tried to run this one and I found a funny problem, may be others have found it too, but I didn't find any one commenting about it. I work in Linux, and I assume you're compiling in Windows, because in the NTPtimeESP library, you include "WiFiUDP.h" that my Arduino IDE couldn't find until I renamed it to "WiFiUdp.h"
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Thanks for the tip!
@plasticmirror
@plasticmirror 5 жыл бұрын
The example sketch outputs this strange date: 2036-2-7-5 7H 28M 16S. I think something is wrong with the lib.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Maybe. This is and old video. There is a built-in version available now. ( kzbin.info/www/bejne/nWeVcqerm5aWo5Y )
@jan5260
@jan5260 5 жыл бұрын
Andreas you are the best!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
:-)
@WhiteLion1337
@WhiteLion1337 5 жыл бұрын
Hallo aus Deutschland lieber Andreas! I have a question: My PIR sensor wakes up the ESP-12 from deepsleep very frequently, then connects to WiFi and MQTT. Because it runs on batteries I want to avoid the power eating connection process. It should connect only every 5 minues. My idea is to to measure the deepsleep timespan to do some calculations and get the time of the last wakeups and send the sensor to deepsleep it < 5 minutes. My Problem: How can I measure the time between weakups (deepsleep time) without connecting to Wifi like timeserver ? Danke für deine Hilfe im Voraus!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
I do not think the ESP32 does something during deepsleep. Maybe you have a look at my ULP video?
@WhiteLion1337
@WhiteLion1337 5 жыл бұрын
@@AndreasSpiess thank you for the fast answer. ESP32 could be a solution but I prefer to use Esp-12 since i have so many of them. I ll try RTC Module before switching to esp32.
@Marco-in3yk
@Marco-in3yk 4 жыл бұрын
Thank you so much for your work, I was just about to solder an RTC to my circuit!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Glad I could help
@AgeAqua
@AgeAqua 8 жыл бұрын
Something that I can use for my projects, thank you. Well done!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
You are welcome. Look also at video #71. There, you find another library to get the NTP time.
@JerryEricsson
@JerryEricsson 8 жыл бұрын
Very nice indneed! I have been playing with setting up a clock/temp display for our Motor Home (Now on injury list since last nights massive HAIL storm!) This appears to be a good way to go, I have a rtc mod as well but have only played with it, never set it to go full time. My question is, though, if I set this up, and set it to retreive the time, what will happen when we happen to be in some place where I cannot get web access? I have a small travel router set up in the unit so when ever I detect internet, I connect with the router so we always have the same network name and password, but for those days when I cannot get regular internet because we are parked somewhere in the Mohave Desert of Arizona, will the system go bonkers if it fails to get an update? I haven't looked at the code yet, perhaps the answer is there someplace so I can simply put it to check every tuesday evening at 7:00 PM and I can turn on my Verizon Jetpack at that time or something.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
If you watch my video of this evening you will see such a possibility. I present a small library where you can use the timer of the ESP while not connected to the internet. But if your device loses power, it also looses time and it is not very precise. So, for your case I wold spend an extra dollar for a RTC module and do exactly what you describe: Every few hours check the availability of Wi-Fi and if available, adjust the time of the RTC module. This has the advantage that you do not need any buttons to initially adjust the time.
@pascalmauger7521
@pascalmauger7521 2 жыл бұрын
Many Thanks for the library and example.
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
You are welcome!
@sdgelectronics
@sdgelectronics 7 жыл бұрын
Thanks Andreas for the info. Just trying out the ESP12E....
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Enjoy!
@WimC56
@WimC56 4 жыл бұрын
And of course it can be used on Arduino too, if Arduino is connected to the internet. Great stuff.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Maybe. I never tried to connect an Arduino to the internet.
@KennethScharf
@KennethScharf 8 жыл бұрын
The epoh problem has already been solved. The variable time_t has been extended to 64 bits, and this is large enough to last past the expected end of the universe, or at least our solar system!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Thanks for the info!
@plasticmirror
@plasticmirror 6 жыл бұрын
Thank god youtube provides the possibility to speed up the video :D anyway.. thank you for the library and the useful information arround it! Very nice and well thought work!
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
:-)
@ritaschulz917
@ritaschulz917 4 жыл бұрын
Danke, das hat mir heute sehr geholfen!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Bitte. Gern geschehen.
@edipkakmak
@edipkakmak 7 жыл бұрын
Andreas. I am so happy i found your channel some years ago. Great help. How do you get the time to do all these great videos. Amazing
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks. As everybody else, I have my 24h a day. If it is not enough, there is still the night and the weekend ;-)
@oraszuletik
@oraszuletik 4 жыл бұрын
Thank you so much! Exactly what I needed and also, very elegant code.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Great to hear!
@jessehtrevino
@jessehtrevino 4 жыл бұрын
Thank you! I'm using this in a project that activates a relay once a day... AWESOME code, works seamlessly. However, I ran into the problem that it displays as 12hr time so 08:00 happens twice a day when I really only want it at 20:00 (or 08:00 PM). Is it possible to change this from 12hr to 24hr time? Thanks for the videos! long time fan!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Unfortunately I do no more remember the video. But i nearly cannot believe it uses 12 hours display.
@jessehtrevino
@jessehtrevino 4 жыл бұрын
Andreas Spiess ok, thank you for the response anyway!
@G6EJD
@G6EJD 8 жыл бұрын
There is also an in-built time NTP library for the ESP8266, to use it do this:#include time_t now = time(nullptr); Serial.println(ctime(&now));
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Yes, you are right. I used it im video #71. It seems to use SNTP. But it works ok and with time() you do not need to call the server too often.
@guidovlaere
@guidovlaere 7 жыл бұрын
Dear Andreas, thanks for this nice program and good library! It worked perfect without any problem! 😀 Maybe it is a stupid question, but I would like to use this program on the ESP8266 as a RTC for my arduino... But I don't know how to do. Do you have a suggestion where to find information how to do? If it is possible to use it as an Arduino RTC it would be perfect! Never have wrong time! Thanks again for the tutorial and for your help. With regards, Guido (from the Netherlands)
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
You can connect the two through a Serial connection and write a small communication protocol. I do not think, that this is a common scenario as most of the people who use ESPs do not use an Arduino in addition.
@pritchs7889
@pritchs7889 2 жыл бұрын
Enjoyed your video! Thanks for making it,
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
My pleasure!
@nubin.stanley
@nubin.stanley 7 жыл бұрын
First of all, thanks for the library. :) The only problem I found with it was that I had to make a blocking call. So, my UI/Touch interface gets stuck. I had made some changes to your library and have posted it in the github page. Please do take a look at it when you get time.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks for your contribution. I answered you an Github.
@nubin.stanley
@nubin.stanley 7 жыл бұрын
Have raised the pull request. :)
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Implemented
@dmaraptor
@dmaraptor 5 жыл бұрын
Yes, it is clear how to get time from NTP. But what about internal clock that will store (and update of course) current time between NTP time requests. What if internet has gone for hours? Where we can get time during that period?
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
There is a function called time(). Maybe you google it. I think I used it in one of my NTP videos.
@georgedlake
@georgedlake 8 жыл бұрын
Super nice video. I am to start a small ESP8266 based multi-room Thermostat and wanted to add local time to the Nextion screen. Just one question. Once I get the time/date, the updates to the display should be calculated off the original NTP query right? if so, any ideas on how to? Thanks for your Videos!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+George Lake The library returns local time ( adjusted to the time zone and summer time). If you want to show local time, you can query the NTP service every minute or so. I do not know, how exact you want your display. Below one minute you can use delay(). This should be exact enough.
@jct4647
@jct4647 8 жыл бұрын
Nice work and excellent explanation.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Thanks for the nice comment!
@massimomalesci352
@massimomalesci352 4 жыл бұрын
Hi Andreas, nice video and great idea!!! I just would like to know if the change between summer and winter time will be automatic or must replace something in the sketch? Thanks for answering!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
It has this capability. Please look at the example file
@norberthartmann5075
@norberthartmann5075 5 жыл бұрын
Hallo Andreas, ggf kannst du die zwei ZEIT - Library etwas an Visual Studio Code anpassen und veröffentlichen ... VS IOT , meldet 2-3 "Warnungen" .... danke !
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Es gibt unterdessen eine einfachere Methode: kzbin.info/www/bejne/nWeVcqerm5aWo5Y. Vielleicht versucht du die mal?
@viisteist1363
@viisteist1363 7 жыл бұрын
hi. this works really nicely, but does it actually count Saturday as day 7, not day 6? and this probably connects to the ntp server every time and does not store the time in its memory?
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
1. I do not remember the numbering of the days of the week. However, it is easily changeable by you in software if important. 2. Why would you want to store time in memory? It moves all the time. If I remember right, the ESP has a time() function which you could use (without deep sleep). Because it is not very precise, you could synchronize it every hour or so with a call to NTP
@oliviernarayan
@oliviernarayan 7 жыл бұрын
I have a problem : In file included from C:\Program Files (x86)\Arduino\libraries\NTPtimeESP-master\examples\NTPtimeESP\NTPtimeESP.ino:9:0: C:\Program Files (x86)\Arduino\libraries\NTPtimeESP-master/NTPtimeESP.h:16:25: fatal error: ESP8266WiFi.h: No such file or directory #include I have to add another library ? Witch one ? Thank you for help
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
+Olivier Bousquet Maybe you did not select an ESP8266 as board. It will not work with an Arduino
@oliviernarayan
@oliviernarayan 7 жыл бұрын
Ok... it is no way to do the same with an arduino?
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
It is possible, but you have to have internet connection (Ethernet shield). But you have then to adapt my sketch to these commands (not a bid deal, I think)
@oliviernarayan
@oliviernarayan 7 жыл бұрын
It works after I flash node MCU firmaware in ESP8266 ! Thanks a lot ! :)
@BernhardHofmann
@BernhardHofmann 8 жыл бұрын
Great video. I guess the parameters are (0,0) if you want UTC, which is what people should use for everything other than presentation. If you use local time then be prepared for missing hours and duplicated hours when the daylight saving comes and goes. PS. CH is from the Latin "Confoederatio Helvetica", but you knew that of course from your coins. 😉
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
You are right with the parameters. But I wanted a hassle free possibility to get the actual time without coding in my sketch. This is why I included the conversion in the library. My devices so far do not need to care about the "double" and "missing" hours. The thing about CH is, of course, taught in our schools. This is probably, why I forgot to mention it in the video.
@oslafeman2497
@oslafeman2497 6 жыл бұрын
Hi Andreas, very good tutorials. I was looking for a simple and concise code for taking the date and time from the internet clocks without success. Yours works very well for me. I'm so new in these stuffs and looking the code it seems to me that it is on line permanently taking the date and time. I´m sorry if I'm wrong! Is there any way to get once a day the date/time and adjust an 1703 RTC? For instance with the "rtc.adjust(DateTime(year, month, day, hour, minute, second))? I'll really appreciate any help. Thanks a lot.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I am glad my part works. It is up to you how often you call the service. My proposal did not include an RTC. So you have to combine the two sketches yourself. I am sure it will work. Maybe not in five minutes ;-)
@oslafeman2497
@oslafeman2497 6 жыл бұрын
Thanks a lot Andreas for you kind response. As a little help for a newie in Arduino stuffs please tell me if when I run your NTPtimeESP.ino sketch the processor gets the NTP data (date and time) just once or every time the serial monitor refresh the data. I checked the cpp file but I'm not able to find that out. I'll appreciate your support.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You find the anser in the .ino file, not in the cpp. The call to get the time is :dateTime = NTPch.getNTPtime(1.0, 1); and it is called in the loop. But you can call wherever and when you want.
@FrankenPC
@FrankenPC 8 жыл бұрын
There is a master formula for DST is out there. It's called the TZ database. There's a good Wiki page on it. It's updated on a regular basis. Accurate DST calculation is surprisingly complex.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
I got this hint already, but it is quite some work to program it and also to test it. So, I thought, somebody more interested can do this part of the work...
@kobedde
@kobedde 5 жыл бұрын
Hi Andreas. Thank you for this handy and useful tool. I have implement your library on my web server project, but sometimes I get an incorrect hour and date indication. For example 2/2/2036. If I refresh the browser then the time is correct. Any idea what the cause may be. Greetz from Belgium.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
I think I will do an updated video in the next few weeks.
@ssaguiar
@ssaguiar 8 жыл бұрын
I wish to know how to set the system variables __TIME__ and __DATE__ in eps8266, after I update my rtc module (ds1307), using ntp server. I used this code, in the ntp code, but it seems not to update the internal rtc. epoch = secsSince1900 - 2208988800UL + (timeZone * SECS_PER_HOUR); setTime(epoch); Do you have any idea about how this works? Thank you very much and congratulations for the excelent videos of your channel.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
If I remember right, you can watch the other video about time (#71). There, I use SNTP and time(). Maybe you find a solution there.
@montectronyxz
@montectronyxz 4 жыл бұрын
Great video!. Can i use this for my project? I am sending data to a web server using a RTC module DS3231 with esp32. I need to use a backup system when the internet connection lose and backup the data in a SD memory with the date and hour for be sended to my server once the internet connection back. And a question, How maintain the date and hour after the internet connection lose using the NTP server?
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
I do not know. You have to try, I think. Maybe you watch my video #299?
@robinharris4706
@robinharris4706 8 жыл бұрын
Hi Andreas, I follow most of your videos and have experimented with many of the ideas you have presented - a HUGE thank you! I am getting odd results with the NTP time though and wonder if you or anyone else has any ideas? The example basically works for me BUT the time does not update each time the loop runs. It makes no difference how long the delay is (60 seconds or 15 seconds for example), I get the same time printed for either 2 or 3 loops then the time gets updated to the correct time. For example, if I update every minute I might see 20:10:34, 20:10:34, 20:12:40, 20:12:40, 20:12:40 then 20:15:41. I can't see any reason for this behaviour. Has anyone else seen this? Thanks
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
The only explanation I have is, that you do not get a response for every call (timeout). But I am just guessing.
@robinharris4706
@robinharris4706 8 жыл бұрын
It looks like this is the case - I added a WHILE loop and compared the last seconds with the old seconds and I see lots of NTP requests and replies. I tried the ch and several UK NTP servers all with the same result. Has anyone else noticed this or is there something weird with my setup? Thanks
@robinharris4706
@robinharris4706 8 жыл бұрын
Hi Andreas, more checking and reinstalled NTPtimeESP: same results. Typically 1 in 5 time requests produces a new time. To get the example to compile I needed to make a change in NTPtimeESP.h - the line "#INCLUDE WiFiUDP.h" I needed to change to #INCLUDE WiFiUdp.h" (changing DP to dp) as my core libraries for ESP only contain WiFiUdp.h and not WiFiUDP.h. Is this a clue? If you can point me in the right direction I will investigate but right now I am totally stuck. Many of your followers seem to have it working fine so it looks like something weird with my setup. I just can't find it! Thanks for any thoughts.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Robin Harris can you send me your sketch an libraries? Then I try it out here. You can e.g. Use dropbox for that matter.
@robinharris4706
@robinharris4706 8 жыл бұрын
Hi Andreas - unbelievably kind of you. Here is a link www.dropbox.com/sh/noqazsuc18c1edw/AABY3nNv8jTnBYs5ZjGkbx2Ya?dl=0 Inside this folder is a file "Information from Robin.txt" which gives more details. Any ideas of what to try would be greatly appreciated. THANK YOU :-)
@mariolisi4591
@mariolisi4591 7 жыл бұрын
Good morning Andreas, I tried your library and it works great. I would, however, also use the total seconds to control certain intervals. How can I include them in a constant type long? Best regards Mario
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
You have two possibilities to let variables survive deep sleep: You store it in RTC memory (they will not survive power down) or you put them in EEPR£OM (EEPROM has only 10'000 write cycles before it dies). How to use RTC memory, you find in video #60
@mariolisi4591
@mariolisi4591 7 жыл бұрын
Thanks Andreas. I understood what you say but I have not been clear. I want to test if it has been 5 minutes, or 1.5 hours or 3 hours. For example: . . actualMinute bytes = dateTime.minute; . (Start loop) if (dateTime.minute> = actualMinute +5) { } (End loop) . . I can not take the test on the minutes (dateTime.minute) or the hours (dateTime.hour) because if you are straddling two hours or two days this does not work. I would take the total seconds and do the same test on the total elapsed seconds; I do not know if I was clear. It is possible to take total seconds elapsed since 1/1/1900? Best regards Mario P.S. I apologize for my bad English
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
+Mario Lisi What about the formula: minutes = 60*dateTime.hour + dateTime.minute? Then you could do at the begin: beginMinute = minutes and whenever you want to test if (minutes - beginMinute > DURATION). And somewhere in the library is even a number which is the time since 1970. I think, it is called unixTime
@mariolisi4591
@mariolisi4591 7 жыл бұрын
Hello Andreas, Thanks for your help. I studied well your library and I made a small change to get unixtime already present inside but not made available outside. Now if I write dateTime.unixTime I get the total seconds since 1970. Thank you again. Best regards. Mario
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
+Mario Lisi :-)
@massimomalesci352
@massimomalesci352 4 жыл бұрын
Hi Andreas, in the function NTPgetTime, what should I write for western Europe 1 or 1.0 or is it the same? In the comment of the sketch It's written that 1.0 is for India.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
1.0
@massimomalesci352
@massimomalesci352 4 жыл бұрын
@@AndreasSpiess Thank you very much for answering!
@javierCi
@javierCi 7 жыл бұрын
Hello Andreas Spiess, you library works well, but it crash the serial port. If I erase the NTPtimeESP library the problem was solved. Your library send or wait something through the serial port?
@toopoo
@toopoo 7 жыл бұрын
Good video and library. Can you come up a software clock with NTP so that we only need to sync with NTP like once an hour?
@toopoo
@toopoo 7 жыл бұрын
I found some posts talking about TimeLibrary, looks like it was exactly what I want. :)
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I think, you can do this yourself. Shouldnt be too complicated. I have no such plans
@billvalvik
@billvalvik 6 жыл бұрын
Andreas. Thank you for the library and sample code. I was able to get the time and date to show. I am a bit of a Noob and wanted to know how can I write a simple if statement to compare current time to a specific time. I keep getting errors with comparing byte to strings. Any help would be great. Thank you,
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Strings are not easy with c++. You have to Google a lot.
@yashpandit832
@yashpandit832 5 жыл бұрын
Can something be done to keep track of the time even in the deep sleep mode? In my project, I want to run esp on the internal battery when there is no external power but want to keep the time even after the external power comes back(in case there is not internet after the power comes back).
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
getLocalTime() should keep time during deep sleep. It is not very precise, however.
@robertrobert5583
@robertrobert5583 5 жыл бұрын
Thanks for this. How often does the code contact the ntp pool to get the time? My coding is not good enough to tell by reading the sketch!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Your sketch calls the library. So you decide!
@raybright5805
@raybright5805 6 жыл бұрын
Is there a patch to include a routine to adjust for different time zones? Love your work...
@raybright5805
@raybright5805 6 жыл бұрын
I found the fix ... modify this line of code dateTime = NTPch.getNTPtime(8, 0); // 8 is for Perth Western Australia (GMT+8)
@btcsys
@btcsys 5 жыл бұрын
@@raybright5805 do you know what # I would use for USA?
@ResidentialAlien042
@ResidentialAlien042 8 жыл бұрын
Hi Andreas, I am big fan of your videos. Get lot of stuff which is unknown.. Got to know about ESP from your vid.. I have read somewhere that for ESP there is EProm and there is life limit for the same. If I had to use it for commercial project then how is it possible ?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
The ESP has no EEPROM, it only has a flash chip for the program code. This flash memory can be written a few thousand times before it is killed. This is ok if you use it to store your code. It will for sure not change thousands of times. There is a "hack" available to emulate a EEPROM function using the flash chip. This, of course has the same limitations and therefore should not be used for frequently changing variables. Watch my video #60 for this topic.
@mohammadshaaban1345
@mohammadshaaban1345 8 жыл бұрын
Hey, thanks for the great video. This requires our esp to be constantly connected to the wifi no? Is there a way to do this that would be more power efficient? Such as syncing once online every day or so?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Watch my video of next thurssay. I will show there a sketch which sleeps during one day, checks the time with NTP, and executes a task if the time is ok. I also will introduce a new library which solves your problem (I hope).
@Imane3233
@Imane3233 8 жыл бұрын
Hello, thanks for this amazing video. When you will post the next video?
@jumadhaheri
@jumadhaheri 8 жыл бұрын
thank you, this is brilliant. this will come with so much help to me.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
You'r welcome! I am glad if my videos help others to get faster to what they want...
@jumadhaheri
@jumadhaheri 8 жыл бұрын
What happened is that I have an esp with sensor on a site and another esp with display panel on another site both running of iot service. My concern was if sensor side for some reason went offline the display esp will keep showing the last value no matter how old . Now I could check against the timestamp. Example if timestamp was more than 15 minutes difference the display esp should show sensor is offline instead of showing too old data and assisting end user eventually. Thank you. Small thing If I don't use time saving shall I set the value to zero ? In my case (4, 0) ?
@laurencemunro
@laurencemunro 8 жыл бұрын
Nice job. One bit of advice - your pc display font is too small to read on a mobile device. I would suggest changing the font or resolution for capturing your videos
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Thanks for the remark. It is always a compromise. But I look into the topic for my next videos.
@laurencemunro
@laurencemunro 8 жыл бұрын
+Andreas Spiess I completely agree with the compromise, but even a small increase will already make a difference! My guide is if you can't read it at 360p, it is too small
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Laurence Munro good advice. I try it
@adilmalik7066
@adilmalik7066 8 жыл бұрын
nice video. i have a question, is it possible to get time from the web like this but then make the ESP use its own inbuilt RTC to keep it up to date? this would mean we can keep track of time even there is no web.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Yes. Watch my video #71 for details.
@Ed19601
@Ed19601 8 жыл бұрын
when pulling the time off the ntp server, the esp8266 acts as a client. But what if you want to serve a webpage at the same time that shows that time, so actually being a client and a host. is that at all possible?
@adnansoomro7204
@adnansoomro7204 5 жыл бұрын
I am getting some problem my sketch runs perfectly but time does not update.. it always gives 1-1-1970 and time starts from 5:00:00 i cant get what i am doing wrong please help... My timezon is of pakistan.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
There is an easier way now: kzbin.info/www/bejne/n4Czc39vhbShiMU
@user-cm7xh9lt8c
@user-cm7xh9lt8c 4 жыл бұрын
I got the same problem but instead of 5 it shows 8 (probably because live in an other time zone) . I cant figure out how to solve this problem but since you had the same problem did you solve it and if so how did you do it
@adnansoomro7204
@adnansoomro7204 4 жыл бұрын
I used an other method in which i hard coded the time and started the timer and then it was solved.. works great
@majidnasr3329
@majidnasr3329 7 жыл бұрын
Dear Andreas, Thank you so much for nice videos. Here in Australia Time zone is +10. If I want to disable Daylight saving in your code, should I write it this way ? dateTime = NTPch.getNTPtime(10, 0); All the bests,
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I think so. Just try.
8 жыл бұрын
Can you please make a quick example how i can format to GMT format, for example hour:minute:seconds dd-mm-yyyy please? also i need this to be able to be put into a variable for comparison for alarms etc!?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Did you watch the video with the watch on it (#71)? There, you have it.
8 жыл бұрын
yer i watched the vid with the big white clock onit and you talked about it but didnt do it, i learn visually and i tried playing with it but didnt get far i have no idea how to do it.
@KaranSingh-uj4jh
@KaranSingh-uj4jh 4 жыл бұрын
The video was amazing but is there a way to control this all using Arduino Uno? As your library is only working when I choose ESP8266 as an individual board in the IDE
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
You need an internet connection. The Arduino Uno does not have one.
@leonardomejia8562
@leonardomejia8562 7 жыл бұрын
Dear Andreas, It's great your work, I have one question, I try to obtain day of week without RTC module with dummy script (NTP Client) I like to create schedule with esp8266 and every wednesday of the week to water garden If you have any idea, I appreciate your share any solution to obtain day of week. Thanks for your bring your knowledge in this tutorials. Best Regards,
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Did you try the example file? The day of the week should be dateTime.dayofWeek
8 жыл бұрын
trying to put the date format where it belongs so dd-mm-yyyy (anything else is pure sillyness) how do i do this please? that unixtime site is useless!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Please watch my three videos about NTP time. I hope, you will find then the right thing for you.
8 жыл бұрын
i have and don't see anything about formatting ntp time :/ i can show it how i want but i have to use multiple serial print lines and wish to put the vars into 1 string for comparison against another string for alarms and stuff any ideas please?
@JanicekTrnecka
@JanicekTrnecka 4 жыл бұрын
What about having RTC, and ocassionally pull down sync from the Internet ? (I want to have deep sleep and such features, and no LCD with knobs). I am struggling with comparing the time and updating it in RTC module.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
I am sure you will find the needed components on the internet. Then you have to create the „glue“ yourself.
@JanicekTrnecka
@JanicekTrnecka 4 жыл бұрын
@@AndreasSpiess Thanks anyway, your videos are real gems on youtube. Just now I am slapping some different sketches together and I am close to viable solution.
@leandroboari
@leandroboari 5 жыл бұрын
What's the ESP8266 RTC accuracy? Thank's Andreas!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Depends on the temperature and other parameters. Maybe a few minutes off per day.
@rolstonholas333
@rolstonholas333 5 жыл бұрын
Hi Guys, I have just worked through this and it is kinda working but I do have a couple of small issues that I wonder if you can help me with. 1) My values (displayed on a 16x2 LCD), if less than 10 doesn't display very nicely, is there a way to add a zero for better formatting? 2) My second counter seems to only count/display every other second but it does seem to move between odd and even numbers. So I guess sometimes they count every third second. Any help would be much appreciated. TIA
@alanburgess2203
@alanburgess2203 5 жыл бұрын
Hi Andreas, thanks for this works a treat, however is there any way to keep the clock updated when the wifi is powered down?, the ESP8266 is still active I just shut the wifi down and reconnect every 15 mins, it would be nice to keep the clock going on my oled screen, not sure if this is possible? Cheers Alan
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You should have a time() function which runs all the time. It is not precise and can be set when connected to NTP. I think I used it in one of my videos.
@nobytes2
@nobytes2 6 жыл бұрын
Just a question why do you use byte types on strDateTime struct instead of int for hours, minutes, seconds. What's the advantage of using byte over int?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Int uses 2 or 4 bytes depending on the processor. byte only one
@nobytes2
@nobytes2 6 жыл бұрын
Oh OK makes sense. Great work by the way. Your library is the easiest to work with!
@TheManFromMoon
@TheManFromMoon 7 жыл бұрын
Hello Andreas, the guy with the swiss accent, thanks a lot for the great videos and tutorials!I'm very new to ESP8266 and Arduino ESP. I coded a lot of stuff in Basic, Turbo Pascal and Visual Basic, but it is about 25year ago and I fear I forgot a lot of this. I tried to use your library but I did not get it run like expected.I just wanted to have a look, if the time and date is correct, so I used some serial.print commands. At first it showed nothing. Then I removed the "if(dateTime.valid)" command. I added some lines to your code: void loop() { // first parameter: Time zone in floating point (for India); second parameter: 1 for European summer time; 2 for US daylight saving time (contributed by viewwer, not tested by me) dateTime = NTPch.getNTPtime(1.0, 1); // check dateTime.valid before using the returned time // Use "setSendInterval" or "setRecvTimeout" if required //if(dateTime.valid){ NTPch.printDateTime(dateTime); byte actualHour = dateTime.hour; byte actualMinute = dateTime.minute; byte actualsecond = dateTime.second; int actualyear = dateTime.year; byte actualMonth = dateTime.month; byte actualday =dateTime.day; byte actualdayofWeek = dateTime.dayofWeek; Serial.print("actualHour: "); Serial.println(actualHour); Serial.print("actualMinute: "); Serial.println(actualMinute); Serial.print("actualsecond: "); Serial.println(actualsecond); Serial.print("actualyear: "); Serial.println(actualyear); Serial.print("actualMonth: "); Serial.println(actualMonth); Serial.print("actualday: "); Serial.println(actualday); Serial.print("actualdayofWeek: "); Serial.println(actualdayofWeek); delay(10000); //} }But this is the unexpected output:actualHour: 0 actualMinute: 0 actualsecond: 0 actualyear: 1073667216 actualMonth: 32 actualday: 235 actualdayofWeek: 254I have three questions: 1.) Why does it not get a valid date and resulting can not enter the loop to print the variables? 2.) Why is the output not like expected? 3.) How to realize a clock, which synchronizes every 5 minutes or similar by ntp?Thanks and best regards, Chris
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I would stick with the example provided. If it does not work, there is a problem with the network. Other viewers also had problems with some network configurations, but we were never able to figure out the "root cause" (maybe you read some of the other comments here). Maybe you try my other NTP example in video #71. It uses a slightly different way to get the NTP signal. P.S. When I saw the list of your programming languages, I found parallels with my experiences...
@mr.nobody9
@mr.nobody9 6 жыл бұрын
When my MQTT broker is disconnected it returns 0 and when there's issue with the internet connectivity it returns timestamp from 2004 "2004-2-4 9:38:35".
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I am not sure if it has anything to do with MQTT broker...
@loligesgame
@loligesgame 5 жыл бұрын
im kinda new to programming... how is the time stored? as an int? as an string? my goal is it to write the time to an oled displya, so i need a string for that containing houres minues and seconds BTW i love your vids :D
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Maybe you watch my new video on Sunday?
@loligesgame
@loligesgame 5 жыл бұрын
@@AndreasSpiess got it working anyways with an other library. Thanks anyways:D
@pictrtg6245
@pictrtg6245 5 жыл бұрын
excellent job bro. keep it up.....
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Thank you!
@middelbh
@middelbh 7 жыл бұрын
hi Andreas! I have been using your NTP time approach for quite some time. starting a couple of days ago I changed something in my sketch and the system now continues to respond .sending NTP packet... I also tried your example program with the same result... My ESP12E is working without problems, what may be the cause? Hans
@middelbh
@middelbh 7 жыл бұрын
hmm. looks like I solved some of the above by reinstall of Arduino IDE and libraries...
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
:-)
@hermanhermitz9101
@hermanhermitz9101 6 жыл бұрын
I must be missing something. So I'd like to know what the difference between using this library and using the already existing configTime() function is?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I do not know configTime(). Maybe this is the difference?
@alejandrotrujillo5679
@alejandrotrujillo5679 5 жыл бұрын
Hi I´ve just finished installing your library. Just have a question when I installed the ESP8266 Library on examples i´ve noticed it already have an NTP Library why do you need an extra Library Just asking...
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
I do not remember. When I did this, I thought it was needed. Maybe today no more.
@alejandrotrujillo5679
@alejandrotrujillo5679 5 жыл бұрын
@@AndreasSpiess thanks for taking the time to answer!!! I admire you!! And opening the .h library I found now it isn't necessary anymore but it's never a bad idea to create your own tools!!
@WilliamBurlingame
@WilliamBurlingame 6 жыл бұрын
Thanks for this and other videos you have produced. I am in the U.S. and tried the service at us.pool.ntp.org. It was causing me a problem by occasionally returning incorrect data as others have reported. The bad data reports a year of 2036. I decided to use the service provided by the U.S. government at time.nist.gov. That works well, except their website warns of frequent requests to the service. They say that request more frequently than once every four seconds will be treated as a denial of service attack and the site will be blocked. I set mine to query every 10 seconds. During the 10 second interval, I update the time by using a delay of 1000 msecs and adding to the previous time by one second. My next task is to test to see if the WiFI has dropped, keep displaying the time during the no WiFi time and reconnecting when it comes available.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I think I made a second video about the topic. There you might find the time function. With this, you only have to call the service at startup and maybe every hour or so
@kasekuchentv7869
@kasekuchentv7869 2 жыл бұрын
Is there a way of using this library while a server is running? I want to use this with my smarthome webinterface.
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
Just try it. I assume it will work.
@kasekuchentv7869
@kasekuchentv7869 2 жыл бұрын
@@AndreasSpiess I did, but it sadly doesn't work... The common NTC libaries didn't work eigher though. When I ran your test skript, it did work, but as soon as I merged it with my own, it won't...
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
@@kasekuchentv7869 Unfortunately, I cannot do remote debugging :-( I ususally start with a running example and add line after line of my new code. Then I see when it stops working...
@norberthartmann5075
@norberthartmann5075 5 жыл бұрын
ups, wollte gerade das programm für einen ESP32 nutzen ..... geht wohl nicht .... habe ich die anpassung an esp32 übersehen oder gibt es sie (noch ) nicht ? happy hacking
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Ich hab da nix mehr gemacht :-(
@norberthartmann5075
@norberthartmann5075 5 жыл бұрын
@@AndreasSpiess sorry, habe es gerade erst gesehen . schade, irgendwie ist die lib noch nicht stabil - das demo funktioniert offensichtlich doch in programmen tauchen "merkwürdige" zeiten auf ... und ich wollte sie sowohl beim esp8266 als auch beim esp32 nutzen .... ok, muss mir was neues einfallen.
@2012isRonPaul
@2012isRonPaul 7 жыл бұрын
so its possible to use this in data logging setups somehow?:e
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Why not? Maybe you watch also video #71
@danielstr3924
@danielstr3924 4 жыл бұрын
Hallo Andreas, erst mal: Super Video, auch nach 4 Jahren noch :) Weiter so! Allerdings habe ich ein kleines Problem damit. Manchmal steigt der Beispiel-Sketch einfach aus und zeigt mir ein paar Sekunden lang "2036-2-7-5 7H 28M 16S ". Als Server habe ich den Schweizer und den Deutschen Pool probiert, der Fehler bleibt aber
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Ich weiss nicht was passiert, aber ich nehme an, dass du die .valid Funktion verwendest?
@danielstr3924
@danielstr3924 4 жыл бұрын
@@AndreasSpiess genau: if (dateTime.valid) etc etc.
@manouchehrmail
@manouchehrmail 6 жыл бұрын
Hi. This is a great code but still, we have to either manually set the summer time flag or using any available I/O pins get the activation of summer-time calculation activation from the user. Is there any way to get rid of summer-time calculation activation? I mean is there any service available to provide with the current local time without having to calculate the time manually? For example, when we type in google "what time is it?", there are tons of websites that show the current local time (based on IP and location from where the request has been sent out). Is there any way to get this simple value and not be worried if it is summer-time or not? The service would provide with such info: the current time at this moment is this and that.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You just have to decide if the place you put your module uses summer time or not. The rest is calculated automatically. Of course, you can call a different service to set the time zone automatically. Then you would need a GPS module and have to place your module outside. So I think, most people know the time zone and are happy with entering it by hand.
@manouchehrmail
@manouchehrmail 6 жыл бұрын
I appreciate your reply. Let me please clarify my situation with this project. The location is in Germany and will never change. Thus, the time zone could be set in the project once and that is it. Now just the summertime is the question. What I understood from your answer is, that if I set the summertime in the sketch, then it will automatically change to none-sommertime on Sunday, October 28 at 3:00 a.m. and I do not have to reset the summertime flag in the sketck on that particular time (of afterwards). Is that right? If it is so, then the code has to consider the summer time again on Sunday, March 25 at 2:00 a.m. Did I get it correctly?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
There is a formula implemented which should to that automatically, if you set the right parameter. Otherwise, it would not make a lot of sense, I agree.
@SamFugarino
@SamFugarino 7 жыл бұрын
Love your videos
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
:-)
@ljl451
@ljl451 7 жыл бұрын
Hello, do you know why the time is not correct when using a static IP configuration with: WiFi.config( ip, gateway, subnet ); Instead, if I let the esp8266 module get an IP address assigned by DHCP, the time is correct. Thanks
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I also had issues when using fixes address, but never found out, why. I think, it has to do with the connection, not the time reading (the device just times out after a while without connection)
@ljl451
@ljl451 7 жыл бұрын
When I use a static ip address, the initial time returned by the ntp server is 00:00:00. After that, the time is updated correctly.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
So, it works now correctly?
@ljl451
@ljl451 7 жыл бұрын
It works if I specify a correct initial time at the beginning. This is not very useful because it has to be redone at every recompilation of the code.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
But then, it does not work. The clock runs without a NTP server. So, in your case, it looks like you never get a NTP feedback. If you set the time, the internal clock runs, but not very precise... So, you experience the same issue for fixed IP as I did. But I am not a network specialist...
@surenbono6063
@surenbono6063 5 жыл бұрын
...is there a arduino code that gets time from a cellular synced phone via smartphone network hotspot without connecting to a server....and run on crystal until cellular resync
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
I do not think so because te Arduino has no connection to a smartphone
@surenbono6063
@surenbono6063 5 жыл бұрын
Andreas Spiess ..you mean esp8266 is not considered an arduino.?
@surenbono6063
@surenbono6063 5 жыл бұрын
..what i meant was...get time from an allready synced clock like a smartphone or a network router..to ease internet traffic or interrupting a server every 1 minute for a clock sync..esp as a stratum 3 client..
@raybrok4724
@raybrok4724 7 жыл бұрын
Not bad. Thanks for the library. Guess something must be wrong with my network or... Because as a clock, it's not stable. I have gaps in the loop that take a minute or five to recover. And sometimes it's a very weird time and date. The date it gives (when wrong) is always 7/2/2036 but the time I sometimes receive can not be placed on the normal layout of a clock as we all know it. I liked the idea but need something that is stable so I guess it's back to the RTC module.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Sorry for that. I do not know, why this happens. I think, we cannot blame the atomic clocks for that big error ;-)
@raybrok4724
@raybrok4724 7 жыл бұрын
Why blame anybody/what/thing or whatever for just ... uh, this? Maybe it's the moon but even then I will not blame the thing. And uh... No sorry man. Thanks again and also for the educational information and pieces of code.
@vivereinbrasile
@vivereinbrasile 7 жыл бұрын
I got the same problem 7/2/2036 ... may be a premonition :)
@failforyou
@failforyou 6 жыл бұрын
Had the same Problem sometimes also 7/2/2036
@zoltanszabo8475
@zoltanszabo8475 6 жыл бұрын
Hi, 277 if ((_unixTime > 0) && (highWord != 0)){ solves the issue.
@neo07oemm
@neo07oemm 6 жыл бұрын
thank you so much! i resolve my problem : can´t use an RTC module at the same time with an RF receiver because the library rcSwitch use the same Pin in the nodeCMU.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
:-)
@joshuarosen6242
@joshuarosen6242 7 жыл бұрын
Unfortunately I cannot set the time accurately with this library or with any other I have tried. Whatever method I have used, the time ends up being 2-4 seconds slow.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
This might be the travel time of the packet from your NTP server to your home. Did you choose the closest NTP server? You should find addresses on the internet. The Swiss servers, for example, start with ch.ntp... I do not know of any other sources of delay.
@joshuarosen6242
@joshuarosen6242 7 жыл бұрын
I did pick the nearest but I am almost certain that it is caused by the network delay. Ntp (as opposed to sntp) has transport delay correction as well as adjusting the time smoothly and so can achieve
@Gellis12
@Gellis12 7 жыл бұрын
I can't remember if it existed in the ESP8266, but the ESP32 actually contains an internal RTC which is super easy to use.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
But still, you have to set the time and AFAIK include a 32 kHz resonator, which is usually not on board.
@ravindupramod5998
@ravindupramod5998 5 жыл бұрын
Thank you for the help☺️
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome!
@SunilSudevan
@SunilSudevan 7 жыл бұрын
How can i use RTC module DS3231 with Node MCU can u tell me these Default SDA and SCL pins on NodeMCU V1.0
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Just google ;-)
@themalaland1502
@themalaland1502 5 жыл бұрын
but once it gets the time it need to be continously power on since when it lost wifi conection is has to reset time ¿isn't it?
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Only if it loses power. If it is powered it has an internal clock (not Swiss precision), which has to be synchronized from time to time by an NTP call.
@siddeshmp4156
@siddeshmp4156 7 жыл бұрын
Sir I have Arduino Uno board with ESP8266 wifi shield and I'm trying with LED display. Please share code and schematic if you have or does the above thing work with this.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I do not work with Arduino and ESP8266. So, you have to google.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I only work with Arduino or ESP, never together
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Arduino IDE or ESPhome for our Projects?
22:28
Andreas Spiess
Рет қаралды 35 М.
Tech Note 123 - ESP32 or ESP8266 NTP synchronised Real Time Clock
4:34
Forget WiFi! This Wireless Method is WAY Better?
12:14
GreatScott!
Рет қаралды 704 М.
Adjust RTC DS1307 time by using NTP | Set RTC time with Internet
6:23
Getting started with ESP8266 using AT COMMANDS
12:32
ControllersTech
Рет қаралды 19 М.
My Kickstarter failed, so I open sourced it
12:20
StuckAtPrototype
Рет қаралды 713 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН