NOTE: This is functional but very much a work in progress at the moment.
This is an esp-idf app using platformio.
Synching the DS3231 to the GPS is done with a small high level (level 5) interrupt handler in assembly. This generates a timestamp and offset in microseconds tracking the active edges of the GPS PPS and RTC SQW signals. This data is then fed in to a PID algorithm that will generate an offset value used to speed up and slow down the DS3231 RTC. This keeps the DS3231 synced with the GPS to within a couple of microseconds. As a side benifit it also tunes the DS3231's ocilator to reduce drift when GPS is unavailable.
- main Contains the code
- kicad/esp-gps-ntp contains the schematic and board designs in KiCad.
- kicad/display-adapter contains the schematic and board design for a small adapter to config a single inline header connector to an IDC connector (for ribbon cable connection of display)
The display I'm using is here