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

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 พ.ค. 2024
  • In this video I will:
    - Replace an RTC module including backup battery, entry keys, and display with a small piece of software
    - Use the globally available NTP services
    - Enhance reliability by using server pools instead of individual servers
    - Present a small library which can be easily used in your own sketches
    NTPtimeESP Library: github.com/SensorsIot/NTPtimeESP
    Other NTP library: github.com/arduino-libraries/... (without summer time)
    Unix time conversion: www.unixtimestamp.com/
    Other video: • #71 Schedule a daily t...
    Supporting Material and Blog Page: www.sensorsiot.org
    Github: www.github.com/sensorsiot
    If you want to support the channel and buy from Banggood use this link to start your shopping: bit.ly/2jAQEf4 (no additional charges for you)
    Official Wemos Store: s.click.aliexpress.com/e/jUzBiIq
    / sensorsiot
    / spiessa
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 391

  • @Ed19601
    @Ed19601 7 ปีที่แล้ว +71

    The Swiss and time keeping... always a good combination ;-)

  • @SuperNathanTube
    @SuperNathanTube 6 ปีที่แล้ว +1

    Andreas... kudos to your clear and nice explanation of the NTP stuff. Even complex topics look simple at the hands of experts ...Thanks !!

  • @Ed19601
    @Ed19601 5 ปีที่แล้ว +1

    two years later and i finally needed this. Works swell, easy to use. Tnx

  • @mikeberger4276
    @mikeberger4276 6 ปีที่แล้ว

    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!

  • @nicklaspersson4687
    @nicklaspersson4687 7 ปีที่แล้ว +3

    Great episode. Very useful stuff. Thanks for your great efforts.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      You're welcome. I am always glad if something is useful...

  • @underwoodblog
    @underwoodblog 7 ปีที่แล้ว

    I have tested the library yesterday and it works fine. Great work!!

  • @FredrikOhlsson70
    @FredrikOhlsson70 7 ปีที่แล้ว +1

    It is always so awesome to follow your videos and solve problems I have with my sketches :D

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      That is the intention.... I also learned and learn a lot with youtube.

  • @AgeAqua
    @AgeAqua 7 ปีที่แล้ว

    Something that I can use for my projects, thank you.
    Well done!

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      You are welcome. Look also at video #71. There, you find another library to get the NTP time.

  • @Marco-in3yk
    @Marco-in3yk 4 ปีที่แล้ว

    Thank you so much for your work, I was just about to solder an RTC to my circuit!

  • @alejandrosantiago6080
    @alejandrosantiago6080 6 ปีที่แล้ว

    Hi, Andreas, I install the libray and its working properly, thanks for the good work!
    Chers, form México.
    -Alex.

  • @oraszuletik
    @oraszuletik 4 ปีที่แล้ว

    Thank you so much! Exactly what I needed and also, very elegant code.

  • @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

  • @pagutierrezn
    @pagutierrezn 7 ปีที่แล้ว

    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"

  • @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 ปีที่แล้ว +3

      Thanks. As everybody else, I have my 24h a day. If it is not enough, there is still the night and the weekend ;-)

  • @colfaxschuyler3675
    @colfaxschuyler3675 7 ปีที่แล้ว +1

    Another great video. I knew about epoch time, I wasn't aware that UTC counted from 1/1/1900...

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      +Marc Visconte For me, it was the same. That was one of the reasons to give you some background...

  • @jutiubi
    @jutiubi 5 ปีที่แล้ว

    Andreas, I wish to thank you for what you are doing.

  • @christyinnovations
    @christyinnovations 7 ปีที่แล้ว +1

    Well played sir. Very helpful. I have often thought of trying to create a library, this is another nudge

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      +Bob Christy (christyinnovations) This was my first library. I maybe make once a video on how to do it.

  • @sdgelectronics
    @sdgelectronics 6 ปีที่แล้ว

    Thanks Andreas for the info. Just trying out the ESP12E....

  • @santiagovelezflorez1634
    @santiagovelezflorez1634 3 ปีที่แล้ว +1

    Maestro muchas gracias, me funciono perfectamente, eres muy habilidoso profesor Andreas.

  • @pascalmauger7521
    @pascalmauger7521 ปีที่แล้ว

    Many Thanks for the library and example.

  • @jct4647
    @jct4647 7 ปีที่แล้ว

    Nice work and excellent explanation.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      Thanks for the nice comment!

  • @gruneranfanger6947
    @gruneranfanger6947 7 ปีที่แล้ว

    Gute Arbeit, Andreas. Fundiert, strukuriert, TOPP.

  • @jumadhaheri
    @jumadhaheri 7 ปีที่แล้ว

    thank you, this is brilliant. this will come with so much help to me.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      You'r welcome! I am glad if my videos help others to get faster to what they want...

    • @jumadhaheri
      @jumadhaheri 7 ปีที่แล้ว

      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) ?

  • @tanguasimtu5823
    @tanguasimtu5823 ปีที่แล้ว

    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  ปีที่แล้ว

      You find many videos on MQTT, particularly on the Raspberry Pi on this channel.

  • @plasticmirror
    @plasticmirror 5 ปีที่แล้ว

    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!

  • @pritchs7889
    @pritchs7889 ปีที่แล้ว

    Enjoyed your video! Thanks for making it,

  • @nubin.stanley
    @nubin.stanley 7 ปีที่แล้ว +5

    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 ปีที่แล้ว +1

      Thanks for your contribution. I answered you an Github.

    • @nubin.stanley
      @nubin.stanley 7 ปีที่แล้ว +1

      Have raised the pull request. :)

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +2

      Implemented

  • @XerotoLabs
    @XerotoLabs 7 ปีที่แล้ว +2

    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  7 ปีที่แล้ว

      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...

  • @norberthartmann5075
    @norberthartmann5075 7 ปีที่แล้ว

    SUPER SACHE !! genau das was ich für den ESP8266 noch gesucht habe
    besten dank und weiter so !!!

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      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 7 ปีที่แล้ว

      (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  7 ปีที่แล้ว

      +Norbert Hartmann von wem zurückgegeben? NTP Server können das nicht. Und die Library passt einfach die Zeit dementsprechend an.

    • @norberthartmann5075
      @norberthartmann5075 7 ปีที่แล้ว

      an den nutzenden sketsch, dann kann man den status zb. im display darstellen.. ( oder ich sehe nicht wie sonst...)

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      Kannst du sicher machen. Ich war einfach an der richtigen Zeit interessiert...

  • @ravindupramod5998
    @ravindupramod5998 4 ปีที่แล้ว

    Thank you for the help☺️

  • @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

  • @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?

  • @BernhardHofmann
    @BernhardHofmann 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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.

  • @arnegranberg7633
    @arnegranberg7633 7 ปีที่แล้ว

    Thanks for your code

  • @pictrtg6245
    @pictrtg6245 4 ปีที่แล้ว

    excellent job bro. keep it up.....

  • @viisteist1363
    @viisteist1363 6 ปีที่แล้ว +1

    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  6 ปีที่แล้ว +1

      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

  • @WimC56
    @WimC56 3 ปีที่แล้ว

    And of course it can be used on Arduino too, if Arduino is connected to the internet.
    Great stuff.

    • @AndreasSpiess
      @AndreasSpiess  3 ปีที่แล้ว

      Maybe. I never tried to connect an Arduino to the internet.

  • @ritaschulz917
    @ritaschulz917 4 ปีที่แล้ว

    Danke, das hat mir heute sehr geholfen!

  • @G6EJD
    @G6EJD 7 ปีที่แล้ว

    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  7 ปีที่แล้ว +1

      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.

  • @mohammadshaaban1345
    @mohammadshaaban1345 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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).

    • @imansonji9960
      @imansonji9960 7 ปีที่แล้ว

      Hello, thanks for this amazing video.
      When you will post the next video?

  • @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!

  • @guidovlaere
    @guidovlaere 7 ปีที่แล้ว +2

    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 ปีที่แล้ว +1

      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.

  • @jan5260
    @jan5260 5 ปีที่แล้ว

    Andreas you are the best!

  • @Ed19601
    @Ed19601 7 ปีที่แล้ว

    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?

  • @adilmalik7066
    @adilmalik7066 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      Yes. Watch my video #71 for details.

  • @yashpandit832
    @yashpandit832 5 ปีที่แล้ว +1

    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.

  • @georgedlake
    @georgedlake 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      +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.

  • @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.

  • @majidnasr3329
    @majidnasr3329 6 ปีที่แล้ว

    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,

  • @FrankenPC
    @FrankenPC 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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...

  • @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

  • @SamFugarino
    @SamFugarino 7 ปีที่แล้ว

    Love your videos

  • @JerryEricsson
    @JerryEricsson 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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.

  • @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  4 ปีที่แล้ว

      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.

  • @oslafeman2497
    @oslafeman2497 5 ปีที่แล้ว

    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  5 ปีที่แล้ว

      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 5 ปีที่แล้ว

      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  5 ปีที่แล้ว

      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.

  • @kobedde
    @kobedde 4 ปีที่แล้ว

    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  4 ปีที่แล้ว +1

      I think I will do an updated video in the next few weeks.

  • @rolstonholas333
    @rolstonholas333 4 ปีที่แล้ว

    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

  • @raybrok4724
    @raybrok4724 7 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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 6 ปีที่แล้ว

      I got the same problem 7/2/2036 ... may be a premonition :)

    • @failforyou
      @failforyou 5 ปีที่แล้ว

      Had the same Problem sometimes also 7/2/2036

    • @zoltanszabo8475
      @zoltanszabo8475 5 ปีที่แล้ว

      Hi,
      277 if ((_unixTime > 0) && (highWord != 0)){
      solves the issue.

  • @sumitlubal
    @sumitlubal 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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.

  • @middelbh
    @middelbh 6 ปีที่แล้ว

    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 6 ปีที่แล้ว

      hmm. looks like I solved some of the above by reinstall of Arduino IDE and libraries...

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      :-)

  • @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

  • @CesarGritti
    @CesarGritti 7 ปีที่แล้ว

    Thanks! very good!

  • @2012isRonPaul
    @2012isRonPaul 6 ปีที่แล้ว +1

    so its possible to use this in data logging setups somehow?:e

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      Why not? Maybe you watch also video #71

  • @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.

  • @montectronyxz
    @montectronyxz 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      I do not know. You have to try, I think. Maybe you watch my video #299?

  • @KaranSingh-uj4jh
    @KaranSingh-uj4jh 3 ปีที่แล้ว

    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  3 ปีที่แล้ว

      You need an internet connection. The Arduino Uno does not have one.

  • @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 :-)

  • @raybright5805
    @raybright5805 5 ปีที่แล้ว

    Is there a patch to include a routine to adjust for different time zones? Love your work...

    • @raybright5805
      @raybright5805 5 ปีที่แล้ว

      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?

  • @rnickens1999
    @rnickens1999 7 ปีที่แล้ว

    Thank you.

  • @WhiteLion1337
    @WhiteLion1337 4 ปีที่แล้ว +1

    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  4 ปีที่แล้ว +1

      I do not think the ESP32 does something during deepsleep. Maybe you have a look at my ULP video?

    • @WhiteLion1337
      @WhiteLion1337 4 ปีที่แล้ว

      @@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.

  • @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!

  • @manouchehrmail
    @manouchehrmail 5 ปีที่แล้ว

    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  5 ปีที่แล้ว +1

      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 5 ปีที่แล้ว

      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  5 ปีที่แล้ว +1

      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.

  • @dmaraptor
    @dmaraptor 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      There is a function called time(). Maybe you google it. I think I used it in one of my NTP videos.

  • @mail2abir
    @mail2abir 6 ปีที่แล้ว

    Thanks a lot for the Library Sir. Most of the time I get the correct time. But at times I get date as 2036-2-7-5 11H 58M 16S printed on the Debug console. Can you please help?

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      If you do not get a signal back (timeout) you get this result. Maybe you check the valid flag for that. or you just send a new request if you get this date.

  • @leonardomejia8562
    @leonardomejia8562 6 ปีที่แล้ว

    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  6 ปีที่แล้ว

      Did you try the example file? The day of the week should be dateTime.dayofWeek

  • @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 ปีที่แล้ว +1

      I do not know configTime(). Maybe this is the difference?

  • @nobytes2
    @nobytes2 5 ปีที่แล้ว

    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  5 ปีที่แล้ว +1

      Int uses 2 or 4 bytes depending on the processor. byte only one

    • @nobytes2
      @nobytes2 5 ปีที่แล้ว

      Oh OK makes sense. Great work by the way. Your library is the easiest to work with!

  • @vincentcheng4849
    @vincentcheng4849 4 ปีที่แล้ว

    Are there anyway to sync the time through NTP server once a day and keep the time running without a RTC module through an ESP8266?

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      The ESP has an internal clock Command time(). Not very precise, but sufficient if synchronized from time to time. But it does not work with deep sleep.

  • @loligesgame
    @loligesgame 4 ปีที่แล้ว

    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  4 ปีที่แล้ว +1

      Maybe you watch my new video on Sunday?

    • @loligesgame
      @loligesgame 4 ปีที่แล้ว

      @@AndreasSpiess got it working anyways with an other library. Thanks anyways:D

  • @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!!

  •  7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      Did you watch the video with the watch on it (#71)? There, you have it.

    •  7 ปีที่แล้ว

      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.

  • @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.

  • @hairmare
    @hairmare 7 ปีที่แล้ว

    Interesting video :) I never seemed to occur to me that having internet on the esp makes an rtc superfluous since we can use ntp.
    The olson db, tz, zoneinfo or time zone database (it has lots of names) managed by iana contains the rules for all the different zones DST times and more things like historical timezone info. It certainly contains the info you would need to implement "NTPtime::daylightSavingTime". It can be found at www.iana.org/time-zones. "man 5 tzfile" has info on the files structure.
    I assume the database is too large for inclusion on a esp module. The tarballs amount to almost 500kB and I'm assuming that quite some optimization would be needed to strip out the parts not needed for a given project (ie. historical data that is only needed for complex date calculation stuff).

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      Thanks for the tip about the link. I will look into it. Unfortunately, the work is not done if you know the definition. You have to translate it into code and test it. This is, why I thought, a viewer could help me out with this.

  • @KennethScharf
    @KennethScharf 7 ปีที่แล้ว +3

    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!

  • @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.

  • @norberthartmann5075
    @norberthartmann5075 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      Es gibt unterdessen eine einfachere Methode: th-cam.com/video/g62Atuf1cm4/w-d-xo.html. Vielleicht versucht du die mal?

  •  7 ปีที่แล้ว

    Nice :D

  • @themalaland1502
    @themalaland1502 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

      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.

  • @TheManFromMoon
    @TheManFromMoon 6 ปีที่แล้ว

    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  6 ปีที่แล้ว

      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...

  • @surenbono6063
    @surenbono6063 4 ปีที่แล้ว

    ...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  4 ปีที่แล้ว

      I do not think so because te Arduino has no connection to a smartphone

    • @surenbono6063
      @surenbono6063 4 ปีที่แล้ว

      Andreas Spiess ..you mean esp8266 is not considered an arduino.?

    • @surenbono6063
      @surenbono6063 4 ปีที่แล้ว

      ..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..

  • @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...

  • @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

  • @chinmoytahbildar3278
    @chinmoytahbildar3278 4 ปีที่แล้ว

    Plz make a detailed video on how to create a library for arduino IDE for different microcontroller board ... love your videos a lot... love from india

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว +1

      There are quite a few resources available for that topic.

    • @chinmoytahbildar3278
      @chinmoytahbildar3278 4 ปีที่แล้ว

      @@AndreasSpiess But I would love to learn from your detailed explanation if it would be possible

  • @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...

  • @ssaguiar
    @ssaguiar 7 ปีที่แล้ว

    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  7 ปีที่แล้ว

      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.

  • @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 ! :)

  • @TektorPlays
    @TektorPlays 4 ปีที่แล้ว

    Hi umm so well i'm new in arduino stuff and i wanted to ask how do i trigger function at specyfic times? with this library. Can anyone help me ?

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      I made a video where the ESP wakes up every day once.

  • @leandroboari
    @leandroboari 4 ปีที่แล้ว

    What's the ESP8266 RTC accuracy? Thank's Andreas!

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Depends on the temperature and other parameters. Maybe a few minutes off per day.

  • @plasticmirror
    @plasticmirror 4 ปีที่แล้ว +2

    The example sketch outputs this strange date: 2036-2-7-5 7H 28M 16S. I think something is wrong with the lib.

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Maybe. This is and old video. There is a built-in version available now. ( th-cam.com/video/g62Atuf1cm4/w-d-xo.html )

  • @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.