The use of the ESP8266 in the world of IoT

User avatar
By mboy03241990
#77669 I have a simple IoT project that I can control(on/off) via LAN in my farm or remotely(If internet is present) if needed.. I want to add basic load scheduling in this project to turn on/off my load let say any day of the week at a certain time. I could use NTP client for this to turn on/off let say every Tuesday/Friday at 4pm but the problem is NTP library is dependent to the NTP server which will need me to put internet on the device. I do not want to install internet on this device 24/7 just for the scheduler..

I plan only to use the NTP library for setting the device time initially then device is offline most of the time..

to make things short i want my scheduler work offline without using RTC.. Is there any chance I could do that without to connect RTC module?

What is the correct approach of this problem? I can remember the time from the NTP server initially but Im sure the time would be inaccurate or off after few days without syncing it to the NTP server..

Your ideas and advice would be greatly appreciated.
User avatar
By ros
#78880 Use NTP library and call in on boot to set time on chip. I've done something similar with my light control on schedule, check this out - https://github.com/palivoda/esp8266-lig ... c/main.cpp

https://github.com/stelgenhof/NTPClient

#include NtpClient.h
...
NTP.init((char *)DEFAULT_NTP_SERVER, UTC0200);
NTP.setPollingInterval(120*60); // Poll every 120 minutes, if you really need it. Or just once on boot is enough