While I don't have a GPS module, I do have boards from SynchroClock that have the DS3231 real time clock 1hz routed to a GPIO pin on on the ESP8266. This lets me pretend I have a GPS (and I read the current time from the DS3231).
I used a strategy mentioned by @Nick Sayer, in the comments on one of his projects here, and used the ESP8266 builtin CPU cycle counter, 80Mhz, to interpolate the time between seconds. And it answers queries!
flugelberry$ ntpdate -q -u 192.168.0.29
server 192.168.0.29, stratum 1, offset 0.273729, delay 0.06538
3 Nov 19:39:51 ntpdate[8704]: adjust time server 192.168.0.29 offset 0.273729 sec
EDIT: It turns out that ESP.getCycleCount() is not very consistent. Using this I end up with up with well over 250us of jitter! Maybe something with idle sleep or some other power saving mode? In any case using micros() works much much better with jitter less than 20us!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.