Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] set the time without using NTP #36

Open
BramWerbrouck opened this issue Jan 6, 2025 · 5 comments
Open

[feature] set the time without using NTP #36

BramWerbrouck opened this issue Jan 6, 2025 · 5 comments

Comments

@BramWerbrouck
Copy link

Wouldn't it be nice to send te time yourself (with the app, or with buttons) so you are not using the NTP service?

@BramWerbrouck BramWerbrouck changed the title [feature] send the time without using NTP [feature] set the time without using NTP Jan 6, 2025
@techniccontroller
Copy link
Owner

Due to the use of NTP, I make my life easier. I don't need to care about the following two challenges of making clock with MCU:

  • Keep time during restart/power-off phases
  • Time drift due to inaccurate MCU clock / Keeping time in sync with real-time.

For my first Wordclock, I used an RTC module with a battery to avoid time drift and keep the time during the power-off phases.
However, the ESP8266-based word clock could be challenging without the RTC module. I think the first challenge can not be solved, so each time the ESP restarts, the time needs to be set again. As the ESP is known to restart randomly during operations, this is not really a way to go.

For the second challenge, there exists an interesting post where they tried to keep the time without RTC on an ESP8266 with promising results: https://www.instructables.com/TESTED-Timekeeping-on-ESP8266-Arduino-Uno-WITHOUT-/
It may be worth looking into.

I would be happy to hear if you have any other ideas about how to implement this feature while solving the two challenges above.

BR
Edgar

@BramWerbrouck
Copy link
Author

Ok, I understand your point. another question: what happens if the internet connection fails from time to time (not at the startup of the clock) ?

@techniccontroller
Copy link
Owner

If the internet connection fails (the NTP update is unsuccessful), the clock tries to connect to the NTP server for 5 minutes / 30 tries before it automatically restarts.

-> This may not be the most clever fallback strategy, but it works out fine, given the expectation that the Wi-Fi network is more stable than the ESP.

@BramWerbrouck
Copy link
Author

Just another thought: what about no internet access? If you're clock is build and you want to hang it in your garage (where there is no WiFi available)?

@techniccontroller
Copy link
Owner

It's the same issue; without internet access, the current version of the word clock will not work. So, the best option would be to add an RTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants