RTC time can drift

Hello, I’ve noticed some of my nodes can drift their RTC out by - in some cases an hour - over substantial time.

Can I propose that the android device send a command similar to -settime when it connects?. Perhaps with a condition of last update must have been > one day ago?

1 Like

If the device has GPS, would it not be wiser to update the time based on the GPS. This would ensure all devices are within a fraction of a second. The time on my phone can be wrong if I do not alow it to update via Network time, ie Airplane mode or wondering between time zones.

This would also allow a repeater to keep accurate time without being paired via BT.

3 Likes

Definitely a much better way ^!

Hmm. There should be zero drift. Perhaps I messed up and accidentally used the rc clock rather than the crystal. What type of board?

They are all 433Mhz of the below

LILYGO® TTGO Meshtastic T-Beam V1.1 ESP32 433/868/915/923Mhz WiFi Bluetooth ESP32 GPS NEO-6M SMA 18650 Battery

1 Like

thanks - yep bummer - they didn’t stuff a 32khz xtal on that board - bug created. It would be an easyish one for any new dev, otherwise I’ll fix it sometime in the next couple of months. If anyone wants to give it a shot, pipe up on the bug and the existing devs will happily help with tips.

The esp32 has internal methods to improve clock accuracy:

Still resetting based on GPS would also be useful. The document above has references on the methods to call to do this.

ooh great point - I’ll add a note to the bug to switch to the 8.5MHz clock.

I just implemented the 8.5MHz clock that @mc-hamster found. I ran a quick test last night and in 12 hrs (ish) the new clock only drifted 1 second. So still not as good as a true 32.768 xtal but far better than what it was. I’m leaving the bug open though, to apply GPS based time corrections. It is an easy change and will go in eventually.

3 Likes

@adds666 could you please tell me how you got and set this RTC value of your device?

Hi, I wasnt doing anything in the code as such - just observing the times each node reported back were drifting. Sorry I cant be of help.

@adds666 and how you’re observing the drift?

Hey, I’ll simply send a message and observe the time it states it was sent and compare that to the actual time.

Then a week later send a message and notice that the time Sent vs the actual time has drifted apart

My question to you is, how you managed to get the RTC time from the device? Were you using the mobile app and reading that time?

Yes. Sending a message with the app and observing the timestamp- comparing that to the real time.