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

Set RTC without connecting to SNTP server #994

Closed
felixzhang97 opened this issue Jan 13, 2018 · 5 comments
Closed

Set RTC without connecting to SNTP server #994

felixzhang97 opened this issue Jan 13, 2018 · 5 comments

Comments

@felixzhang97
Copy link

Hi. I'm currently developing an automation program and need to use real time clock. As i read, esp32 has built-in RTC and there are way to config time using NTP server. My problem is i'm not using wifi and my program will run totally in offline mode. Is there any way i can set the time without connecting to any server?(i planned to set time via bluetooth)

Thankyou.

@marian-craciunescu
Copy link

any ideas?

@lrmoreno007
Copy link

lrmoreno007 commented Feb 13, 2018

The problem:
RTC in esp32 is made for internal timing process, and it have a bad accuracy. https://www.esp32.com/viewtopic.php?t=3715

As a solution, you can determine what the error is on each board and establish a correction mechanism.

Any ideas?:
You can set the time with in the same way as in the example ESP8266/NTP-TZ-DST (see constant RTC_TEST) (it's epoch time - seconds since January 1, 1970), for this you can use two or three button (SET, + or/and -) and a display, as in many clocks and home appliances.

You can get time and date too when upload a new sketch with the Arduino variables: " DATE " and " TIME ", but this is a fixed time when you upload the sketch and if you loose the power, the time back to the upload time. It's not a good solution...

Regards.

@everslick
Copy link
Contributor

This issue is closed, because it looks as if it is not a bug or problem with the ESP32 Arduino core or its support libraries. For general API usage questions or help on specific coding challenges, please visit the arduino-esp32 Gitter channel. If you feel this issue was closed in error, reopen it and comment, why you think this is a bug in the Arduino-Core.

@fbiego
Copy link

fbiego commented Jan 17, 2021

I wrote a library for that, check it out here

https://github.com/fbiego/ESP32Time

@lbernstone
Copy link
Contributor

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

6 participants