ESP8266 GPS NTP Server in the making

Chris Liebman is my kind of maker.  His projects are interesting, practical and almost always have the words “work in progress” somewhere in the (usually brief) description.  I was led to the NTP-server project when following up on his (ESP8266-based) AnalogClock creation (a method of keeping el-cheapo analog clocks in perfect time, even across power outages and daylight-savings time changes, using an ESP8266 and NTP).

The NTP-server is another “work in progress” project, with very little information, Breadboard prototype NTP serverother than the code, available.  It does hit a couple of sweet spots for me, though:-  NTP from a GPS PPS (pulse-per-second) signal and being ESP based (although the breadboard picture shows an ESP32, rather than ESP8266).

Chris is using an Adafruit “Ultimate GPS Breakout” board to provide the PPS signal, as well as serial time and date information to the ESP (the GPS communicates with the ESP via the standard serial pins, while debug-terminal output goes to Serial1).

I have to admit that I haven’t managed to get Chris’ code to compile successfully, yet (you’ll need to download some of Chris’ modified versions of several required libraries to get even close), but this certainly looks like one to keep an eye on (and I’m wondering if a lead soldered to the ‘status’ LED on one of those cheap, USB, GPS dongles would work reliably as a PPS signal source in this case).




6 thoughts on “ESP8266 GPS NTP Server in the making

  1. John,
    I might be missing something here but what’s the benefit of using this GPS version of getting NTP (SNTP) data as opposed to getting NTP from a national server pool? This method requires an additional GPS module.
    I am assuming the PPS signal is fed to the analog clock. Just interested really.
    Thank for another good post and link.


    • Bob,

      If you have access to NTP via the net, then the only reason would be “because we can” (or almost can, anyway 🙂 ). If you happen to be running a bunch of sensors in a remote location with no direct (or an intermittent) ‘net connection, then this could be an answer to both an accurate timestamp and geolocation problem.

      Personally, I liked it simply because it tickled my fancy. 🙂


      P.S. – Not too much spare time at the moment, but I tried compiling with an ESP32 target (instead of the ESP8266) this morning and, unfortunately, it still didn’t work. I think I’m going to have to ask Chris for his secret sauce compile recipe.


  2. Very interesting! I have posted in various forums asking exactly about this i.e. the potential to run an NTP GPS-based time server on an ESP8266, but I had given up. I have also very much wanted some LUA-language-based GPS position/time code, and I did eventually find something, but no success for me yet.


    • Darren,

      I’m not sure that LUA would handle the NTP side of things fast enough, but it should work fine for a portable position/time readout.

      One of the things on my “must try” list is to add a wire to the LED (pin 3) output of the cheap module I have and check that it works as a genuine PPS signal (it should).

      I see that Chris has made some changes to the code recently, so I might try recompiling again when I have a couple of spare moments.



      • I should have mentioned that I currently have three SBTs (RPi and 2 OPis) with Ublox GPS devices attached, running PPS NTP. I also have GPSD running, so that there is more functionality there. On the RPi, I also have PiAware (flight tracking). However…it would be so cool if I could reduce the overall system cost of an NTP server down from (say) $50 CDN to $10 with an ESP8266-based board 🙂

        On the other hand, my current ESP8266s are used for remote weather sensor monitoring — and LUA makes it easy for me to do what I want — and it would be great to be able to easily supplement the weather tracking function with GPS position/time tracking — though I agree with you that LUA is not cut out for doing PPS-NTP stuff 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s