Setting nextion rtc from gps

Have tried to search for this using so many combinations but not found the answer.
Can i set the RTC on a nextion enhanced display using a GPS ???
i am trying to build a WSPR standalone tx to test antennas and require a fairly accurate time signal.
would use just the GPS time signal but when inside it is hit and miss if I could set the nextion RTC from the GPS and then use it when GPS signal unavailable it should maintain a high enough accuracy to operate

If the Nextion has an RTC then the answer is yes. What have you tried. Where are you stuck ?

have not tried yet lol wanted to know if possible
I guess what i will have to do is receive the gps clock on one serial of the mega 2560 and then send the RTC0-6 settings out on nextion serial
but surely there will be lag doing this i think i need a accuracy of around +/- 750 milliseconds the gps has a pps output to could i use this to increase accuracy ?

I would expect the time from the GPS should be very accurate as it depends on precise timing to calculate its position.

It would surely be best to use the time from the RTC, which will always be available, and only use the GPS to update it periodically. Transferring the time received from the GPS to the Nextion should take very little time at a high baud rate

What level of accuracy is available from the Nextion RTC ?

looking on internet the mileage varies have seen reports of nextion rtc loosing in excess of 5 seconds over a few days so would possibly use the gps to resync once a hour just to maintain accuracy

That sounds OK

If you write it in such a way as not to interfere with the rest of the sketch you could compare the RTC time and the GPS time more frequently but only update the RTC time when there is a significant discrepancy

What level of precision does the RTC provide ? If it only goes down to the level of seconds then you might just as well use the GPS time and use the RTC as a fall back when GPS is not available

Of course it's possible as @UKHeliBob has suggested.

If it were me I'd send the time from the GPS receiver to the Nextion every second while GPS time is available, then you know the Nextion time is as accurate as it can be. However, unless you take very careful precautions the time could be out by just under plus or minus 1 second on the Nextion, does this matter? To explain, suppose you send GPS time to the Nextion just a tiny fraction of a second before the Nextion clock was about to increment, so the Nextion clock is correct by GPS time, then a tiny fraction of a second later it increments, so the Nextion is now 1 second ahead.

This would be a disaster with the timing as it needs to be fairly accurate I may just go down the GPS clock route

The point I made applies to any secondary clock synchronised to a 1 second input from GPS or other accurate source. You can certainly get round it but doing so would require some careful programming. Any secondary clock is going to be less accurate then the master clock it is synchronised to, you have to determine if that loss of accuracy is tolerable and you have to mitigate it as best you can.

I've given this some more thought, you need to find out if the Nextion clock starts counting a new second each time you update the seconds' counter. What I mean is if you update it does that guarantee that it will increment 1 second later? I don't know the answer to this, I had a quick look at the Nextion instruction set and could not see anything relevant. Maybe you will need to experiment. If it does guarantee to update 1 second after you set the seconds' counter then you are OK, if not then it won't meet your requirements.

think i have solved this now using the pps output and syncing once every 12 hours seems to keep both clocks within required time

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.